-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
124 lines (105 loc) · 3.51 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
122
123
124
repositories {
mavenLocal()
mavenCentral()
}
plugins {
kotlin("jvm")
`java-library`
`maven-publish`
signing
id("io.github.gradle-nexus.publish-plugin")
}
group = "com.target"
dependencies {
val kotlinCoroutinesVersion: String by project
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinCoroutinesVersion")
val junitVersion: String by project
testImplementation(kotlin("test-junit5"))
testImplementation("org.junit.jupiter:junit-jupiter-api:$junitVersion")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitVersion")
val kotestVersion: String by project
testImplementation("io.kotest:kotest-assertions-core:$kotestVersion")
val mockkVersion: String by project
testImplementation("io.mockk:mockk:$mockkVersion")
}
val jvmTargetVersion: String by project
tasks {
compileJava { options.release.set(jvmTargetVersion.toInt()) }
compileKotlin { kotlinOptions { jvmTarget = jvmTargetVersion } }
compileTestKotlin { kotlinOptions { jvmTarget = jvmTargetVersion } }
withType<Test> {
useJUnitPlatform()
}
}
java {
withJavadocJar()
withSourcesJar()
}
publishing {
repositories {
maven {
credentials(PasswordCredentials::class)
name = "sonatype" // correlates with the environment variable set in the github action release.yml publish job
val releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
val snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
setUrl(if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl)
}
}
publications {
val projectTitle: String by project
val projectDescription: String by project
val projectUrl: String by project
val projectScm: String by project
create<MavenPublication>("mavenJava") {
artifactId = rootProject.name
from(components["java"])
versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
pom {
name.set(projectTitle)
description.set(projectDescription)
url.set(projectUrl)
licenses {
license {
name.set("MIT")
url.set("https://opensource.org/licenses/MIT")
}
}
developers {
developer {
id.set("ossteam")
name.set("OSS Office")
email.set("[email protected]")
}
}
scm {
url.set(projectScm)
}
}
}
}
}
signing {
val signingKey: String? by project
val signingPassword: String? by project
if (signingKey.isNullOrBlank() || signingPassword.isNullOrBlank()) {
isRequired = false
} else {
useInMemoryPgpKeys(signingKey, signingPassword)
sign(publishing.publications)
}
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}