< prev index next >
src/jdk.jpackage/share/classes/jdk/jpackage/internal/JLinkBundlerHelper.java
Print this page
@@ -74,12 +74,10 @@
private JLinkBundlerHelper() {}
@SuppressWarnings("unchecked")
static final BundlerParamInfo<Integer> DEBUG =
new StandardBundlerParam<>(
- "",
- "",
"-J-Xdebug",
Integer.class,
p -> null,
(s, p) -> {
return Integer.valueOf(s);
@@ -188,12 +186,10 @@
StandardBundlerParam.MODULE_PATH.fetchFrom(params);
Set<String> addModules =
StandardBundlerParam.ADD_MODULES.fetchFrom(params);
Set<String> limitModules =
StandardBundlerParam.LIMIT_MODULES.fetchFrom(params);
- boolean stripNativeCommands =
- StandardBundlerParam.STRIP_NATIVE_COMMANDS.fetchFrom(params);
Path outputDir = imageBuilder.getRoot();
String excludeFileList = imageBuilder.getExcludeFileList();
File mainJar = getMainJar(params);
ModFile.ModType mainJarType = ModFile.ModType.Unknown;
@@ -204,63 +200,39 @@
mainJarType = ModFile.ModType.UnnamedJar;
}
// Modules
String mainModule = getMainModule(params);
+ if (mainModule == null) {
if (mainJarType == ModFile.ModType.UnnamedJar) {
+ if (addModules.isEmpty()) {
// The default for an unnamed jar is ALL_DEFAULT
addModules.add(ModuleHelper.ALL_DEFAULT);
+ }
} else if (mainJarType == ModFile.ModType.Unknown ||
mainJarType == ModFile.ModType.ModularJar) {
- if (mainModule == null) {
addModules.add(ModuleHelper.ALL_DEFAULT);
}
}
Set<String> validModules =
getValidModules(modulePath, addModules, limitModules);
+
if (mainModule != null) {
validModules.add(mainModule);
}
Log.verbose(MessageFormat.format(
I18N.getString("message.modules"), validModules.toString()));
runJLink(outputDir, modulePath, validModules, limitModules,
- excludeFileList, stripNativeCommands,
- new HashMap<String,String>());
+ excludeFileList, new HashMap<String,String>());
imageBuilder.prepareApplicationFiles();
}
- static void generateJre(Map<String, ? super Object> params,
- AbstractAppImageBuilder imageBuilder)
- throws IOException, Exception {
- List<Path> modulePath =
- StandardBundlerParam.MODULE_PATH.fetchFrom(params);
- Set<String> addModules =
- StandardBundlerParam.ADD_MODULES.fetchFrom(params);
- Set<String> limitModules =
- StandardBundlerParam.LIMIT_MODULES.fetchFrom(params);
- boolean stripNativeCommands =
- StandardBundlerParam.STRIP_NATIVE_COMMANDS.fetchFrom(params);
- Path outputDir = imageBuilder.getRoot();
- addModules.add(ModuleHelper.ALL_MODULE_PATH);
- Set<String> redistModules = getValidModules(modulePath,
- addModules, limitModules);
- addModules.addAll(redistModules);
-
- Log.verbose(MessageFormat.format(
- I18N.getString("message.modules"), addModules.toString()));
-
- runJLink(outputDir, modulePath, addModules, limitModules,
- null, stripNativeCommands, new HashMap<String,String>());
-
- imageBuilder.prepareJreFiles();
- }
-
// Returns the path to the JDK modules in the user defined module path.
static Path findPathOfModule( List<Path> modulePath, String moduleName) {
for (Path path : modulePath) {
Path moduleNamePath = path.resolve(moduleName);
@@ -406,11 +378,11 @@
}
}
private static void runJLink(Path output, List<Path> modulePath,
Set<String> modules, Set<String> limitModules, String excludes,
- boolean strip, HashMap<String, String> user) throws IOException {
+ HashMap<String, String> user) throws IOException {
// This is just to ensure jlink is given a non-existant directory
// The passed in output path should be non-existant or empty directory
IOUtils.deleteRecursive(output.toFile());
@@ -431,20 +403,22 @@
}
if (excludes != null) {
args.add("--exclude-files");
args.add(excludes);
}
- if (strip) {
- args.add("--strip-native-commands");
- }
+ if (user != null && !user.isEmpty()) {
for (Map.Entry<String, String> entry : user.entrySet()) {
args.add(entry.getKey());
args.add(entry.getValue());
}
+ } else {
+ args.add("--bind-services");
+ args.add("--strip-native-commands");
args.add("--strip-debug");
+ args.add("--no-man-pages");
args.add("--no-header-files");
- args.add("--bind-services");
+ }
StringWriter writer = new StringWriter();
PrintWriter pw = new PrintWriter(writer);
Log.verbose("jlink arguments: " + args);
< prev index next >