-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
192 lines (172 loc) · 6.81 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
plugins {
kotlin("jvm")
`maven-publish`
`java-library`
id("org.jetbrains.dokka")
id("org.jlleitschuh.gradle.ktlint")
id("com.jfrog.bintray")
}
repositories {
jcenter()
mavenCentral()
}
subprojects {
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "org.gradle.maven-publish")
apply(plugin = "org.jetbrains.dokka")
apply(plugin = "org.jlleitschuh.gradle.ktlint")
apply(plugin = "com.jfrog.bintray")
apply(plugin = "org.gradle.java-library")
val projectGroup: String by project
val projectVersion: String by project
val projectDescription: String by project
group = projectGroup
version = projectVersion
description = projectDescription
repositories {
jcenter()
mavenCentral()
}
val grpcVersion: String by project
val kotlinxVersion: String by project
val slf4jVersion: String by project
val logbackVersion: String by project
val jUnitVersion: String by project
val assertjVersion: String by project
plugins.withType<JavaPlugin> {
extensions.configure<JavaPluginExtension> {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
dependencies {
implementation(platform("io.grpc:grpc-bom:$grpcVersion"))
implementation(platform("org.jetbrains.kotlinx:kotlinx-coroutines-bom:$kotlinxVersion"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core")
implementation("io.grpc:grpc-core")
implementation("io.grpc:grpc-services")
implementation("org.slf4j:slf4j-api:$slf4jVersion")
runtimeOnly("io.grpc:grpc-netty")
runtimeOnly("ch.qos.logback:logback-classic:$logbackVersion")
testImplementation(platform("org.junit:junit-bom:$jUnitVersion"))
testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("org.assertj:assertj-core:$assertjVersion")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-debug")
}
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "1.8"
}
}
kotlin {
explicitApi = org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode.Strict
}
tasks.test {
useJUnitPlatform()
testLogging {
showStandardStreams = true
}
jvmArgs = listOf("-ea")
}
if (!project.name.endsWith("-test")) {
tasks.dokkaHtml.configure {
outputDirectory.set(buildDir.resolve("javadoc"))
dokkaSourceSets.configureEach {
jdkVersion.set(8)
skipEmptyPackages.set(true)
platform.set(org.jetbrains.dokka.Platform.jvm)
}
}
val sourcesJar by tasks.creating(Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = "Creates a sources JAR"
archiveClassifier.set("sources")
from(sourceSets.main.get().allSource)
}
val kdocJar by tasks.creating(Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = "Creates KDoc"
archiveClassifier.set("javadoc")
from(tasks.dokkaHtml)
}
tasks.jar.configure {
finalizedBy(sourcesJar, kdocJar)
}
val licenseName: String by project
val licenseUrl: String by project
val developerName: String by project
val developerEmail: String by project
val gitHubUsername: String by project
val gitHubUrl: String by lazy { "github.com/$gitHubUsername/${rootProject.name}" }
publishing {
publications {
create<MavenPublication>("maven") {
afterEvaluate {
val shadowJar = tasks.findByName("shadowJar")
if (shadowJar == null) from(components["java"])
else artifact(shadowJar)
}
artifact(kdocJar)
artifact(sourcesJar)
pom {
name.set("${project.group}:${project.name}")
description.set(project.description)
url.set("https://$gitHubUrl")
licenses {
license {
name.set(licenseName)
url.set(licenseUrl)
}
}
developers {
developer {
name.set(developerName)
email.set(developerEmail)
}
}
scm {
connection.set("scm:git:git://$gitHubUrl.git")
developerConnection.set("scm:git:ssh://github.com:$gitHubUsername/${rootProject.name}.git")
url.set("https://$gitHubUrl")
}
}
}
}
}
val bintrayRepo: String by project
val projectLabels: String by project
bintray {
user = (findProperty("bintrayUser") ?: System.getenv("BINTRAY_USER"))?.toString()
key = (findProperty("bintrayKey") ?: System.getenv("BINTRAY_KEY"))?.toString()
setPublications(*publishing.publications.names.toTypedArray())
with(pkg) {
repo = bintrayRepo
name = "${project.group}:${project.name}"
desc = project.description
websiteUrl = "https://$gitHubUrl"
vcsUrl = "https://$gitHubUrl.git"
setLabels(*projectLabels.split(",".toRegex()).map { it.trim() }.toTypedArray())
setLicenses(licenseName)
with(version) {
name = project.version.toString()
with(gpg) {
sign = true
}
with(mavenCentralSync) {
sync = true
user = (findProperty("sonatypeUser") ?: System.getenv("SONATYPE_USER"))?.toString()
password = (findProperty("sonatypePwd") ?: System.getenv("SONATYPE_PWD"))?.toString()
}
}
}
publish = true
override = false
dryRun = false
}
}
}
val bintrayUpload: com.jfrog.bintray.gradle.tasks.BintrayUploadTask by tasks
bintrayUpload.enabled = false