Skip to content

Commit e039057

Browse files
committed
Default behavior for module(id, name) notation
To make this notation useful at all, it now defaults to 'exportAllPackages' and 'requireAllDefinedDependencies'.
1 parent e32a161 commit e039057

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public abstract class ExtraJavaModuleInfoPluginExtension {
4949
* @param moduleName the Module Name of the Module to construct
5050
*/
5151
public void module(String identifier, String moduleName) {
52-
module(identifier, moduleName, null, null);
52+
module(identifier, moduleName, (String) null);
5353
}
5454

5555
/**
@@ -70,7 +70,12 @@ public void module(Provider<MinimalExternalModuleDependency> alias, String modul
7070
* @param moduleVersion version to write into the module-info.class
7171
*/
7272
public void module(String identifier, String moduleName, String moduleVersion) {
73-
module(identifier, moduleName, moduleVersion, null);
73+
module(identifier, moduleName, moduleVersion, m -> {
74+
m.exportAllPackages();
75+
if (identifier.contains(":")) { // only if the identifier is a coordinates (not a Jar)
76+
m.requireAllDefinedDependencies();
77+
}
78+
});
7479
}
7580

7681
/**

0 commit comments

Comments
 (0)