-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.gradle.kts
122 lines (104 loc) · 3.5 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
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.extensions.DetektExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
val jvmVersion: String by project
val detektFormattingVersion: String by project
val kotestVersion: String by project
extra["isReleaseVersion"] = !version.toString().endsWith("SNAPSHOT")
plugins {
kotlin("jvm")
`maven-publish`
signing
id("org.jetbrains.dokka")
id("io.gitlab.arturbosch.detekt")
id("com.github.ben-manes.versions")
id("io.github.gradle-nexus.publish-plugin")
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
implementation(kotlin("reflect"))
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:$detektFormattingVersion")
testImplementation("io.kotest:kotest-runner-junit5:$kotestVersion")
}
kotlin {
explicitApi()
}
java {
withSourcesJar()
}
val javadocJar by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
from(tasks.dokkaJavadoc)
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
artifact(javadocJar.get())
pom {
name.set("KTypes")
description.set("KTypes is a zero-dependency Kotlin library for accurately introspecting type information")
url.set("https://github.com/pluses/ktypes")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("CloudPluses")
name.set("CloudPluses Team")
}
}
scm {
connection.set("scm:git:git://github.com/pluses/ktypes.git")
developerConnection.set("scm:git:ssh://github.com/pluses/ktypes.git")
url.set("https://github.com/pluses/ktypes/")
}
}
}
}
}
nexusPublishing {
repositories {
sonatype {
val sonatypeUsername = findProperty("sonatypeUsername")?.toString() ?: System.getenv("SONATYPE_USERNAME")
val sonatypePassword = findProperty("sonatypePassword")?.toString() ?: System.getenv("SONATYPE_PASSWORD")
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username.set(sonatypeUsername)
password.set(sonatypePassword)
}
}
}
signing {
val signingKey = findProperty("signingKey")?.toString() ?: System.getenv("SIGNING_KEY")
val signingPassword = findProperty("signingPassword")?.toString() ?: System.getenv("SIGNING_PASSWORD")
setRequired({
(extra["isReleaseVersion"] as Boolean) && gradle.taskGraph.hasTask("publish")
})
useInMemoryPgpKeys(signingKey, signingPassword)
sign(publishing.publications["mavenJava"])
}
tasks {
withType<KotlinCompile> {
kotlinOptions {
jvmTarget = jvmVersion
freeCompilerArgs = freeCompilerArgs + "-Xopt-in=kotlin.RequiresOptIn"
}
}
withType<Detekt> {
jvmTarget = jvmVersion
}
test {
useJUnitPlatform()
}
}
configure<DetektExtension> {
buildUponDefaultConfig = true
config = rootProject.files("detekt.yml")
}