-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
186 lines (156 loc) · 5.06 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
import io.gitlab.arturbosch.detekt.extensions.DetektExtension.Companion.DEFAULT_SRC_DIR_KOTLIN
import org.gradle.api.JavaVersion.VERSION_1_8
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
buildscript {
extra["detektVersion"] = "1.23.7"
}
plugins {
val detektVersion: String by project
kotlin("jvm") version "1.9.24"
`java-library`
`maven-publish`
signing
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
id("pl.allegro.tech.build.axion-release") version "1.18.15"
// code analysis
id("io.gitlab.arturbosch.detekt") version detektVersion
// API compatibility
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.16.3"
// code coverage
jacoco
id("com.github.nbaztec.coveralls-jacoco") version "1.2.20"
}
group = "io.github.ulfs"
repositories {
mavenCentral()
// required for io.gitlab.arturbosch.detekt:detekt-report-html
maven { url = uri("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven") }
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = VERSION_1_8.toString()
}
}
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = VERSION_1_8.toString()
}
}
java {
sourceCompatibility = VERSION_1_8
targetCompatibility = VERSION_1_8
}
kotlin {
explicitApi()
}
java {
withSourcesJar()
withJavadocJar()
}
dependencies {
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.assertj:assertj-core:3.26.3")
implementation("org.jsoup:jsoup:1.15.3")
testImplementation("org.jetbrains.kotlin:kotlin-test")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
testImplementation("org.jetbrains.kotlin:kotlin-reflect")
testImplementation("io.mockk:mockk:1.13.10")
testImplementation("org.opentest4j:opentest4j:1.3.0")
val detektVersion: String by project
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:$detektVersion")
detektPlugins("io.gitlab.arturbosch.detekt:detekt-rules-libraries:$detektVersion")
}
publishing {
publications {
create<MavenPublication>(rootProject.name) {
from(components["java"])
pom {
name.set("$group:${rootProject.name}")
description.set("AssertJ assertions for HTML")
url.set("https://github.com/ulfsauer0815/assertj-jsoup")
licenses {
license {
name.set("MIT License")
url.set("https://github.com/ulfsauer0815/assertj-jsoup/blob/main/LICENSE")
}
}
developers {
developer {
name.set("Ulf Sauer")
url.set("https://github.com/ulfsauer0815")
}
}
scm {
connection.set("scm:git:git://github.com/ulfsauer0815/assertj-jsoup.git")
developerConnection.set("scm:git:ssh://github.com:ulfsauer0815/assertj-jsoup.git")
url.set("https://github.com/ulfsauer0815/assertj-jsoup")
}
}
}
}
}
signing {
isRequired = project.hasProperty("requiredSigning")
sign(publishing.publications[rootProject.name])
}
scmVersion {
localOnly.set(true)
with(tag) {
prefix.set("v")
}
}
// must be below scmVersion config!
version = scmVersion.version
nexusPublishing {
repositories {
create("sonatype") {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username.set(project.properties["sonatypeUsername"] as String?) // default
password.set(project.properties["sonatypePassword"] as String?) // default
}
}
}
detekt {
toolVersion = "1.23.6"
config.setFrom("$projectDir/config/detekt/detekt.yml")
source.setFrom(DEFAULT_SRC_DIR_KOTLIN)
buildUponDefaultConfig = true
baseline = file("$projectDir/config/detekt/baseline.xml")
}
tasks.withType<io.gitlab.arturbosch.detekt.Detekt> {
reports {
xml {
required.set(true)
outputLocation.set(file("$projectDir/build/test-results/detekt/detekt.xml"))
}
html {
required.set(true)
outputLocation.set(file("$projectDir/build/reports/detekt/detekt.html"))
}
txt {
required.set(true)
outputLocation.set(file("$projectDir/build/reports/detekt/detekt.txt"))
}
}
}
tasks {
named("check") {
// might be obsolete once detekt 2.x is released
dependsOn("detektMain")
}
named("coverallsJacoco") {
dependsOn("jacocoTestReport")
}
}
apiValidation {
validationDisabled = !hasProperty("checkApi")
}
tasks.withType<JacocoReport> {
reports {
xml.required.set(true)
html.required.set(true)
}
}