Skip to content

Commit 955f036

Browse files
authored
Reduce diffs between buildfiles
1 parent ba804c6 commit 955f036

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed

build.gradle

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@ plugins {
55
id("com.gradleup.shadow").version("9.2.2")
66

77
// Code formatting; defines targets "spotlessApply" and "spotlessCheck"
8-
// Requires JDK 11 or higher; the plugin crashes under JDK 8.
8+
// Version 8.0.0 and later requires Java 17+.
99
id("com.diffplug.spotless").version("8.0.0")
1010

1111
// Error Prone linter
1212
id("net.ltgt.errorprone").version("4.3.0") apply false
1313

14+
// TODO: reinstate when all PMD warnings have been addressed.
15+
// // PMD linter
16+
// id("pmd")
17+
1418
// Checker Framework pluggable type-checking
1519
id("org.checkerframework").version("0.6.60")
1620
}
@@ -81,17 +85,27 @@ spotless {
8185

8286
// Error Prone linter
8387

88+
tasks.withType(JavaCompile).configureEach {
89+
options.forkOptions.jvmArgs += "-Xmx6g"
90+
options.compilerArgs << "-Werror"
91+
// "-processing" avoids javac warning "No processor claimed any of these annotations".
92+
// "-options" is because of JDK 21 warning "source value 8 is obsolete..."
93+
if (isJava21orHigher) {
94+
options.compilerArgs << "-Xlint:all,-processing,-options,-this-escape"
95+
} else {
96+
options.compilerArgs << "-Xlint:all,-processing,-options"
97+
}
98+
// // Only needed when debugging.
99+
// options.compilerArgs << "-g"
100+
}
84101
if (isJava21orHigher) {
85102
apply plugin: "net.ltgt.errorprone"
86103
dependencies {
87104
errorprone("com.google.errorprone:error_prone_core:${errorproneVersion}")
88105
}
89106
tasks.withType(JavaCompile).configureEach {
90-
// "-processing" avoids javac warning "No processor claimed any of these annotations".
91-
// "-options" avoids javac warning "source value 8 is obsolete and will be removed in a future release"; remove it when we no longer support Java 8.
92-
options.compilerArgs << "-Xlint:all,-processing,-options" << "-Werror"
93107
options.errorprone {
94-
disable("ExtendsObject") // Incorrect when using the Checker Framework
108+
disable("ExtendsObject") // Incorrect when using the Checker Framework.
95109
disable("ReferenceEquality") // Use Interning Checker instead.
96110
// disable("StringSplitter") // Obscure case isn't likely.
97111
disable("AnnotateFormatMethod") // Error Prone doesn't know about Checker Framework @FormatMethod.
@@ -100,6 +114,18 @@ if (isJava21orHigher) {
100114
}
101115
}
102116

117+
// TODO: reinstate when all PMD warnings have been addressed.
118+
// // PMD linter
119+
//
120+
// pmd {
121+
// toolVersion = "7.17.0"
122+
// ruleSetFiles =(files("${rootDir}/.pmd-ruleset.xml"))
123+
// consoleOutput = true
124+
// ignoreFailures = false
125+
// incrementalAnalysis = true
126+
// }
127+
128+
103129
// Checker Framework pluggable type-checking
104130

105131
apply plugin: "org.checkerframework"
@@ -121,6 +147,8 @@ checkerFramework {
121147
]
122148
extraJavacArgs = [
123149
"-Werror",
150+
"-Aversion",
151+
// "-verbose",
124152
"-AcheckPurityAnnotations",
125153
"-ArequirePrefixInWarningSuppressions",
126154
"-AwarnRedundantAnnotations",

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.gradle.jvmargs=-Xmx6g

0 commit comments

Comments
 (0)