-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
195 lines (170 loc) · 5.36 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
193
194
195
import org.gradle.internal.os.OperatingSystem
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
group = "tech.relaycorp"
plugins {
// Apply the Kotlin JVM plugin to add support for Kotlin.
id("org.jetbrains.kotlin.jvm") version "2.0.20"
// Apply the java-library plugin for API and implementation separation.
`java-library`
id("org.jlleitschuh.gradle.ktlint") version "12.1.1"
jacoco
signing
`maven-publish`
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
}
repositories {
mavenCentral()
}
dependencies {
val kotlinCoroutinesVersion = "1.8.1"
// Align versions of all Kotlin components
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
api("tech.relaycorp:awala:[1.68.5,2.0.0)")
testImplementation("tech.relaycorp:awala-testing:1.5.34")
implementation("org.mongodb:bson:5.1.3")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinCoroutinesVersion")
testImplementation("org.jetbrains.kotlin:kotlin-test")
testImplementation("org.junit.jupiter:junit-jupiter:5.11.0")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.11.0")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinCoroutinesVersion")
}
java {
withJavadocJar()
withSourcesJar()
}
kotlin {
explicitApi()
}
jacoco {
toolVersion = "0.8.8"
}
tasks.jacocoTestReport {
reports {
xml.required.set(true)
html.required.set(true)
html.outputLocation.set(file("$buildDir/reports/coverage"))
}
}
tasks.jacocoTestCoverageVerification {
violationRules {
rule {
limit {
counter = "CLASS"
value = "MISSEDCOUNT"
maximum = 0.toBigDecimal()
}
limit {
counter = "METHOD"
value = "MISSEDCOUNT"
maximum = 1.toBigDecimal()
}
limit {
counter = "BRANCH"
value = "MISSEDCOUNT"
// Filesystem readability/writability checks don't work on Windows
maximum = (if (OperatingSystem.current().isWindows) 13 else 1).toBigDecimal()
}
}
}
}
tasks.test {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
finalizedBy("jacocoTestReport")
doLast {
println("View code coverage at:")
println("file://$buildDir/reports/coverage/index.html")
}
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "1.8"
allWarningsAsErrors = true
freeCompilerArgs = freeCompilerArgs +
arrayOf(
"-opt-in=kotlin.RequiresOptIn",
)
}
}
signing {
useGpgCmd()
setRequired {
gradle.taskGraph.allTasks.any { it is PublishToMavenRepository }
}
val signingKeyId: String? by project
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
sign(publishing.publications)
}
publishing {
publications {
create<MavenPublication>("default") {
from(components["java"])
pom {
name.set(rootProject.name)
description.set(
"JVM implementation of file-based Private and Public Key Stores for Awala",
)
url.set("https://github.com/relaycorp/awala-keystore-file-jvm")
developers {
developer {
id.set("relaycorp")
name.set("Relaycorp, Inc.")
email.set("[email protected]")
}
}
licenses {
license {
name.set("Apache-2.0")
}
}
scm {
connection.set(
"scm:git:https://github.com/relaycorp/awala-keystore-file-jvm.git",
)
developerConnection.set(
"scm:git:https://github.com/relaycorp/awala-keystore-file-jvm.git",
)
url.set("https://github.com/relaycorp/awala-keystore-file-jvm")
}
}
}
}
repositories {
maven {
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(
uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"),
)
username.set(System.getenv("MAVEN_USERNAME"))
password.set(System.getenv("MAVEN_PASSWORD"))
}
}
}
tasks.publish {
finalizedBy("closeAndReleaseSonatypeStagingRepository")
}
configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
version.set("1.3.1")
}
gradleEnterprise {
buildScan {
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
}
}