-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
192 lines (168 loc) · 5.27 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
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Kotlin library project to get you started.
*/
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.1.0"
// Apply the java-library plugin for API and implementation separation.
`java-library`
id("org.jetbrains.dokka") version "1.9.20"
id("org.jlleitschuh.gradle.ktlint") version "12.1.2"
jacoco
signing
`maven-publish`
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
}
repositories {
mavenCentral()
}
dependencies {
val kotlinCoroutinesVersion = "1.9.0"
val bouncyCastleVersion = "1.70"
val junitJuniperVersion = "5.11.3"
// Align versions of all Kotlin components
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinCoroutinesVersion")
// Bouncy Castle
implementation("org.bouncycastle:bcpkix-jdk15on:$bouncyCastleVersion")
implementation("org.bouncycastle:bcprov-jdk15on:$bouncyCastleVersion") // ASN.1 serialization
testImplementation("org.jetbrains.kotlin:kotlin-test")
testImplementation("org.junit.jupiter:junit-jupiter:$junitJuniperVersion")
testImplementation("org.junit.jupiter:junit-jupiter-params:$junitJuniperVersion")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinCoroutinesVersion")
}
java {
withJavadocJar()
withSourcesJar()
}
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 = "0".toBigDecimal()
}
limit {
counter = "BRANCH"
value = "MISSEDCOUNT"
maximum = "2".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 = JavaVersion.VERSION_17.toString()
allWarningsAsErrors = true
freeCompilerArgs = freeCompilerArgs +
arrayOf(
"-opt-in=kotlin.RequiresOptIn",
)
}
}
tasks.dokkaHtml.configure {
dokkaSourceSets {
configureEach {
reportUndocumented.set(true)
}
}
}
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("Awala JVM library")
url.set("https://github.com/relaycorp/awala-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-jvm.git")
developerConnection.set("scm:git:https://github.com/relaycorp/awala-jvm.git")
url.set("https://github.com/relaycorp/awala-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.0.1")
}