forked from TBD54566975/web5-kt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
292 lines (255 loc) · 7.94 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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
import io.gitlab.arturbosch.detekt.Detekt
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.dokka.DokkaConfiguration
import org.jetbrains.dokka.gradle.DokkaTaskPartial
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import java.net.URL
plugins {
id("org.jetbrains.kotlin.jvm") version "1.9.+"
id("java-library")
id("io.gitlab.arturbosch.detekt") version "1.23.+"
`maven-publish`
id("org.jetbrains.dokka") version "1.9.+"
id("org.jetbrains.kotlinx.kover") version "0.7.+"
signing
idea
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
}
configurations.all {
resolutionStrategy {
// Pin the transitive dep to a version that's not vulnerable.
force("com.fasterxml.woodstox:woodstox-core:6.4.0")
}
}
repositories {
mavenCentral()
}
dependencies {
api(project(":common"))
api(project(":credentials"))
api(project(":crypto"))
api(project(":dids"))
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.+")
}
allprojects {
group = "xyz.block"
}
subprojects {
repositories {
mavenCentral()
maven("https://jitpack.io")
}
apply {
plugin("io.gitlab.arturbosch.detekt")
plugin("org.jetbrains.kotlin.jvm")
plugin("java-library")
plugin("maven-publish")
plugin("org.jetbrains.dokka")
plugin("org.jetbrains.kotlinx.kover")
plugin("signing")
plugin("idea")
}
configurations.all {
resolutionStrategy {
// Pin the transitive dep to a version that's not vulnerable.
force("com.fasterxml.woodstox:woodstox-core:6.4.0")
}
}
tasks.withType<Detekt>().configureEach {
jvmTarget = "1.8"
}
sourceSets {
create("intTest") {
compileClasspath += sourceSets.main.get().output
runtimeClasspath += sourceSets.main.get().output
}
}
val intTestImplementation by configurations.getting {
extendsFrom(configurations.implementation.get())
}
val intTestRuntimeOnly by configurations.getting
configurations["intTestRuntimeOnly"].extendsFrom(configurations.runtimeOnly.get())
dependencies {
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.4")
detektPlugins("com.github.TBD54566975:tbd-detekt-rules:v0.0.2")
testImplementation("org.junit.jupiter:junit-jupiter:5.9.2")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
intTestImplementation(kotlin("test"))
intTestImplementation("org.junit.jupiter:junit-jupiter:5.9.2")
intTestRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
idea {
module {
testSources.from(sourceSets["intTest"].java.srcDirs)
testSources.from(sourceSets["intTest"].kotlin.srcDirs)
}
}
val integrationTest = task<Test>("integrationTest") {
description = "Runs integration tests."
group = "verification"
testClassesDirs = sourceSets["intTest"].output.classesDirs
classpath = sourceSets["intTest"].runtimeClasspath
shouldRunAfter("test")
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed", "standardOut", "standardError")
exceptionFormat = TestExceptionFormat.FULL
showExceptions = true
showCauses = true
showStackTraces = true
}
}
tasks.check { dependsOn(integrationTest) }
detekt {
config.setFrom("$rootDir/config/detekt.yml")
}
kotlin {
explicitApi()
jvmToolchain(11)
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9)
languageVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9)
}
}
java {
withJavadocJar()
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
val publicationName = "${rootProject.name}-${project.name}"
publishing {
publications {
create<MavenPublication>(publicationName) {
groupId = project.group.toString()
artifactId = name
description = "Kotlin SDK for web5 functionality"
version = project.property("version").toString()
from(components["java"])
}
withType<MavenPublication> {
pom {
name = publicationName
packaging = "jar"
description.set("web5 kotlin SDK")
url.set("https://github.com/TBD54566975/web5-kt")
inceptionYear.set("2023")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("https://github.com/TBD54566975/web5-kt/blob/main/LICENSE")
}
}
developers {
developer {
id.set("TBD54566975")
name.set("Block Inc.")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:[email protected]:TBD54566975/web5-kt.git")
developerConnection.set("scm:git:ssh:[email protected]:TBD54566975/web5-kt.git")
url.set("https://github.com/TBD54566975/web5-kt")
}
}
}
}
if (!project.hasProperty("skipSigning") || project.property("skipSigning") != "true") {
signing {
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKey, signingPassword)
sign(publishing.publications[publicationName])
}
}
}
tasks.withType<DokkaTaskPartial>().configureEach {
dokkaSourceSets.configureEach {
documentedVisibilities.set(
setOf(
DokkaConfiguration.Visibility.PUBLIC,
DokkaConfiguration.Visibility.PROTECTED
)
)
includes.from("${projectDir}/module.md")
sourceLink {
val exampleDir = "https://github.com/TBD54566975/web5-kt/tree/main"
localDirectory.set(rootProject.projectDir)
remoteUrl.set(URL(exampleDir))
remoteLineSuffix.set("#L")
}
}
}
tasks.test {
useJUnitPlatform()
reports {
junitXml
}
testLogging {
events("passed", "skipped", "failed", "standardOut", "standardError")
exceptionFormat = TestExceptionFormat.FULL
showExceptions = true
showCauses = true
showStackTraces = true
}
}
}
// Configures only the parent MultiModule task,
// this will not affect subprojects
tasks.dokkaHtmlMultiModule {
moduleName.set("Web5 SDK Documentation")
}
publishing {
publications {
create<MavenPublication>("web5") {
groupId = project.group.toString()
artifactId = name
description = "Kotlin SDK for web5 functionality"
version = project.property("version").toString()
from(components["java"])
pom {
packaging = "jar"
name = project.name
description.set("web5 kotlin SDK")
url.set("https://github.com/TBD54566975/web5-kt")
inceptionYear.set("2023")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("https://github.com/TBD54566975/web5-kt/blob/main/LICENSE")
}
}
developers {
developer {
id.set("TBD54566975")
name.set("Block Inc.")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:[email protected]:TBD54566975/web5-kt.git")
developerConnection.set("scm:git:ssh:[email protected]:TBD54566975/web5-kt.git")
url.set("https://github.com/TBD54566975/web5-kt")
}
}
}
}
}
if (!project.hasProperty("skipSigning") || project.property("skipSigning") != "true") {
signing {
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKey, signingPassword)
sign(publishing.publications["web5"])
}
}
nexusPublishing {
repositories {
sonatype { //only for users registered in Sonatype after 24 Feb 2021
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}