forked from grpc/grpc-kotlin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
140 lines (116 loc) · 4.37 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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.6.21" apply false
id("com.google.protobuf") version "0.8.18" apply false
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
}
group = "io.grpc"
version = "1.3.0" // CURRENT_GRPC_KOTLIN_VERSION
ext["grpcVersion"] = "1.46.0"
ext["protobufVersion"] = "3.20.1"
ext["coroutinesVersion"] = "1.6.2"
subprojects {
apply {
plugin("java")
plugin("org.jetbrains.kotlin.jvm")
plugin("com.google.protobuf")
plugin("maven-publish")
plugin("signing")
}
// gradle-nexus/publish-plugin needs these here too
group = rootProject.group
version = rootProject.version
repositories {
mavenCentral()
}
tasks.withType<JavaCompile> {
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
targetCompatibility = JavaVersion.VERSION_1_8.toString()
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = JavaVersion.VERSION_1_8.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<SigningExtension>().sign(extensions.getByType<PublishingExtension>().publications.named("maven").get())
extensions.getByType<SigningExtension>().useInMemoryPgpKeys(System.getenv("GPG_PRIVATE_KEY"), System.getenv("GPG_PASSPHRASE"))
tasks.withType<Sign> {
onlyIf { System.getenv("GPG_PRIVATE_KEY") != null }
}
}
nexusPublishing {
repositories {
sonatype {
username.set(System.getenv("SONATYPE_USERNAME"))
password.set(System.getenv("SONATYPE_PASSWORD"))
}
}
}