-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
133 lines (105 loc) · 3.88 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
125
126
127
128
129
130
131
132
133
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import java.net.URI
plugins {
kotlin("jvm") apply false
id("org.jetbrains.dokka") apply false
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
}
subprojects {
plugins.withId("org.jetbrains.kotlin.jvm") {
configure<KotlinJvmProjectExtension> {
jvmToolchain(11)
}
dependencies {
"compileOnly"(kotlin("stdlib"))
"compileOnly"(kotlin("stdlib-jdk8"))
}
}
plugins.withType<JavaPlugin> {
configure<JavaPluginExtension> {
withSourcesJar()
withJavadocJar()
}
tasks.withType<Test> {
useJUnitPlatform()
systemProperty("java.io.tmpdir", layout.buildDirectory.dir("tmp"))
}
plugins.withType<MavenPublishPlugin> {
with(the<PublishingExtension>()) {
publications.create<MavenPublication>("mavenJava") {
from(components["java"])
}
}
}
}
plugins.withType<MavenPublishPlugin> {
plugins.apply(SigningPlugin::class)
val publishing = the<PublishingExtension>()
publishing.publications.withType<MavenPublication> {
pom {
val githubRepo = providers.gradleProperty("githubRepo")
val githubUrl = githubRepo.map { "https://github.com/$it" }
name.set(providers.gradleProperty("projectName"))
description.set(providers.gradleProperty("projectDescription"))
url.set(providers.gradleProperty("projectUrl"))
licenses {
license {
name.set(providers.gradleProperty("projectLicenseName"))
url.set(providers.gradleProperty("projectLicenseUrl"))
}
}
developers {
developer {
name.set(providers.gradleProperty("developerName"))
email.set(providers.gradleProperty("developerEmail"))
url.set(providers.gradleProperty("developerUrl"))
}
}
scm {
url.set(githubUrl.map { "$it/tree/master" })
connection.set(githubRepo.map { "scm:git:git://github.com/$it.git" })
developerConnection.set(githubRepo.map { "scm:git:ssh://github.com:$it.git" })
}
issueManagement {
url.set(githubUrl.map { "$it/issues" })
system.set("GitHub")
}
}
}
publishing.repositories {
maven {
name = "local"
url = file(layout.buildDirectory.dir("repos/releases")).toURI()
}
}
with(the<SigningExtension>()) {
sign(publishing.publications)
}
}
plugins.withId("org.jetbrains.dokka") {
val dokkaVersion: String by extra
dependencies {
"dokkaJavadocPlugin"("org.jetbrains.dokka:kotlin-as-java-plugin:$dokkaVersion")
}
tasks.withType<Jar>().matching { it.name == "javadocJar" }
.configureEach {
from(tasks.named("dokkaJavadoc"))
}
tasks.withType<org.jetbrains.dokka.gradle.DokkaTask> {
dependsOn("classes")
dokkaSourceSets {
named("main") {
sourceLink {
val githubUrl = project.extra["github.url"] as String
localDirectory.set(project.file("src/main/kotlin"))
remoteUrl.set(URI("$githubUrl/tree/master/").toURL())
remoteLineSuffix.set("#L")
}
}
}
}
}
}
nexusPublishing.repositories {
sonatype()
}