dweiss commented on a change in pull request #470:
URL: https://github.com/apache/lucene/pull/470#discussion_r765805595



##########
File path: gradle/java/modules.gradle
##########
@@ -199,6 +200,67 @@ allprojects {
       }
     }
 
+    // Configure the test task.
+    tasks.matching { it.name == "test" }.all { Test task ->
+      Configuration modulePath = 
task.project.configurations.maybeCreate("moduleTestCompilePath")
+      task.dependsOn modulePath
+
+      SourceSet sourceSet = task.project.sourceSets.test
+
+      Predicate<SourceSet> hasModuleDescriptor = { SourceSet ss ->
+        ss.allJava.srcDirs.stream()
+            .map(dir -> new File(dir, "module-info.java"))
+            .anyMatch(file -> file.exists())
+      }
+
+      // Add modular dependencies and their transitive dependencies to module 
path.
+      task.jvmArgumentProviders.add(new CommandLineArgumentProvider() {
+        @Override
+        Iterable<String> asArguments() {
+          def extraArgs = []
+
+          // Determine whether the source set classes themselves should be 
appended to classpath
+          // or module path.
+          boolean sourceSetIsAModule = hasModuleDescriptor.test(sourceSet)
+
+          if (!modulePath.isEmpty() || sourceSetIsAModule) {
+            if (sourceSetIsAModule) {
+              // Add source set outputs to module path.
+              extraArgs += ["--module-path", (modulePath + 
sourceSet.output.classesDirs).files.join(File.pathSeparator) ]
+              // TODO: we should only initially add the sourceset's module? 
Everything else would be resolved via the

Review comment:
       Yeah, I think I'll leave it as is for now. If it's a pressing issue for 
some reason then it can be revisited. Thanks for confirming.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to