-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.gradle.kts
203 lines (167 loc) · 6.38 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
import java.net.URL
plugins {
// Apply the Kotlin JVM plugin to add support for Kotlin.
id("org.jetbrains.kotlin.jvm") version "1.8.20"
id("io.gitlab.arturbosch.detekt") version "1.22.0"
id("org.jmailen.kotlinter") version "3.14.0"
id("jacoco")
id("com.github.ben-manes.versions") version "0.46.0"
id("org.jetbrains.dokka") version "1.8.10"
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
// Apply the java-library plugin for API and implementation separation.
`java-library`
// Publish build artifacts to an Apache Maven repository
`maven-publish`
// Sign artifacts
signing
}
java {
withJavadocJar()
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_11
}
allprojects {
group = "ch.veehait.devicecheck"
val baseVersion = "0.9.6"
// Add the "-SNAPSHOT" suffix if the CI wasn't triggered by a new release
version = when {
System.getenv("GITHUB_EVENT_NAME") != "release" -> "$baseVersion-SNAPSHOT"
else -> baseVersion
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
pom {
name.set(project.name)
description.set("Server-side library to validate the authenticity of Apple App Attest artifacts," +
" written in Kotlin")
url.set("https://github.com/veehaitch/devicecheck-appattest")
licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0")
}
}
developers {
developer {
id.set("veehaitch")
name.set("Vincent Haupert")
email.set("mail@vincent-haupert.de")
}
}
scm {
connection.set("scm:git:git@github.com:veehaitch/devicecheck-appattest.git")
developerConnection.set("scm:git:git@github.com:veehaitch/devicecheck-appattest.git")
url.set("https://github.com/veehaitch/devicecheck-appattest")
}
}
}
}
}
}
repositories {
mavenCentral()
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
// env: ORG_GRADLE_PROJECT_sonatypeUsername
val sonatypeUsername: String? by project
username.set(sonatypeUsername)
// env: ORG_GRADLE_PROJECT_sonatypePassword
val sonatypePassword: String? by project
password.set(sonatypePassword)
}
}
}
signing {
// Env: ORG_GRADLE_PROJECT_signingKeyId
val signingKeyId: String? by project
// Env: ORG_GRADLE_PROJECT_signingKey
// XXX: only the last 8 characters of the (sub)key ID!
val signingKey: String? by project
// Env: ORG_GRADLE_PROJECT_signingPassword
val signingPassword: String? by project
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
sign(publishing.publications["mavenJava"])
}
dependencies {
// Align versions of all Kotlin components
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
// Use the Kotlin JDK 8 standard library.
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
// Use the Kotlin test library.
testImplementation("org.jetbrains.kotlin:kotlin-test")
// Use the Kotlin JUnit integration.
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
// Kotlin coroutines
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
// CBOR
val jacksonVersion = "2.13.4"
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonVersion")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:$jacksonVersion")
testImplementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$jacksonVersion")
testImplementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jacksonVersion")
// Bouncy Castle
val bouncyCastleVersion = "1.73"
implementation("org.bouncycastle:bcpkix-jdk18on:$bouncyCastleVersion")
// Kotest
val kotestVersion = "5.4.2"
testImplementation("io.kotest:kotest-runner-junit5-jvm:$kotestVersion") // for kotest framework
testImplementation("io.kotest:kotest-assertions-core-jvm:$kotestVersion") // for kotest core jvm assertions
testImplementation("io.kotest:kotest-property-jvm:$kotestVersion") // for kotest property test
// Testing of equals / hashcode
testImplementation("nl.jqno.equalsverifier:equalsverifier:3.10.1")
// MockWebServer
testImplementation("com.squareup.okhttp3:mockwebserver:4.10.0")
// JWS issuing
testImplementation("com.nimbusds:nimbus-jose-jwt:9.25")
// Google Guava: Bytes.indexOf
testImplementation("com.google.guava:guava:31.1-jre")
}
dependencyLocking {
lockMode.set(LockMode.STRICT)
lockAllConfigurations()
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
jvmTarget = "11"
// For creation of default methods in interfaces
freeCompilerArgs = listOf("-Xjvm-default=all")
}
}
detekt {
autoCorrect = true
buildUponDefaultConfig = true
}
tasks.withType<Test> {
useJUnitPlatform()
}
tasks.test {
finalizedBy(tasks.jacocoTestReport) // report is always generated after tests run
}
jacoco {
toolVersion = "0.8.7"
}
tasks.jacocoTestReport {
dependsOn(tasks.test) // tests are required to run before generating the report
reports {
xml.required.set(true)
}
}
tasks.dokkaHtml.configure {
outputDirectory.set(buildDir.resolve("dokka"))
moduleName.set("Apple App Attest Kotlin Library")
dokkaSourceSets {
named("main") {
sourceLink {
localDirectory.set(file("src/main/kotlin"))
remoteUrl.set(URL("https://github.com/veehaitch/devicecheck-appattest/tree/main/src/main/kotlin"))
remoteLineSuffix.set("#L")
}
}
}
}