< prev index next >

src/jdk.jpackage/share/classes/jdk/jpackage/internal/JLinkBundlerHelper.java

Print this page

        

*** 74,85 **** private JLinkBundlerHelper() {} @SuppressWarnings("unchecked") static final BundlerParamInfo<Integer> DEBUG = new StandardBundlerParam<>( - "", - "", "-J-Xdebug", Integer.class, p -> null, (s, p) -> { return Integer.valueOf(s); --- 74,83 ----
*** 188,199 **** 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; --- 186,195 ----
*** 204,266 **** mainJarType = ModFile.ModType.UnnamedJar; } // Modules String mainModule = getMainModule(params); if (mainJarType == ModFile.ModType.UnnamedJar) { // 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>()); 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); --- 200,238 ---- 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) { 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, new HashMap<String,String>()); imageBuilder.prepareApplicationFiles(); } // 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,416 **** } } 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 { // 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()); --- 378,388 ---- } } private static void runJLink(Path output, List<Path> modulePath, Set<String> modules, Set<String> limitModules, String excludes, ! 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,450 **** } if (excludes != null) { args.add("--exclude-files"); args.add(excludes); } ! if (strip) { ! args.add("--strip-native-commands"); ! } for (Map.Entry<String, String> entry : user.entrySet()) { args.add(entry.getKey()); args.add(entry.getValue()); } args.add("--strip-debug"); args.add("--no-header-files"); ! args.add("--bind-services"); StringWriter writer = new StringWriter(); PrintWriter pw = new PrintWriter(writer); Log.verbose("jlink arguments: " + args); --- 403,424 ---- } if (excludes != null) { args.add("--exclude-files"); args.add(excludes); } ! 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"); ! } StringWriter writer = new StringWriter(); PrintWriter pw = new PrintWriter(writer); Log.verbose("jlink arguments: " + args);
< prev index next >