You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2021/03/15 09:19:37 UTC

[lucene] branch main updated: LUCENE-9650: errorprone plugin doesn't work on jdk16. A different workaround that keeps the dependency.

This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/main by this push:
     new f8040c0  LUCENE-9650: errorprone plugin doesn't work on jdk16. A different workaround that keeps the dependency.
f8040c0 is described below

commit f8040c0ecf1d074640aeae3e9a75b96cc8e2062d
Author: Dawid Weiss <da...@carrotsearch.com>
AuthorDate: Mon Mar 15 10:19:27 2021 +0100

    LUCENE-9650: errorprone plugin doesn't work on jdk16. A different workaround that keeps the dependency.
---
 gradle/validation/error-prone.gradle | 34 +++++++++++++++++++++++++---------
 1 file changed, 25 insertions(+), 9 deletions(-)

diff --git a/gradle/validation/error-prone.gradle b/gradle/validation/error-prone.gradle
index edcbaed..3ed0bf3 100644
--- a/gradle/validation/error-prone.gradle
+++ b/gradle/validation/error-prone.gradle
@@ -15,21 +15,37 @@
  * limitations under the License.
  */
 
-def includeErrorProne = rootProject.runtimeJavaVersion <= JavaVersion.VERSION_15;
-if (!includeErrorProne) {
-  logger.warn("WARNING: errorprone disabled (won't work with JDK ${rootProject.runtimeJavaVersion})")
+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) {
-    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 {
-      errorprone("com.google.errorprone:error_prone_core")
-    }
+      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 = [