Skip to content

Commit 9605f96

Browse files
committed
Module provided by the JDK do not require a mapping
1 parent 5be6e6a commit 9605f96

File tree

2 files changed

+75
-1
lines changed

2 files changed

+75
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
package de.jjohannes.gradle.moduledependencies;
2+
3+
import java.util.Arrays;
4+
import java.util.List;
5+
6+
public interface JDKInfo {
7+
List<String> MODULES = Arrays.asList(
8+
"java.base",
9+
"java.compiler",
10+
"java.datatransfer",
11+
"java.desktop",
12+
"java.instrument",
13+
"java.logging",
14+
"java.management",
15+
"java.management.rmi",
16+
"java.naming",
17+
"java.net.http",
18+
"java.prefs",
19+
"java.rmi",
20+
"java.scripting",
21+
"java.se",
22+
"java.security.jgss",
23+
"java.security.sasl",
24+
"java.smartcardio",
25+
"java.sql",
26+
"java.sql.rowset",
27+
"java.transaction.xa",
28+
"java.xml",
29+
"java.xml.crypto",
30+
"jdk.accessibility",
31+
"jdk.attach",
32+
"jdk.charsets",
33+
"jdk.compiler",
34+
"jdk.crypto.cryptoki",
35+
"jdk.crypto.ec",
36+
"jdk.dynalink",
37+
"jdk.editpad",
38+
"jdk.hotspot.agent",
39+
"jdk.httpserver",
40+
"jdk.incubator.foreign",
41+
"jdk.incubator.vector",
42+
"jdk.jartool",
43+
"jdk.javadoc",
44+
"jdk.jcmd",
45+
"jdk.jconsole",
46+
"jdk.jdeps",
47+
"jdk.jdi",
48+
"jdk.jdwp.agent",
49+
"jdk.jfr",
50+
"jdk.jlink",
51+
"jdk.jpackage",
52+
"jdk.jshell",
53+
"jdk.jsobject",
54+
"jdk.jstatd",
55+
"jdk.localedata",
56+
"jdk.management",
57+
"jdk.management.agent",
58+
"jdk.management.jfr",
59+
"jdk.naming.dns",
60+
"jdk.naming.rmi",
61+
"jdk.net",
62+
"jdk.nio.mapmode",
63+
"jdk.sctp",
64+
"jdk.security.auth",
65+
"jdk.security.jgss",
66+
"jdk.xml.dom",
67+
"jdk.zipfs"
68+
);
69+
}

src/main/java/de/jjohannes/gradle/moduledependencies/JavaModuleDependenciesPlugin.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,12 @@ private void findAndReadModuleInfo(ModuleInfo.Directive moduleDirective, SourceS
8181
}
8282

8383
private void declareDependency(String moduleName, Project project, Configuration configuration, JavaModuleDependenciesExtension javaModuleDependenciesExtension) {
84-
String ownGroup = project.getGroup().toString();
84+
if (JDKInfo.MODULES.contains(moduleName)) {
85+
// The module is part of the JDK, no dependency required
86+
return;
87+
}
88+
89+
String ownModuleNamesPrefix = javaModuleDependenciesExtension.getOwnModuleNamesPrefix().forUseAtConfigurationTime().get();
8590
String ga = javaModuleDependenciesExtension.ga(moduleName);
8691
String projectName = moduleName.startsWith(ownModuleNamesPrefix + ".") ? moduleName.substring(ownModuleNamesPrefix.length() + 1) : null;
8792

0 commit comments

Comments
 (0)