Skip to content

Commit 7148906

Browse files
committed
Restore 'requireAllDefinedDependencies' behavior of previous release
Follow-up to #81
1 parent 60c1a7d commit 7148906

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/main/java/org/gradlex/javamodule/moduleinfo/ExtraJavaModuleInfoTransform.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -364,14 +364,16 @@ private byte[] addModuleInfo(ModuleInfo moduleInfo, Map<String, List<String>> pr
364364
allDependencies.addAll(runtimeDependencies);
365365
allDependencies.addAll(annotationProcessorDependencies);
366366
for (String ga : allDependencies) {
367-
String moduleName = gaToModuleName(ga);
368-
if (compileDependencies.contains(ga) && !runtimeDependencies.contains(ga)) {
369-
moduleVisitor.visitRequire(moduleName, Opcodes.ACC_STATIC_PHASE, null);
370-
} else {
367+
String depModuleName = gaToModuleName(ga);
368+
if (compileDependencies.contains(ga) && runtimeDependencies.contains(ga)) {
369+
moduleVisitor.visitRequire(depModuleName, Opcodes.ACC_TRANSITIVE, null);
370+
} else if (runtimeDependencies.contains(ga) || annotationProcessorDependencies.contains(ga)) {
371371
// We can currently not identify for sure if a 'requires' is NOT transitive.
372372
// For that, we would need the 'compile classpath' of the module we are looking at right now.
373373
// The 'compileDependencies' set is based only on the 'compile classpath' of the final consumer.
374-
moduleVisitor.visitRequire(moduleName, Opcodes.ACC_TRANSITIVE, null);
374+
moduleVisitor.visitRequire(depModuleName, 0, null);
375+
} else if (compileDependencies.contains(ga)) {
376+
moduleVisitor.visitRequire(depModuleName, Opcodes.ACC_STATIC_PHASE, null);
375377
}
376378
}
377379
}

0 commit comments

Comments
 (0)