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.
*/
def includeErrorProne = rootProject.runtimeJavaVersion <= JavaVersion.VERSION_15;
if (!includeErrorProne) {
def skipErrorProne = rootProject.runtimeJavaVersion > JavaVersion.VERSION_15;
if (skipErrorProne) {
configure(rootProject) {
task errorProneSkipped() {
doFirst {
logger.warn("WARNING: errorprone disabled (won't work with JDK ${rootProject.runtimeJavaVersion})")
}
}
}
}
allprojects { prj ->
plugins.withType(JavaPlugin) {
// 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 {
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 ->
options.errorprone.disableWarningsInGeneratedCode = true
options.errorprone.errorproneArgs = [