-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.gradle.kts
103 lines (92 loc) · 3.36 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
import org.jetbrains.dokka.gradle.DokkaTask
import java.util.*
plugins {
`java-library`
`maven-publish`
signing
id("org.jetbrains.dokka") version "1.6.0"
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
}
if (hasProperty("release")) {
val ossrhUsername = System.getenv("OSSRH_USERNAME")
val ossrhPassword = System.getenv("OSSRH_PASSWORD")
val releaseVersion = System.getenv("RELEASE_VERSION")
group = "dev.krud"
version = releaseVersion
nexusPublishing {
sonatype {
username.set(ossrhUsername)
password.set(ossrhPassword)
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}
}
allprojects {
repositories {
mavenLocal()
mavenCentral()
}
apply(plugin = "java-library")
apply(plugin = "maven-publish")
apply(plugin = "signing")
if (hasProperty("release")) {
val releaseVersion = System.getenv("RELEASE_VERSION")
val signingKeyBase64 = System.getenv("OSSRH_GPG_SECRET_KEY_BASE64")
val signingPassword = System.getenv("OSSRH_GPG_SECRET_KEY_PASSWORD")
group = "dev.krud"
version = releaseVersion
val isSnapshot = version.toString().endsWith("-SNAPSHOT")
java {
withJavadocJar()
withSourcesJar()
}
publishing {
publications.create<MavenPublication>("maven") {
from(components["java"])
artifactId = project.name
pom {
name.set(project.name)
description.set("A Kotlin library for intelligent object mapping.")
url.set("https://github.com/krud-dev/shapeshift/shapeshift")
licenses {
license {
name.set("MIT License")
url.set("https://opensource.org/licenses/MIT")
}
}
developers {
developer {
name.set("KRUD")
email.set("[email protected]")
organization.set("KRUD")
organizationUrl.set("https://www.krud.dev")
}
}
scm {
connection.set("scm:git:git://github.com/krud-dev/shapeshift.git")
developerConnection.set("scm:git:ssh://[email protected]/krud-dev/shapeshift.git")
url.set("https://github.com/krud-dev/shapeshift")
}
}
}
}
val javadocTask = tasks.named<Javadoc>("javadoc").get()
tasks.withType<DokkaTask> {
javadocTask.dependsOn(this)
outputDirectory.set(javadocTask.destinationDir)
}
signing {
val signingKey = signingKeyBase64?.let { decodeBase64(it) }
useInMemoryPgpKeys(
signingKey, signingPassword
)
sign(publishing.publications["maven"])
}
}
}
fun decodeBase64(base64: String): String {
return String(Base64.getDecoder().decode(base64))
}