Skip to content

Apache Lucene open-source search software

Fix javac task inputs so that they include modular dependencies #12742 (#12745)

Dawid Weiss8400f89a9166
diff --git a/gradle/java/modules.gradle b/gradle/java/modules.gradle
index f9ebac3d345..cb8f7c8df34 100644
--- a/gradle/java/modules.gradle
+++ b/gradle/java/modules.gradle
@@ -67,6 +67,12 @@ allprojects {
tasks.named(sourceSet.getCompileJavaTaskName()).configure({ JavaCompile task ->
task.dependsOn modularPaths.compileModulePathConfiguration
+ // GH-12742: add the modular path as inputs so that if anything changes, the task
+ // is not up to date and is re-run. I [dw] believe this should be a @Classpath parameter
+ // on the task itself... but I don't know how to implement this on an existing class.
+ // this is a workaround but should work just fine though.
+ task.inputs.files(modularPaths.compileModulePathConfiguration)
+
// LUCENE-10327: don't allow gradle to emit an empty sourcepath as it would break
// compilation of modules.
task.options.setSourcepath(sourceSet.java.sourceDirectories)
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 6a92ae5c6e2..76293f6dbbd 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -278,7 +278,11 @@ Bug Fixes
Build
---------------------
+* GITHUB#12742: JavaCompile tasks may be in up-to-date state when modular dependencies have changed
+ leading to odd runtime errors (Chris Hostetter, Dawid Weiss)
+
* GITHUB#12612: Upgrade forbiddenapis to version 3.6 and ASM for APIJAR extraction to 9.6. (Uwe Schindler)
+
* GITHUB#12655: Upgrade to Gradle 8.4 (Kevin Risden)
Other