-
-
Notifications
You must be signed in to change notification settings - Fork 704
/
build.gradle.kts
86 lines (73 loc) · 2.4 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
import net.ltgt.gradle.errorprone.errorprone
import org.zaproxy.gradle.spotless.ValidateImports
plugins {
id("com.diffplug.spotless")
id("org.zaproxy.common") version "0.3.0" apply false
id("com.github.ben-manes.versions") version "0.50.0"
id("org.sonarqube") version "4.3.0.3225"
id("net.ltgt.errorprone") version "3.1.0"
id("io.freefair.lombok") version "8.10.2"
}
apply(from = "$rootDir/gradle/ci.gradle.kts")
val validateImports =
ValidateImports(
mapOf(
"import org.apache.commons.lang." to
"Import/use classes from Commons Lang 3, instead of Lang 2.",
),
)
allprojects {
apply(plugin = "com.diffplug.spotless")
apply(plugin = "com.github.ben-manes.versions")
apply(plugin = "net.ltgt.errorprone")
apply(plugin = "io.freefair.lombok")
repositories {
mavenCentral()
}
spotless {
kotlinGradle {
ktlint()
}
project.plugins.withType(JavaPlugin::class) {
java {
bumpThisNumberIfACustomStepChanges(1)
custom("validateImports", validateImports)
}
}
}
project.plugins.withType(JavaPlugin::class) {
dependencies {
"errorprone"("com.google.errorprone:error_prone_core:2.26.1")
}
java {
val javaVersion = JavaVersion.VERSION_11
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
}
tasks.withType<JavaCompile>().configureEach {
if (JavaVersion.current().getMajorVersion() >= "21") {
options.compilerArgs = options.compilerArgs + "-Xlint:-this-escape"
}
options.errorprone {
disableAllChecks.set(true)
error(
"MissingOverride",
"WildcardImport",
)
}
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
}
}
sonarqube {
properties {
property("sonar.projectKey", "zaproxy_zap-extensions")
property("sonar.organization", "zaproxy")
property("sonar.host.url", "https://sonarcloud.io")
// Workaround https://sonarsource.atlassian.net/browse/SONARGRADL-126
property("sonar.exclusions", "**/*.gradle.kts")
}
}
fun Project.java(configure: JavaPluginExtension.() -> Unit): Unit = (this as ExtensionAware).extensions.configure("java", configure)