-
Notifications
You must be signed in to change notification settings - Fork 166
/
build.gradle.kts
150 lines (126 loc) · 4.6 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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.protobuf) apply false
alias(libs.plugins.test.retry)
alias(libs.plugins.publish.plugin)
alias(libs.plugins.qoomon.git.versioning)
}
group = "io.grpc"
gitVersioning.apply {
refs {
tag("v(?<version>.*)") {
version = "\${ref.version}"
}
}
rev {
version = "\${commit}"
}
}
subprojects {
apply {
plugin("java")
plugin("org.jetbrains.kotlin.jvm")
plugin("com.google.protobuf")
plugin("org.gradle.test-retry")
plugin("maven-publish")
plugin("signing")
}
// gradle-nexus/publish-plugin needs these here too
group = rootProject.group
version = rootProject.version
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 {
// set options for log level LIFECYCLE
events = setOf(
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_OUT
)
exceptionFormat = TestExceptionFormat.FULL
showStandardStreams = true
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
}
retry {
maxRetries = 10
}
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>().repositories {
maven {
url = uri(rootProject.layout.buildDirectory.dir("maven-repo"))
}
}
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:git@github.com: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("grpc-io@googlegroups.com")
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"))
}