11import buildlogic.stringyLibs
22import buildlogic.getLibrary
3- import net.ltgt.gradle.errorprone.errorprone
43
54plugins {
65 id(" eclipse" )
76 id(" idea" )
87 id(" checkstyle" )
9- id(" net.ltgt.errorprone " )
8+ id(" org.enginehub.crankcase.java " )
109 id(" buildlogic.common" )
1110}
1211
13- tasks
14- .withType<JavaCompile >()
15- .matching { it.name == " compileJava" || it.name == " compileTestJava" }
16- .configureEach {
17- val disabledLint = listOf (
18- " processing" , " path" , " fallthrough" , " serial" , " overloads" , " this-escape" ,
19- )
20- options.release.set(21 )
21- options.compilerArgs.addAll(listOf (" -Xlint:all" ) + disabledLint.map { " -Xlint:-$it " })
22- options.isDeprecation = true
23- options.encoding = " UTF-8"
24- options.compilerArgs.add(" -parameters" )
25- if (project.name.contains(" -core" )) {
26- options.compilerArgs.add(" -Werror" )
27- }
28- options.errorprone {
29- // We use -Werror, so we don't need errorprone to fail the build separately
30- allErrorsAsWarnings = true
31- // Obviously we don't need to fix generated code
32- disableWarningsInGeneratedCode = true
33- // We use reference equality intentionally in several places
34- // Perhaps we should consider testing the performance impact of using .equals() instead?
35- // Especially for the types that are only compared by reference equality, we could consider
36- // removing their .equals() implementations to avoid confusion.
37- disable(" ReferenceEquality" )
38- // We're on JDK 21, so System.console() can still be null
39- disable(" SystemConsoleNull" )
40- }
41- }
12+ crankcaseJava {
13+ javaRelease = 21
14+ disabledLints = listOf (" processing" , " path" , " fallthrough" , " serial" , " overloads" , " this-escape" )
15+ disabledErrorprone = listOf (
16+ // We use reference equality intentionally in several places
17+ " ReferenceEquality" ,
18+ // We're on JDK 21, so System.console() can still be null
19+ " SystemConsoleNull" ,
20+ )
21+ failOnWarnings = project.name.contains(" -core" )
22+ }
4223
4324configure<CheckstyleExtension > {
4425 configFile = rootProject.file(" config/checkstyle/checkstyle.xml" )
@@ -53,38 +34,9 @@ tasks.withType<Test>().configureEach {
5334
5435dependencies {
5536 " compileOnly" (stringyLibs.getLibrary(" jspecify" ))
56- " compileOnly" (stringyLibs.getLibrary(" errorprone-annotations" ))
57- " errorprone" (stringyLibs.getLibrary(" errorprone-core" ))
58- " testImplementation" (platform(stringyLibs.getLibrary(" junit-bom" )))
59- " testImplementation" (stringyLibs.getLibrary(" junit-jupiter-api" ))
60- " testImplementation" (stringyLibs.getLibrary(" junit-jupiter-params" ))
6137 " testImplementation" (platform(stringyLibs.getLibrary(" mockito-bom" )))
6238 " testImplementation" (stringyLibs.getLibrary(" mockito-core" ))
6339 " testImplementation" (stringyLibs.getLibrary(" mockito-junit-jupiter" ))
64- " testRuntimeOnly" (stringyLibs.getLibrary(" junit-jupiter-engine" ))
65- " testRuntimeOnly" (stringyLibs.getLibrary(" junit-platform-launcher" ))
66- }
67-
68- // Java 8 turns on doclint which we fail
69- tasks.withType<Javadoc >().configureEach {
70- options.encoding = " UTF-8"
71- (options as StandardJavadocDocletOptions ).apply {
72- if (project.name.contains(" -core" )) {
73- addBooleanOption(" Werror" , true )
74- }
75- addBooleanOption(" Xdoclint:all" , true )
76- addBooleanOption(" Xdoclint:-missing" , true )
77- tags(
78- " apiNote:a:API Note:" ,
79- " implSpec:a:Implementation Requirements:" ,
80- " implNote:a:Implementation Note:"
81- )
82- }
83- }
84-
85- configure<JavaPluginExtension > {
86- withJavadocJar()
87- withSourcesJar()
8840}
8941
9042tasks.named(" check" ).configure {
0 commit comments