-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
121 lines (101 loc) · 2.78 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.util.*
plugins {
kotlin("jvm") version "1.6.10"
`maven-publish`
jacoco
}
group = "com.kbapps.ephemeris"
version = "2.1.1"
repositories {
mavenCentral()
}
dependencies {
implementation(kotlin("stdlib-jdk8"))
// https://mvnrepository.com/artifact/org.hamcrest/hamcrest-all
testImplementation("org.hamcrest:hamcrest-all:1.3")
testImplementation("org.junit.jupiter:junit-jupiter:5.5.1")
}
val test by tasks.getting(Test::class) {
useJUnitPlatform { }
}
tasks.jacocoTestReport {
reports {
xml.isEnabled = false
csv.isEnabled = false
html.isEnabled = true
html.destination = file("$buildDir/reports/coverage")
}
}
tasks.jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = "0.95".toBigDecimal()
}
}
}
}
tasks {
val sourcesJar by creating(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets.main.get().allSource)
}
val javadocJar by creating(Jar::class) {
dependsOn.add(javadoc)
archiveClassifier.set("javadoc")
from(javadoc)
}
artifacts {
archives(sourcesJar)
archives(javadocJar)
archives(jar)
}
}
configure<JavaPluginConvention> {
sourceCompatibility = JavaVersion.VERSION_1_8
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
publishing {
val props = Properties().apply {
load(
file(
System.getenv("repoConfig")
?: "${System.getProperty("user.home")}${File.separator}repository.properties"
).inputStream()
)
}
publications {
create<MavenPublication>("maven") {
groupId = "com.github.kb0"
artifactId = "kotlin-ephemeris"
version = project.version.toString()
from(components["java"])
}
}
repositories {
if (props.getProperty("publish.store") != null) {
maven {
url = uri(props.getProperty("publish.store"))
credentials(HttpHeaderCredentials::class) {
name = "Deploy-Token"
value = props.getProperty("publish.token")
}
authentication {
create<HttpHeaderAuthentication>("header")
}
}
}
if (System.getenv("GITHUB_TOKEN") != null) {
maven {
url = uri("https://maven.pkg.github.com/kb0/kotlin-ephemeris")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
}