forked from grpc/grpc-kotlin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
138 lines (115 loc) · 4.54 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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
plugins {
kotlin("jvm") version "1.3.72" apply false
id("com.google.protobuf") version "0.8.15" apply false
}
ext["grpcVersion"] = "1.36.0" // CURRENT_GRPC_VERSION
ext["protobufVersion"] = "3.14.0"
ext["coroutinesVersion"] = "1.3.3"
subprojects {
apply {
plugin("java")
plugin("org.jetbrains.kotlin.jvm")
plugin("com.google.protobuf")
plugin("maven-publish")
plugin("signing")
}
group = "io.grpc"
version = "1.2.0" // CURRENT_GRPC_KOTLIN_VERSION
repositories {
mavenCentral()
}
tasks.withType<JavaCompile> {
sourceCompatibility = JavaVersion.VERSION_1_7.toString()
targetCompatibility = JavaVersion.VERSION_1_7.toString()
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = JavaVersion.VERSION_1_6.toString()
}
}
tasks.withType<Test> {
testLogging {
showStandardStreams = true
// set options for log level LIFECYCLE
events = setOf(
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_OUT
)
exceptionFormat = TestExceptionFormat.FULL
showExceptions = true
showCauses = true
showStackTraces = true
// set options for log level DEBUG and INFO
debug {
events = setOf(
TestLogEvent.STARTED,
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_ERROR,
TestLogEvent.STANDARD_OUT
)
exceptionFormat = TestExceptionFormat.FULL
}
info.events = debug.events
info.exceptionFormat = debug.exceptionFormat
}
afterSuite(
KotlinClosure2({ desc: TestDescriptor, result: TestResult ->
if (desc.parent == null) { // will match the outermost suite
println("Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)")
}
})
)
}
extensions.getByType<PublishingExtension>().publications {
create<MavenPublication>("maven") {
pom {
url.set("https://github.com/grpc/grpc-kotlin")
scm {
connection.set("scm:git:https://github.com/grpc/grpc-kotlin.git")
developerConnection.set("scm:git:[email protected]:grpc/grpc-kotlin.git")
url.set("https://github.com/grpc/grpc-kotlin")
}
licenses {
license {
name.set("Apache 2.0")
url.set("https://opensource.org/licenses/Apache-2.0")
}
}
developers {
developer {
id.set("grpc.io")
name.set("gRPC Contributors")
email.set("[email protected]")
url.set("https://grpc.io/")
organization.set("gRPC Authors")
organizationUrl.set("https://www.google.com")
}
}
}
}
}
extensions.getByType<PublishingExtension>().repositories {
maven {
val snapshotUrl = uri("https://oss.sonatype.org/content/repositories/snapshots")
val releaseUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")
url = if (version.safeAs<String>()?.endsWith("SNAPSHOT") == true) snapshotUrl else releaseUrl
credentials {
username = project.findProperty("sonatypeUsername")?.safeAs() ?: ""
password = project.findProperty("sonatypePassword")?.safeAs() ?: ""
}
}
}
extensions.getByType<SigningExtension>().sign(extensions.getByType<PublishingExtension>().publications.named("maven").get())
tasks.withType<Sign> {
onlyIf { project.hasProperty("signing.keyId") }
}
}