/
kotest-publishing-conventions.gradle.kts
90 lines (78 loc) · 2.39 KB
/
kotest-publishing-conventions.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
plugins {
signing
`java-library`
`maven-publish`
}
val publications: PublicationContainer = (extensions.getByName("publishing") as PublishingExtension).publications
val javadoc = tasks.named("javadoc")
group = "io.kotest"
version = Ci.publishVersion
val javadocJar by tasks.creating(Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = "Assembles java doc to jar"
archiveClassifier.set("javadoc")
from(javadoc)
}
publishing {
publications.withType<MavenPublication>().forEach {
it.apply {
artifact(javadocJar)
}
}
}
val ossrhUsername: String by project
val ossrhPassword: String by project
val signingKey: String? by project
val signingPassword: String? by project
signing {
useGpgCmd()
if (signingKey != null && signingPassword != null) {
@Suppress("UnstableApiUsage")
useInMemoryPgpKeys(signingKey, signingPassword)
}
if (Ci.isRelease) {
sign(publications)
}
}
publishing {
repositories {
maven {
val releasesRepoUrl = uri("https://https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/")
name = "deploy"
url = if (Ci.isRelease) releasesRepoUrl else snapshotsRepoUrl
credentials {
username = System.getenv("OSSRH_USERNAME") ?: ossrhUsername
password = System.getenv("OSSRH_PASSWORD") ?: ossrhPassword
}
}
}
publications.withType<MavenPublication>().forEach {
it.apply {
//if (Ci.isRelease)
pom {
name.set("Kotest")
description.set("Kotlin Test Framework")
url.set("https://github.com/kotest/kotest")
scm {
connection.set("scm:git:https://github.com/kotest/kotest/")
developerConnection.set("scm:git:https://github.com/sksamuel/")
url.set("https://github.com/kotest/kotest/")
}
licenses {
license {
name.set("Apache-2.0")
url.set("https://opensource.org/licenses/Apache-2.0")
}
}
developers {
developer {
id.set("sksamuel")
name.set("Stephen Samuel")
email.set("sam@sksamuel.com")
}
}
}
}
}
}