LUCENE-9650: errorprone plugin doesn't work on jdk16. A different workaround that keeps the dependency.

This commit is contained in:
Dawid Weiss 2021-03-15 10:19:27 +01:00
parent cdff0accaa
commit f8040c0ecf
1 changed files with 25 additions and 9 deletions

View File

@ -15,21 +15,37 @@
* limitations under the License. * limitations under the License.
*/ */
def includeErrorProne = rootProject.runtimeJavaVersion <= JavaVersion.VERSION_15; def skipErrorProne = rootProject.runtimeJavaVersion > JavaVersion.VERSION_15;
if (!includeErrorProne) { if (skipErrorProne) {
logger.warn("WARNING: errorprone disabled (won't work with JDK ${rootProject.runtimeJavaVersion})") configure(rootProject) {
task errorProneSkipped() {
doFirst {
logger.warn("WARNING: errorprone disabled (won't work with JDK ${rootProject.runtimeJavaVersion})")
}
}
}
} }
allprojects { prj -> allprojects { prj ->
plugins.withType(JavaPlugin) { plugins.withType(JavaPlugin) {
prj.apply plugin: 'net.ltgt.errorprone' // LUCENE-9650: Errorprone on master/gradle does not work with JDK-16+
// this is a hack to keep the dependency (so that palantir's version check doesn't complain)
// but don't include the plugin (which fails on JDK16+).
if (skipErrorProne) {
tasks.withType(JavaCompile) { task -> task.dependsOn ":errorProneSkipped" }
configurations {
errorprone
}
dependencies {
errorprone("com.google.errorprone:error_prone_core")
}
} else {
prj.apply plugin: 'net.ltgt.errorprone'
dependencies { dependencies {
errorprone("com.google.errorprone:error_prone_core") errorprone("com.google.errorprone:error_prone_core")
} }
// LUCENE-9650: Errorprone on master/gradle no longer works with JDK-16
if (includeErrorProne) {
tasks.withType(JavaCompile) { task -> tasks.withType(JavaCompile) { task ->
options.errorprone.disableWarningsInGeneratedCode = true options.errorprone.disableWarningsInGeneratedCode = true
options.errorprone.errorproneArgs = [ options.errorprone.errorproneArgs = [