--- old/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxAppBundler.java 2019-06-04 11:08:40.137521100 -0400 +++ new/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxAppBundler.java 2019-06-04 11:08:36.143818700 -0400 @@ -85,14 +85,14 @@ ); @Override - public boolean validate(Map p) + public boolean validate(Map params) throws UnsupportedPlatformException, ConfigException { try { - if (p == null) throw new ConfigException( + if (params == null) throw new ConfigException( I18N.getString("error.parameters-null"), I18N.getString("error.parameters-null.advice")); - return doValidate(p); + return doValidate(params); } catch (RuntimeException re) { if (re.getCause() instanceof ConfigException) { throw (ConfigException) re.getCause(); @@ -102,47 +102,48 @@ } } - private boolean doValidate(Map p) + private boolean doValidate(Map params) throws UnsupportedPlatformException, ConfigException { if (Platform.getPlatform() != Platform.LINUX) { throw new UnsupportedPlatformException(); } - imageBundleValidation(p); + imageBundleValidation(params); return true; } // it is static for the sake of sharing with "installer" bundlers // that may skip calls to validate/bundle in this class! - static File getRootDir(File outDir, Map p) { - return new File(outDir, APP_NAME.fetchFrom(p)); + static File getRootDir(File outDir, Map params) { + return new File(outDir, APP_NAME.fetchFrom(params)); } - static String getLauncherCfgName(Map p) { - return "app/" + APP_NAME.fetchFrom(p) +".cfg"; + static String getLauncherCfgName(Map params) { + return "app/" + APP_NAME.fetchFrom(params) +".cfg"; } - File doBundle(Map p, File outputDirectory, + File doBundle(Map params, File outputDirectory, boolean dependentTask) throws PackagerException { - if (StandardBundlerParam.isRuntimeInstaller(p)) { - return PREDEFINED_RUNTIME_IMAGE.fetchFrom(p); + if (StandardBundlerParam.isRuntimeInstaller(params)) { + return PREDEFINED_RUNTIME_IMAGE.fetchFrom(params); } else { - return doAppBundle(p, outputDirectory, dependentTask); + return doAppBundle(params, outputDirectory, dependentTask); } } - private File doAppBundle(Map p, + private File doAppBundle(Map params, File outputDirectory, boolean dependentTask) throws PackagerException { try { - File rootDirectory = createRoot(p, outputDirectory, dependentTask, - APP_NAME.fetchFrom(p)); - AbstractAppImageBuilder appBuilder = new LinuxAppImageBuilder(p, - outputDirectory.toPath()); - if (PREDEFINED_RUNTIME_IMAGE.fetchFrom(p) == null ) { - JLinkBundlerHelper.execute(p, appBuilder); + File rootDirectory = createRoot(params, outputDirectory, + dependentTask, APP_NAME.fetchFrom(params)); + AbstractAppImageBuilder appBuilder = new LinuxAppImageBuilder( + params, outputDirectory.toPath()); + if (PREDEFINED_RUNTIME_IMAGE.fetchFrom(params) == null ) { + JLinkBundlerHelper.execute(params, appBuilder); } else { - StandardBundlerParam.copyPredefinedRuntimeImage(p, appBuilder); + StandardBundlerParam.copyPredefinedRuntimeImage( + params, appBuilder); } return rootDirectory; } catch (PackagerException pe) { --- old/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxAppImageBuilder.java 2019-06-04 11:09:08.907659000 -0400 +++ new/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxAppImageBuilder.java 2019-06-04 11:09:07.332018600 -0400 @@ -146,16 +146,18 @@ // it is static for the sake of sharing with "installer" bundlers // that may skip calls to validate/bundle in this class! - public static File getRootDir(File outDir, Map p) { - return new File(outDir, APP_NAME.fetchFrom(p)); + public static File getRootDir(File outDir, + Map params) { + return new File(outDir, APP_NAME.fetchFrom(params)); } - public static String getLauncherName(Map p) { - return APP_NAME.fetchFrom(p); + public static String getLauncherName(Map params) { + return APP_NAME.fetchFrom(params); } - public static String getLauncherCfgName(Map p) { - return "app/" + APP_NAME.fetchFrom(p) + ".cfg"; + public static String getLauncherCfgName( + Map params) { + return "app/" + APP_NAME.fetchFrom(params) + ".cfg"; } @Override @@ -198,10 +200,10 @@ @Override public void prepareJreFiles() throws IOException {} - private void createLauncherForEntryPoint(Map p) - throws IOException { + private void createLauncherForEntryPoint( + Map params) throws IOException { // Copy executable to Linux folder - Path executableFile = root.resolve(getLauncherName(p)); + Path executableFile = root.resolve(getLauncherName(params)); try (InputStream is_launcher = getResourceAsStream("jpackageapplauncher")) { writeEntry(is_launcher, executableFile); @@ -210,7 +212,7 @@ executableFile.toFile().setExecutable(true, false); executableFile.toFile().setWritable(true, true); - writeCfgFile(p, root.resolve(getLauncherCfgName(p)).toFile(), + writeCfgFile(params, root.resolve(getLauncherCfgName(params)).toFile(), "$APPDIR/runtime"); } --- old/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebBundler.java 2019-06-04 11:09:32.947875400 -0400 +++ new/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebBundler.java 2019-06-04 11:09:29.453385800 -0400 @@ -218,16 +218,16 @@ } @Override - public boolean validate(Map p) + public boolean validate(Map params) throws UnsupportedPlatformException, ConfigException { try { - if (p == null) throw new ConfigException( + if (params == null) throw new ConfigException( I18N.getString("error.parameters-null"), I18N.getString("error.parameters-null.advice")); //run basic validation to ensure requirements are met //we are not interested in return code, only possible exception - APP_BUNDLER.fetchFrom(p).validate(p); + APP_BUNDLER.fetchFrom(params).validate(params); // NOTE: Can we validate that the required tools are available // before we start? @@ -239,14 +239,14 @@ // Show warning is license file is missing - String licenseFile = LICENSE_FILE.fetchFrom(p); + String licenseFile = LICENSE_FILE.fetchFrom(params); if (licenseFile == null) { Log.verbose(I18N.getString("message.debs-like-licenses")); } // only one mime type per association, at least one file extention List> associations = - FILE_ASSOCIATIONS.fetchFrom(p); + FILE_ASSOCIATIONS.fetchFrom(params); if (associations != null) { for (int i = 0; i < associations.size(); i++) { Map assoc = associations.get(i); @@ -270,7 +270,8 @@ // bundle name has some restrictions // the string converter will throw an exception if invalid - BUNDLE_NAME.getStringConverter().apply(BUNDLE_NAME.fetchFrom(p), p); + BUNDLE_NAME.getStringConverter().apply( + BUNDLE_NAME.fetchFrom(params), params); return true; } catch (RuntimeException re) { @@ -282,26 +283,26 @@ } } - private boolean prepareProto(Map p) + private boolean prepareProto(Map params) throws PackagerException, IOException { - File appImage = StandardBundlerParam.getPredefinedAppImage(p); + File appImage = StandardBundlerParam.getPredefinedAppImage(params); File appDir = null; // we either have an application image or need to build one if (appImage != null) { - appDir = new File(APP_IMAGE_ROOT.fetchFrom(p), - APP_NAME.fetchFrom(p)); + appDir = new File(APP_IMAGE_ROOT.fetchFrom(params), + APP_NAME.fetchFrom(params)); // copy everything from appImage dir into appDir/name IOUtils.copyRecursive(appImage.toPath(), appDir.toPath()); } else { - appDir = APP_BUNDLER.fetchFrom(p).doBundle(p, - APP_IMAGE_ROOT.fetchFrom(p), true); + appDir = APP_BUNDLER.fetchFrom(params).doBundle(params, + APP_IMAGE_ROOT.fetchFrom(params), true); } return appDir != null; } //@Override - public File bundle(Map p, + public File bundle(Map params, File outdir) throws PackagerException { if (!outdir.isDirectory() && !outdir.mkdirs()) { throw new PackagerException ("error.cannot-create-output-dir", @@ -324,15 +325,15 @@ // app // runtime - File imageDir = DEB_IMAGE_DIR.fetchFrom(p); - File configDir = CONFIG_DIR.fetchFrom(p); + File imageDir = DEB_IMAGE_DIR.fetchFrom(params); + File configDir = CONFIG_DIR.fetchFrom(params); try { imageDir.mkdirs(); configDir.mkdirs(); - if (prepareProto(p) && prepareProjectConfig(p)) { - return buildDeb(p, outdir); + if (prepareProto(params) && prepareProjectConfig(params)) { + return buildDeb(params, outdir); } return null; } catch (IOException ex) { --- old/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxRpmBundler.java 2019-06-04 11:09:57.315101300 -0400 +++ new/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxRpmBundler.java 2019-06-04 11:09:55.255848500 -0400 @@ -173,16 +173,16 @@ } @Override - public boolean validate(Map p) + public boolean validate(Map params) throws UnsupportedPlatformException, ConfigException { try { - if (p == null) throw new ConfigException( + if (params == null) throw new ConfigException( I18N.getString("error.parameters-null"), I18N.getString("error.parameters-null.advice")); // run basic validation to ensure requirements are met // we are not interested in return code, only possible exception - APP_BUNDLER.fetchFrom(p).validate(p); + APP_BUNDLER.fetchFrom(params).validate(params); // validate presense of required tools if (!testTool(TOOL_RPMBUILD, TOOL_RPMBUILD_MIN_VERSION)){ @@ -197,7 +197,7 @@ // only one mime type per association, at least one file extension List> associations = - FILE_ASSOCIATIONS.fetchFrom(p); + FILE_ASSOCIATIONS.fetchFrom(params); if (associations != null) { for (int i = 0; i < associations.size(); i++) { Map assoc = associations.get(i); @@ -220,7 +220,8 @@ // bundle name has some restrictions // the string converter will throw an exception if invalid - BUNDLE_NAME.getStringConverter().apply(BUNDLE_NAME.fetchFrom(p), p); + BUNDLE_NAME.getStringConverter().apply( + BUNDLE_NAME.fetchFrom(params), params); return true; } catch (RuntimeException re) { @@ -232,25 +233,25 @@ } } - private boolean prepareProto(Map p) + private boolean prepareProto(Map params) throws PackagerException, IOException { - File appImage = StandardBundlerParam.getPredefinedAppImage(p); + File appImage = StandardBundlerParam.getPredefinedAppImage(params); File appDir = null; // we either have an application image or need to build one if (appImage != null) { - appDir = new File(RPM_IMAGE_DIR.fetchFrom(p), - APP_NAME.fetchFrom(p)); + appDir = new File(RPM_IMAGE_DIR.fetchFrom(params), + APP_NAME.fetchFrom(params)); // copy everything from appImage dir into appDir/name IOUtils.copyRecursive(appImage.toPath(), appDir.toPath()); } else { - appDir = APP_BUNDLER.fetchFrom(p).doBundle(p, - RPM_IMAGE_DIR.fetchFrom(p), true); + appDir = APP_BUNDLER.fetchFrom(params).doBundle(params, + RPM_IMAGE_DIR.fetchFrom(params), true); } return appDir != null; } - public File bundle(Map p, + public File bundle(Map params, File outdir) throws PackagerException { if (!outdir.isDirectory() && !outdir.mkdirs()) { throw new PackagerException( @@ -263,13 +264,13 @@ outdir.getAbsolutePath()); } - File imageDir = RPM_IMAGE_DIR.fetchFrom(p); + File imageDir = RPM_IMAGE_DIR.fetchFrom(params); try { imageDir.mkdirs(); - if (prepareProto(p) && prepareProjectConfig(p)) { - return buildRPM(p, outdir); + if (prepareProto(params) && prepareProjectConfig(params)) { + return buildRPM(params, outdir); } return null; } catch (IOException ex) { --- old/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppBundler.java 2019-06-04 11:10:16.740599600 -0400 +++ new/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppBundler.java 2019-06-04 11:10:15.196160000 -0400 @@ -252,20 +252,20 @@ } } - private boolean doValidate(Map p) + private boolean doValidate(Map params) throws UnsupportedPlatformException, ConfigException { if (Platform.getPlatform() != Platform.MAC) { throw new UnsupportedPlatformException(); } - imageBundleValidation(p); + imageBundleValidation(params); - if (StandardBundlerParam.getPredefinedAppImage(p) != null) { + if (StandardBundlerParam.getPredefinedAppImage(params) != null) { return true; } // validate short version - if (!validCFBundleVersion(MAC_CF_BUNDLE_VERSION.fetchFrom(p))) { + if (!validCFBundleVersion(MAC_CF_BUNDLE_VERSION.fetchFrom(params))) { throw new ConfigException( I18N.getString("error.invalid-cfbundle-version"), I18N.getString("error.invalid-cfbundle-version.advice")); @@ -273,8 +273,9 @@ // reject explicitly set sign to true and no valid signature key if (Optional.ofNullable(MacAppImageBuilder. - SIGN_BUNDLE.fetchFrom(p)).orElse(Boolean.FALSE)) { - String signingIdentity = DEVELOPER_ID_APP_SIGNING_KEY.fetchFrom(p); + SIGN_BUNDLE.fetchFrom(params)).orElse(Boolean.FALSE)) { + String signingIdentity = + DEVELOPER_ID_APP_SIGNING_KEY.fetchFrom(params); if (signingIdentity == null) { throw new ConfigException( I18N.getString("error.explicit-sign-no-cert"), @@ -285,26 +286,27 @@ return true; } - File doBundle(Map p, File outputDirectory, + File doBundle(Map params, File outputDirectory, boolean dependentTask) throws PackagerException { - if (StandardBundlerParam.isRuntimeInstaller(p)) { - return PREDEFINED_RUNTIME_IMAGE.fetchFrom(p); + if (StandardBundlerParam.isRuntimeInstaller(params)) { + return PREDEFINED_RUNTIME_IMAGE.fetchFrom(params); } else { - return doAppBundle(p, outputDirectory, dependentTask); + return doAppBundle(params, outputDirectory, dependentTask); } } - File doAppBundle(Map p, File outputDirectory, + File doAppBundle(Map params, File outputDirectory, boolean dependentTask) throws PackagerException { try { - File rootDirectory = createRoot(p, outputDirectory, dependentTask, - APP_NAME.fetchFrom(p) + ".app"); + File rootDirectory = createRoot(params, outputDirectory, + dependentTask, APP_NAME.fetchFrom(params) + ".app"); AbstractAppImageBuilder appBuilder = - new MacAppImageBuilder(p, outputDirectory.toPath()); - if (PREDEFINED_RUNTIME_IMAGE.fetchFrom(p) == null ) { - JLinkBundlerHelper.execute(p, appBuilder); + new MacAppImageBuilder(params, outputDirectory.toPath()); + if (PREDEFINED_RUNTIME_IMAGE.fetchFrom(params) == null ) { + JLinkBundlerHelper.execute(params, appBuilder); } else { - StandardBundlerParam.copyPredefinedRuntimeImage(p, appBuilder); + StandardBundlerParam.copyPredefinedRuntimeImage( + params, appBuilder); } return rootDirectory; } catch (PackagerException pe) { --- old/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java 2019-06-04 11:10:36.687911800 -0400 +++ new/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java 2019-06-04 11:10:34.956267400 -0400 @@ -424,8 +424,9 @@ } } - public static String getLauncherCfgName(Map p) { - return "Contents/Java/" + APP_NAME.fetchFrom(p) + ".cfg"; + public static String getLauncherCfgName( + Map params) { + return "Contents/Java/" + APP_NAME.fetchFrom(params) + ".cfg"; } private void copyClassPathEntries(Path javaDirectory) throws IOException { --- old/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppStoreBundler.java 2019-06-04 11:10:58.760878800 -0400 +++ new/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppStoreBundler.java 2019-06-04 11:10:57.076035600 -0400 @@ -118,10 +118,10 @@ (s, p) -> s); //@Override - public File bundle(Map p, + public File bundle(Map params, File outdir) throws PackagerException { Log.verbose(MessageFormat.format(I18N.getString( - "message.building-bundle"), APP_NAME.fetchFrom(p))); + "message.building-bundle"), APP_NAME.fetchFrom(params))); if (!outdir.isDirectory() && !outdir.mkdirs()) { throw new PackagerException( "error.cannot-create-output-dir", @@ -135,45 +135,48 @@ // first, load in some overrides // icns needs @2 versions, so load in the @2 default - p.put(DEFAULT_ICNS_ICON.getID(), TEMPLATE_BUNDLE_ICON_HIDPI); + params.put(DEFAULT_ICNS_ICON.getID(), TEMPLATE_BUNDLE_ICON_HIDPI); // now we create the app - File appImageDir = APP_IMAGE_TEMP_ROOT.fetchFrom(p); + File appImageDir = APP_IMAGE_TEMP_ROOT.fetchFrom(params); try { appImageDir.mkdirs(); try { - MacAppImageBuilder.addNewKeychain(p); + MacAppImageBuilder.addNewKeychain(params); } catch (InterruptedException e) { Log.error(e.getMessage()); } // first, make sure we don't use the local signing key - p.put(DEVELOPER_ID_APP_SIGNING_KEY.getID(), null); - File appLocation = prepareAppBundle(p, false); + params.put(DEVELOPER_ID_APP_SIGNING_KEY.getID(), null); + File appLocation = prepareAppBundle(params, false); - prepareEntitlements(p); + prepareEntitlements(params); - String signingIdentity = MAC_APP_STORE_APP_SIGNING_KEY.fetchFrom(p); - String identifierPrefix = BUNDLE_ID_SIGNING_PREFIX.fetchFrom(p); - String entitlementsFile = getConfig_Entitlements(p).toString(); + String signingIdentity = + MAC_APP_STORE_APP_SIGNING_KEY.fetchFrom(params); + String identifierPrefix = + BUNDLE_ID_SIGNING_PREFIX.fetchFrom(params); + String entitlementsFile = + getConfig_Entitlements(params).toString(); String inheritEntitlements = - getConfig_Inherit_Entitlements(p).toString(); + getConfig_Inherit_Entitlements(params).toString(); - MacAppImageBuilder.signAppBundle(p, appLocation.toPath(), + MacAppImageBuilder.signAppBundle(params, appLocation.toPath(), signingIdentity, identifierPrefix, entitlementsFile, inheritEntitlements); - MacAppImageBuilder.restoreKeychainList(p); + MacAppImageBuilder.restoreKeychainList(params); ProcessBuilder pb; // create the final pkg file - File finalPKG = new File(outdir, INSTALLER_NAME.fetchFrom(p) - + INSTALLER_SUFFIX.fetchFrom(p) + File finalPKG = new File(outdir, INSTALLER_NAME.fetchFrom(params) + + INSTALLER_SUFFIX.fetchFrom(params) + ".pkg"); outdir.mkdirs(); String installIdentify = - MAC_APP_STORE_PKG_SIGNING_KEY.fetchFrom(p); + MAC_APP_STORE_PKG_SIGNING_KEY.fetchFrom(params); List buildOptions = new ArrayList<>(); buildOptions.add("productbuild"); @@ -184,7 +187,7 @@ buildOptions.add(installIdentify); buildOptions.add("--product"); buildOptions.add(appLocation + "/Contents/Info.plist"); - String keychainName = SIGNING_KEYCHAIN.fetchFrom(p); + String keychainName = SIGNING_KEYCHAIN.fetchFrom(params); if (keychainName != null && !keychainName.isEmpty()) { buildOptions.add("--keychain"); buildOptions.add(keychainName); --- old/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBaseInstallerBundler.java 2019-06-04 11:11:25.193957000 -0400 +++ new/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBaseInstallerBundler.java 2019-06-04 11:11:22.570089500 -0400 @@ -135,18 +135,20 @@ } } - protected File prepareAppBundle(Map p, + protected File prepareAppBundle(Map params, boolean pkg) throws PackagerException { - File predefinedImage = StandardBundlerParam.getPredefinedAppImage(p); + File predefinedImage = + StandardBundlerParam.getPredefinedAppImage(params); if (predefinedImage != null) { return predefinedImage; } - File appImageRoot = APP_IMAGE_TEMP_ROOT.fetchFrom(p); + File appImageRoot = APP_IMAGE_TEMP_ROOT.fetchFrom(params); if (pkg) { // create pkg in dmg - return new MacPkgBundler().bundle(p, appImageRoot); + return new MacPkgBundler().bundle(params, appImageRoot); } else { - return APP_BUNDLER.fetchFrom(p).doBundle(p, appImageRoot, true); + return APP_BUNDLER.fetchFrom(params).doBundle( + params, appImageRoot, true); } } --- old/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgBundler.java 2019-06-04 11:12:19.110939600 -0400 +++ new/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgBundler.java 2019-06-04 11:12:16.614875600 -0400 @@ -91,8 +91,8 @@ private static final String hdiutil = "/usr/bin/hdiutil"; private void prepareDMGSetupScript(String volumeName, - Map p) throws IOException { - File dmgSetup = getConfig_VolumeScript(p); + Map params) throws IOException { + File dmgSetup = getConfig_VolumeScript(params); Log.verbose(MessageFormat.format( I18N.getString("message.preparing-dmg-setup"), dmgSetup.getAbsolutePath())); @@ -100,7 +100,7 @@ //prepare config for exe Map data = new HashMap<>(); data.put("DEPLOY_ACTUAL_VOLUME_NAME", volumeName); - data.put("DEPLOY_APPLICATION_NAME", APP_NAME.fetchFrom(p)); + data.put("DEPLOY_APPLICATION_NAME", APP_NAME.fetchFrom(params)); data.put("DEPLOY_INSTALL_LOCATION", "(path to desktop folder)"); data.put("DEPLOY_INSTALL_NAME", "Desktop"); @@ -108,8 +108,8 @@ try (Writer w = new BufferedWriter(new FileWriter(dmgSetup))) { w.write(preprocessTextResource(dmgSetup.getName(), I18N.getString("resource.dmg-setup-script"), - DEFAULT_DMG_SETUP_SCRIPT, data, VERBOSE.fetchFrom(p), - RESOURCE_DIR.fetchFrom(p))); + DEFAULT_DMG_SETUP_SCRIPT, data, VERBOSE.fetchFrom(params), + RESOURCE_DIR.fetchFrom(params))); } } @@ -250,18 +250,19 @@ } private File buildDMG( - Map p, File outdir) + Map params, File outdir) throws IOException { - File imagesRoot = IMAGES_ROOT.fetchFrom(p); + File imagesRoot = IMAGES_ROOT.fetchFrom(params); if (!imagesRoot.exists()) imagesRoot.mkdirs(); - File protoDMG = new File(imagesRoot, APP_NAME.fetchFrom(p) +"-tmp.dmg"); - File finalDMG = new File(outdir, INSTALLER_NAME.fetchFrom(p) - + INSTALLER_SUFFIX.fetchFrom(p) - + ".dmg"); - - File srcFolder = APP_IMAGE_TEMP_ROOT.fetchFrom(p); - File predefinedImage = StandardBundlerParam.getPredefinedAppImage(p); + File protoDMG = new File(imagesRoot, + APP_NAME.fetchFrom(params) +"-tmp.dmg"); + File finalDMG = new File(outdir, INSTALLER_NAME.fetchFrom(params) + + INSTALLER_SUFFIX.fetchFrom(params) + ".dmg"); + + File srcFolder = APP_IMAGE_TEMP_ROOT.fetchFrom(params); + File predefinedImage = + StandardBundlerParam.getPredefinedAppImage(params); if (predefinedImage != null) { srcFolder = predefinedImage; } @@ -287,7 +288,7 @@ "create", hdiUtilVerbosityFlag, "-srcfolder", srcFolder.getAbsolutePath(), - "-volname", APP_NAME.fetchFrom(p), + "-volname", APP_NAME.fetchFrom(params), "-ov", protoDMG.getAbsolutePath(), "-fs", "HFS+", "-format", "UDRW"); @@ -302,16 +303,16 @@ "-mountroot", imagesRoot.getAbsolutePath()); IOUtils.exec(pb); - File mountedRoot = - new File(imagesRoot.getAbsolutePath(), APP_NAME.fetchFrom(p)); + File mountedRoot = new File(imagesRoot.getAbsolutePath(), + APP_NAME.fetchFrom(params)); // volume icon File volumeIconFile = new File(mountedRoot, ".VolumeIcon.icns"); - IOUtils.copyFile(getConfig_VolumeIcon(p), + IOUtils.copyFile(getConfig_VolumeIcon(params), volumeIconFile); pb = new ProcessBuilder("osascript", - getConfig_VolumeScript(p).getAbsolutePath()); + getConfig_VolumeScript(params).getAbsolutePath()); IOUtils.exec(pb); // Indicate that we want a custom icon @@ -368,7 +369,7 @@ IOUtils.exec(pb); //add license if needed - if (getConfig_LicenseFile(p).exists()) { + if (getConfig_LicenseFile(params).exists()) { //hdiutil unflatten your_image_file.dmg pb = new ProcessBuilder( hdiutil, @@ -383,7 +384,7 @@ "udifrez", finalDMG.getAbsolutePath(), "-xml", - getConfig_LicenseFile(p).getAbsolutePath() + getConfig_LicenseFile(params).getAbsolutePath() ); IOUtils.exec(pb); @@ -402,7 +403,7 @@ Log.verbose(MessageFormat.format(I18N.getString( "message.output-to-location"), - APP_NAME.fetchFrom(p), finalDMG.getAbsolutePath())); + APP_NAME.fetchFrom(params), finalDMG.getAbsolutePath())); return finalDMG; } --- old/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractImageBundler.java 2019-06-04 11:12:39.145853600 -0400 +++ new/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractImageBundler.java 2019-06-04 11:12:37.726217200 -0400 @@ -49,67 +49,16 @@ */ public abstract class AbstractImageBundler extends AbstractBundler { - private final static String JAVA_VERSION_SPEC = - "java version \"((\\d+).(\\d+).(\\d+).(\\d+))(-(.*))?(\\+[^\"]*)?\""; - private static final ResourceBundle I18N = ResourceBundle.getBundle( "jdk.jpackage.internal.resources.MainResources"); - public void imageBundleValidation(Map p) + public void imageBundleValidation(Map params) throws ConfigException { - StandardBundlerParam.validateMainClassInfoFromAppResources(p); - - } - - public static void extractFlagsFromVersion( - Map params, String versionOutput) { - Pattern bitArchPattern = Pattern.compile("(\\d*)[- ]?[bB]it"); - Matcher matcher = bitArchPattern.matcher(versionOutput); - if (matcher.find()) { - params.put(".runtime.bit-arch", matcher.group(1)); - } else { - // presume 32 bit on no match - params.put(".runtime.bit-arch", "32"); - } + StandardBundlerParam.validateMainClassInfoFromAppResources(params); - Pattern oldVersionMatcher = Pattern.compile( - "java version \"((\\d+.(\\d+).\\d+)(_(\\d+)))?(-(.*))?\""); - matcher = oldVersionMatcher.matcher(versionOutput); - if (matcher.find()) { - params.put(".runtime.version", matcher.group(1)); - params.put(".runtime.version.release", matcher.group(2)); - params.put(".runtime.version.major", matcher.group(3)); - params.put(".runtime.version.update", matcher.group(5)); - params.put(".runtime.version.minor", matcher.group(5)); - params.put(".runtime.version.security", matcher.group(5)); - params.put(".runtime.version.patch", "0"); - params.put(".runtime.version.modifiers", matcher.group(7)); - } else { - Pattern newVersionMatcher = Pattern.compile(JAVA_VERSION_SPEC); - matcher = newVersionMatcher.matcher(versionOutput); - if (matcher.find()) { - params.put(".runtime.version", matcher.group(1)); - params.put(".runtime.version.release", matcher.group(1)); - params.put(".runtime.version.major", matcher.group(2)); - params.put(".runtime.version.update", matcher.group(3)); - params.put(".runtime.version.minor", matcher.group(3)); - params.put(".runtime.version.security", matcher.group(4)); - params.put(".runtime.version.patch", matcher.group(5)); - params.put(".runtime.version.modifiers", matcher.group(7)); - } else { - params.put(".runtime.version", ""); - params.put(".runtime.version.release", ""); - params.put(".runtime.version.major", ""); - params.put(".runtime.version.update", ""); - params.put(".runtime.version.minor", ""); - params.put(".runtime.version.security", ""); - params.put(".runtime.version.patch", ""); - params.put(".runtime.version.modifiers", ""); - } - } } - protected File createRoot(Map p, + protected File createRoot(Map params, File outputDirectory, boolean dependentTask, String name) throws PackagerException { if (!outputDirectory.isDirectory() && !outputDirectory.mkdirs()) { --- old/src/jdk.jpackage/share/classes/jdk/jpackage/internal/BundleParams.java 2019-06-04 11:12:57.199516800 -0400 +++ new/src/jdk.jpackage/share/classes/jdk/jpackage/internal/BundleParams.java 2019-06-04 11:12:55.514673600 -0400 @@ -109,8 +109,8 @@ this.params = new HashMap<>(params); } - public void addAllBundleParams(Map p) { - params.putAll(p); + public void addAllBundleParams(Map params) { + this.params.putAll(params); } public T fetchParam(BundlerParamInfo paramInfo) { --- old/src/jdk.jpackage/share/classes/jdk/jpackage/internal/DeployParams.java 2019-06-04 11:13:21.095973000 -0400 +++ new/src/jdk.jpackage/share/classes/jdk/jpackage/internal/DeployParams.java 2019-06-04 11:13:18.724712200 -0400 @@ -52,31 +52,20 @@ final List resources = new ArrayList<>(); - String id; - String vendor; - String email; - String description; + BundlerType bundleType = BundlerType.NONE; + String targetFormat = null; //means any String licenseType; String copyright; String version; - Boolean systemWide; - Boolean serviceHint; - Boolean signBundle; - Boolean installdirChooser; - String applicationClass; - List params; - // Java modules support String addModules = null; String limitModules = null; - String modulePath = null; String module = null; File outdir = null; - String appId = null; // list of jvm args // (in theory string can contain spaces and need to be escaped @@ -97,18 +86,6 @@ this.version = version; } - void setSystemWide(Boolean systemWide) { - this.systemWide = systemWide; - } - - void setInstalldirChooser(Boolean installdirChooser) { - this.installdirChooser = installdirChooser; - } - - void setSignBundle(Boolean signBundle) { - this.signBundle = signBundle; - } - void addJvmArg(String v) { jvmargs.add(v); } @@ -131,38 +108,10 @@ } } - String getModulePath() { - return this.modulePath; - } - - void setModulePath(String value) { - this.modulePath = value; - } - void setModule(String value) { this.module = value; } - void setDescription(String description) { - this.description = description; - } - - public void setAppId(String id) { - appId = id; - } - - void setParams(List params) { - this.params = params; - } - - void setVendor(String vendor) { - this.vendor = vendor; - } - - void setEmail(String email) { - this.email = email; - } - void setApplicationClass(String applicationClass) { this.applicationClass = applicationClass; } @@ -237,13 +186,6 @@ StandardBundlerParam.CLASSPATH.getID(), classpath); } - private static File createFile(final File baseDir, final String path) { - final File testFile = new File(path); - return testFile.isAbsolute() ? - testFile : new File(baseDir == null ? - null : baseDir.getAbsolutePath(), path); - } - static void validateName(String s, boolean forApp) throws PackagerException { @@ -400,9 +342,6 @@ return result; } - BundlerType bundleType = BundlerType.NONE; - String targetFormat = null; //means any - void setBundleType(BundlerType type) { bundleType = type; } @@ -419,20 +358,7 @@ return targetFormat; } - private String getArch() { - String arch = System.getProperty("os.arch").toLowerCase(); - - if ("x86".equals(arch) || "i386".equals(arch) || "i486".equals(arch) - || "i586".equals(arch) || "i686".equals(arch)) { - arch = "x86"; - } else if ("x86_64".equals(arch) || "amd64".equals("arch")) { - arch = "x86_64"; - } - - return arch; - } - - static final Set multi_args = new TreeSet<>(Arrays.asList( + private static final Set multi_args = new TreeSet<>(Arrays.asList( StandardBundlerParam.JAVA_OPTIONS.getID(), StandardBundlerParam.ARGUMENTS.getID(), StandardBundlerParam.MODULE_PATH.getID(), @@ -479,11 +405,7 @@ bundleParams.setAppVersion(version); bundleParams.setType(bundleType); bundleParams.setBundleFormat(targetFormat); - bundleParams.setVendor(vendor); - bundleParams.setEmail(email); - bundleParams.setInstalldirChooser(installdirChooser); bundleParams.setCopyright(copyright); - bundleParams.setDescription(description); bundleParams.setJvmargs(jvmargs); @@ -495,21 +417,10 @@ bundleParams.setLimitModules(limitModules); } - if (modulePath != null && !modulePath.isEmpty()) { - bundleParams.setModulePath(modulePath); - } - if (module != null && !module.isEmpty()) { bundleParams.setMainModule(module); } - Map paramsMap = new TreeMap<>(); - if (params != null) { - for (Param p : params) { - paramsMap.put(p.name, p.value); - } - } - Map unescapedHtmlParams = new TreeMap<>(); Map escapedHtmlParams = new TreeMap<>(); @@ -531,24 +442,6 @@ return this.bundlerArguments; } - void putUnlessNull(String param, Object value) { - if (value != null) { - bundlerArguments.put(param, value); - } - } - - void putUnlessNullOrEmpty(String param, Map value) { - if (value != null && !value.isEmpty()) { - bundlerArguments.put(param, value); - } - } - - void putUnlessNullOrEmpty(String param, Collection value) { - if (value != null && !value.isEmpty()) { - bundlerArguments.put(param, value); - } - } - @Override public String toString() { return "DeployParams {" + "output: " + outdir --- old/src/jdk.jpackage/share/classes/jdk/jpackage/internal/RelativeFileSet.java 2019-06-04 11:13:46.961436200 -0400 +++ new/src/jdk.jpackage/share/classes/jdk/jpackage/internal/RelativeFileSet.java 2019-06-04 11:13:44.808581000 -0400 @@ -40,11 +40,6 @@ private File basedir; private Set files = new LinkedHashSet<>(); - RelativeFileSet(RelativeFileSet copy) { - basedir = copy.basedir; - files = new LinkedHashSet<>(copy.files); - } - RelativeFileSet(File base, Collection files) { basedir = base; String baseAbsolute = basedir.getAbsolutePath(); @@ -61,42 +56,10 @@ } } - void upshift() { - String root = basedir.getName(); - basedir = basedir.getParentFile(); - Set newFiles = new LinkedHashSet<>(); - for (String s : files) { - newFiles.add(root + File.separator + s); - } - files = newFiles; - } - RelativeFileSet(File base, Set files) { this(base, (Collection) files); } - boolean contains(String[] requiredFiles) { - boolean result = true; - - for(String fname: requiredFiles) { - if (!files.contains(fname)) { - Log.debug(" RelativeFileSet does not contain [" + fname + "]"); - result = false; - } - } - - return result; - } - - boolean contains(String requiredFile) { - if (files.contains(requiredFile)) { - return true; - } else { - Log.debug("RelativeFileSet does not contain [" +requiredFile+ "]"); - return false; - } - } - File getBaseDirectory() { return basedir; } --- old/src/jdk.jpackage/share/classes/jdk/jpackage/internal/StandardBundlerParam.java 2019-06-04 11:14:07.121153400 -0400 +++ new/src/jdk.jpackage/share/classes/jdk/jpackage/internal/StandardBundlerParam.java 2019-06-04 11:14:05.685916600 -0400 @@ -472,21 +472,21 @@ (s, p) -> new LinkedHashSet<>(Arrays.asList(s.split(","))) ); - static boolean isRuntimeInstaller(Map p) { - if (p.containsKey(MODULE.getID()) || - p.containsKey(MAIN_JAR.getID()) || - p.containsKey(PREDEFINED_APP_IMAGE.getID())) { + static boolean isRuntimeInstaller(Map params) { + if (params.containsKey(MODULE.getID()) || + params.containsKey(MAIN_JAR.getID()) || + params.containsKey(PREDEFINED_APP_IMAGE.getID())) { return false; // we are building or are given an application } // runtime installer requires --runtime-image, if this is false // here then we should have thrown error validating args. - return p.containsKey(PREDEFINED_RUNTIME_IMAGE.getID()); + return params.containsKey(PREDEFINED_RUNTIME_IMAGE.getID()); } - static File getPredefinedAppImage(Map p) { + static File getPredefinedAppImage(Map params) { File applicationImage = null; - if (PREDEFINED_APP_IMAGE.fetchFrom(p) != null) { - applicationImage = PREDEFINED_APP_IMAGE.fetchFrom(p); + if (PREDEFINED_APP_IMAGE.fetchFrom(params) != null) { + applicationImage = PREDEFINED_APP_IMAGE.fetchFrom(params); Log.debug("Using App Image from " + applicationImage); if (!applicationImage.exists()) { throw new RuntimeException( @@ -500,10 +500,10 @@ } static void copyPredefinedRuntimeImage( - Map p, + Map params, AbstractAppImageBuilder appBuilder) throws IOException , ConfigException { - File image = PREDEFINED_RUNTIME_IMAGE.fetchFrom(p); + File image = PREDEFINED_RUNTIME_IMAGE.fetchFrom(params); if (!image.exists()) { throw new ConfigException( MessageFormat.format(I18N.getString( @@ -520,7 +520,7 @@ // if module-path given - copy modules to appDir/mods List modulePath = - StandardBundlerParam.MODULE_PATH.fetchFrom(p); + StandardBundlerParam.MODULE_PATH.fetchFrom(params); List defaultModulePath = getDefaultModulePath(); Path dest = appBuilder.getAppModsDir(); --- old/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinExeBundler.java 2019-06-04 11:14:27.156067400 -0400 +++ new/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinExeBundler.java 2019-06-04 11:14:25.346421000 -0400 @@ -169,9 +169,9 @@ } @Override - public File execute(Map p, + public File execute(Map params, File outputParentDir) throws PackagerException { - return bundle(p, outputParentDir); + return bundle(params, outputParentDir); } @Override @@ -203,16 +203,16 @@ } @Override - public boolean validate(Map p) + public boolean validate(Map params) throws UnsupportedPlatformException, ConfigException { try { - if (p == null) throw new ConfigException( + if (params == null) throw new ConfigException( getString("error.parameters-null"), getString("error.parameters-null.advice")); // run basic validation to ensure requirements are met // we are not interested in return code, only possible exception - APP_BUNDLER.fetchFrom(p).validate(p); + APP_BUNDLER.fetchFrom(params).validate(params); // make sure some key values don't have newlines for (BundlerParamInfo pi : Arrays.asList( @@ -223,7 +223,7 @@ VENDOR, VERSION) ) { - String v = pi.fetchFrom(p); + String v = pi.fetchFrom(params); if (v.contains("\n") | v.contains("\r")) { throw new ConfigException("Parmeter '" + pi.getID() + "' cannot contain a newline.", @@ -234,14 +234,14 @@ // exe bundlers trim the copyright to 100 characters, // tell them this will happen - if (COPYRIGHT.fetchFrom(p).length() > 100) { + if (COPYRIGHT.fetchFrom(params).length() > 100) { throw new ConfigException( getString("error.copyright-is-too-long"), getString("error.copyright-is-too-long.advice")); } String innoVersion = findToolVersion( - TOOL_INNO_SETUP_COMPILER_EXECUTABLE.fetchFrom(p)); + TOOL_INNO_SETUP_COMPILER_EXECUTABLE.fetchFrom(params)); //Inno Setup 5+ is required String minVersion = "5.0"; @@ -259,7 +259,7 @@ // only one mime type per association, at least one file extension List> associations = - FILE_ASSOCIATIONS.fetchFrom(p); + FILE_ASSOCIATIONS.fetchFrom(params); if (associations != null) { for (int i = 0; i < associations.size(); i++) { Map assoc = associations.get(i); @@ -284,40 +284,41 @@ } } - private boolean prepareProto(Map p) + private boolean prepareProto(Map params) throws PackagerException, IOException { - File appImage = StandardBundlerParam.getPredefinedAppImage(p); + File appImage = StandardBundlerParam.getPredefinedAppImage(params); File appDir = null; // we either have an application image or need to build one if (appImage != null) { - appDir = new File( - EXE_IMAGE_DIR.fetchFrom(p), APP_NAME.fetchFrom(p)); + appDir = new File(EXE_IMAGE_DIR.fetchFrom(params), + APP_NAME.fetchFrom(params)); // copy everything from appImage dir into appDir/name IOUtils.copyRecursive(appImage.toPath(), appDir.toPath()); } else { - appDir = APP_BUNDLER.fetchFrom(p).doBundle(p, - EXE_IMAGE_DIR.fetchFrom(p), true); + appDir = APP_BUNDLER.fetchFrom(params).doBundle(params, + EXE_IMAGE_DIR.fetchFrom(params), true); } if (appDir == null) { return false; } - p.put(WIN_APP_IMAGE.getID(), appDir); + params.put(WIN_APP_IMAGE.getID(), appDir); - String licenseFile = LICENSE_FILE.fetchFrom(p); + String licenseFile = LICENSE_FILE.fetchFrom(params); if (licenseFile != null) { // need to copy license file to the working directory and convert to rtf if needed File lfile = new File(licenseFile); - File destFile = new File(CONFIG_ROOT.fetchFrom(p), lfile.getName()); + File destFile = new File(CONFIG_ROOT.fetchFrom(params), + lfile.getName()); IOUtils.copyFile(lfile, destFile); ensureByMutationFileIsRTF(destFile); } // copy file association icons List> fileAssociations = - FILE_ASSOCIATIONS.fetchFrom(p); + FILE_ASSOCIATIONS.fetchFrom(params); for (Map fa : fileAssociations) { File icon = FA_ICON.fetchFrom(fa); // TODO FA_ICON_ICO @@ -339,7 +340,7 @@ return true; } - public File bundle(Map p, File outdir) + public File bundle(Map params, File outdir) throws PackagerException { if (!outdir.isDirectory() && !outdir.mkdirs()) { throw new PackagerException("error.cannot-create-output-dir", @@ -352,7 +353,7 @@ String tempDirectory = WindowsDefender.getUserTempDirectory(); if (Arguments.CLIOptions.context().userProvidedBuildRoot) { - tempDirectory = TEMP_ROOT.fetchFrom(p).getAbsolutePath(); + tempDirectory = TEMP_ROOT.fetchFrom(params).getAbsolutePath(); } if (WindowsDefender.isThereAPotentialWindowsDefenderIssue( tempDirectory)) { @@ -362,7 +363,7 @@ } // validate we have valid tools before continuing - String iscc = TOOL_INNO_SETUP_COMPILER_EXECUTABLE.fetchFrom(p); + String iscc = TOOL_INNO_SETUP_COMPILER_EXECUTABLE.fetchFrom(params); if (iscc == null || !new File(iscc).isFile()) { Log.verbose(getString("error.iscc-not-found")); Log.verbose(MessageFormat.format( @@ -370,27 +371,27 @@ throw new PackagerException("error.iscc-not-found"); } - File imageDir = EXE_IMAGE_DIR.fetchFrom(p); + File imageDir = EXE_IMAGE_DIR.fetchFrom(params); try { imageDir.mkdirs(); - boolean menuShortcut = MENU_HINT.fetchFrom(p); - boolean desktopShortcut = SHORTCUT_HINT.fetchFrom(p); + boolean menuShortcut = MENU_HINT.fetchFrom(params); + boolean desktopShortcut = SHORTCUT_HINT.fetchFrom(params); if (!menuShortcut && !desktopShortcut) { // both can not be false - user will not find the app Log.verbose(getString("message.one-shortcut-required")); - p.put(MENU_HINT.getID(), true); + params.put(MENU_HINT.getID(), true); } - if (prepareProto(p) && prepareProjectConfig(p)) { - File configScript = getConfig_Script(p); + if (prepareProto(params) && prepareProjectConfig(params)) { + File configScript = getConfig_Script(params); if (configScript.exists()) { Log.verbose(MessageFormat.format( getString("message.running-wsh-script"), configScript.getAbsolutePath())); IOUtils.run("wscript", configScript); } - return buildEXE(p, outdir); + return buildEXE(params, outdir); } return null; } catch (IOException ex) { @@ -400,13 +401,13 @@ } // name of post-image script - private File getConfig_Script(Map p) { - return new File(EXE_IMAGE_DIR.fetchFrom(p), - APP_NAME.fetchFrom(p) + "-post-image.wsf"); + private File getConfig_Script(Map params) { + return new File(EXE_IMAGE_DIR.fetchFrom(params), + APP_NAME.fetchFrom(params) + "-post-image.wsf"); } - private String getAppIdentifier(Map p) { - String nm = UPGRADE_UUID.fetchFrom(p).toString(); + private String getAppIdentifier(Map params) { + String nm = UPGRADE_UUID.fetchFrom(params).toString(); // limitation of innosetup if (nm.length() > 126) { @@ -417,11 +418,12 @@ return nm; } - private String getLicenseFile(Map p) { - String licenseFile = LICENSE_FILE.fetchFrom(p); + private String getLicenseFile(Map params) { + String licenseFile = LICENSE_FILE.fetchFrom(params); if (licenseFile != null) { File lfile = new File(licenseFile); - File destFile = new File(CONFIG_ROOT.fetchFrom(p), lfile.getName()); + File destFile = new File(CONFIG_ROOT.fetchFrom(params), + lfile.getName()); String filePath = destFile.getAbsolutePath(); if (filePath.contains(" ")) { return "\"" + filePath + "\""; @@ -435,8 +437,8 @@ void validateValueAndPut(Map data, String key, BundlerParamInfo param, - Map p) throws IOException { - String value = param.fetchFrom(p); + Map params) throws IOException { + String value = param.fetchFrom(params); if (value.contains("\r") || value.contains("\n")) { throw new IOException("Configuration Parameter " + param.getID() + " cannot contain multiple lines of text"); @@ -455,38 +457,38 @@ return value; } - boolean prepareMainProjectFile(Map p) + boolean prepareMainProjectFile(Map params) throws IOException { Map data = new HashMap<>(); data.put("PRODUCT_APP_IDENTIFIER", - innosetupEscape(getAppIdentifier(p))); + innosetupEscape(getAppIdentifier(params))); - validateValueAndPut(data, "INSTALL_DIR", WINDOWS_INSTALL_DIR, p); - validateValueAndPut(data, "INSTALLER_NAME", APP_NAME, p); - validateValueAndPut(data, "APPLICATION_VENDOR", VENDOR, p); - validateValueAndPut(data, "APPLICATION_VERSION", VERSION, p); + validateValueAndPut(data, "INSTALL_DIR", WINDOWS_INSTALL_DIR, params); + validateValueAndPut(data, "INSTALLER_NAME", APP_NAME, params); + validateValueAndPut(data, "APPLICATION_VENDOR", VENDOR, params); + validateValueAndPut(data, "APPLICATION_VERSION", VERSION, params); validateValueAndPut(data, "INSTALLER_FILE_NAME", - INSTALLER_FILE_NAME, p); + INSTALLER_FILE_NAME, params); data.put("LAUNCHER_NAME", - innosetupEscape(WinAppBundler.getAppName(p))); + innosetupEscape(WinAppBundler.getAppName(params))); data.put("APPLICATION_LAUNCHER_FILENAME", - innosetupEscape(WinAppBundler.getLauncherName(p))); + innosetupEscape(WinAppBundler.getLauncherName(params))); data.put("APPLICATION_DESKTOP_SHORTCUT", - SHORTCUT_HINT.fetchFrom(p) ? "returnTrue" : "returnFalse"); + SHORTCUT_HINT.fetchFrom(params) ? "returnTrue" : "returnFalse"); data.put("APPLICATION_MENU_SHORTCUT", - MENU_HINT.fetchFrom(p) ? "returnTrue" : "returnFalse"); - validateValueAndPut(data, "APPLICATION_GROUP", MENU_GROUP, p); - validateValueAndPut(data, "APPLICATION_COPYRIGHT", COPYRIGHT, p); + MENU_HINT.fetchFrom(params) ? "returnTrue" : "returnFalse"); + validateValueAndPut(data, "APPLICATION_GROUP", MENU_GROUP, params); + validateValueAndPut(data, "APPLICATION_COPYRIGHT", COPYRIGHT, params); data.put("APPLICATION_LICENSE_FILE", - innosetupEscape(getLicenseFile(p))); + innosetupEscape(getLicenseFile(params))); data.put("DISABLE_DIR_PAGE", - INSTALLDIR_CHOOSER.fetchFrom(p) ? "No" : "Yes"); + INSTALLDIR_CHOOSER.fetchFrom(params) ? "No" : "Yes"); - Boolean isSystemWide = EXE_SYSTEM_WIDE.fetchFrom(p); + Boolean isSystemWide = EXE_SYSTEM_WIDE.fetchFrom(params); if (isSystemWide) { data.put("APPLICATION_INSTALL_ROOT", "{pf}"); @@ -498,10 +500,10 @@ data.put("ARCHITECTURE_BIT_MODE", "x64"); - validateValueAndPut(data, "RUN_FILENAME", APP_NAME, p); + validateValueAndPut(data, "RUN_FILENAME", APP_NAME, params); validateValueAndPut(data, "APPLICATION_DESCRIPTION", - DESCRIPTION, p); + DESCRIPTION, params); data.put("APPLICATION_SERVICE", "returnFalse"); data.put("APPLICATION_NOT_SERVICE", "returnFalse"); @@ -510,15 +512,15 @@ data.put("STOP_ON_UNINSTALL", ""); data.put("RUN_AT_STARTUP", ""); - String imagePathString = - WIN_APP_IMAGE.fetchFrom(p).toPath().toAbsolutePath().toString(); + String imagePathString = WIN_APP_IMAGE + .fetchFrom(params).toPath().toAbsolutePath().toString(); data.put("APPLICATION_IMAGE", innosetupEscape(imagePathString)); Log.verbose("setting APPLICATION_IMAGE to " + innosetupEscape(imagePathString) + " for InnoSetup"); StringBuilder addLaunchersCfg = new StringBuilder(); for (Map - launcher : ADD_LAUNCHERS.fetchFrom(p)) { + launcher : ADD_LAUNCHERS.fetchFrom(params)) { String application_name = APP_NAME.fetchFrom(launcher); if (MENU_HINT.fetchFrom(launcher)) { // Name: "{group}\APPLICATION_NAME"; @@ -548,9 +550,9 @@ data.put("ADD_LAUNCHERS", addLaunchersCfg.toString()); StringBuilder registryEntries = new StringBuilder(); - String regName = APP_REGISTRY_NAME.fetchFrom(p); + String regName = APP_REGISTRY_NAME.fetchFrom(params); List> fetchFrom = - FILE_ASSOCIATIONS.fetchFrom(p); + FILE_ASSOCIATIONS.fetchFrom(params); for (int i = 0; i < fetchFrom.size(); i++) { Map fileAssociation = fetchFrom.get(i); String description = FA_DESCRIPTION.fetchFrom(fileAssociation); @@ -680,7 +682,7 @@ .append(entryName) .append("\\shell\\open\\command\"; ValueType: " + "string; ValueName: \"\"; ValueData: \"\"\"{app}\\") - .append(APP_NAME.fetchFrom(p)) + .append(APP_NAME.fetchFrom(params)) .append("\"\" \"\"%1\"\"\"\r\n"); } else { registryEntries.append( @@ -688,7 +690,7 @@ .append(entryName) .append("\\shell\\open\\command\"; ValueType: " + "string; ValueName: \"\"; ValueData: \"\"\"{app}\\") - .append(APP_NAME.fetchFrom(p)) + .append(APP_NAME.fetchFrom(params)) .append("\"\" \"\"%1\"\"\"\r\n"); } } @@ -700,17 +702,17 @@ data.put("FILE_ASSOCIATIONS", ""); } - String iss = StandardBundlerParam.isRuntimeInstaller(p) ? + String iss = StandardBundlerParam.isRuntimeInstaller(params) ? DEFAULT_JRE_EXE_TEMPLATE : DEFAULT_EXE_PROJECT_TEMPLATE; try (Writer w = new BufferedWriter(new FileWriter( - getConfig_ExeProjectFile(p)))) { + getConfig_ExeProjectFile(params)))) { String content = preprocessTextResource( - getConfig_ExeProjectFile(p).getName(), + getConfig_ExeProjectFile(params).getName(), getString("resource.inno-setup-project-file"), - iss, data, VERBOSE.fetchFrom(p), - RESOURCE_DIR.fetchFrom(p)); + iss, data, VERBOSE.fetchFrom(params), + RESOURCE_DIR.fetchFrom(params)); w.write(content); } return true; @@ -729,41 +731,41 @@ private final static String DEFAULT_INNO_SETUP_ICON = "icon_inno_setup.bmp"; - private boolean prepareProjectConfig(Map p) + private boolean prepareProjectConfig(Map params) throws IOException { - prepareMainProjectFile(p); + prepareMainProjectFile(params); // prepare installer icon - File iconTarget = getConfig_SmallInnoSetupIcon(p); + File iconTarget = getConfig_SmallInnoSetupIcon(params); fetchResource(iconTarget.getName(), getString("resource.setup-icon"), DEFAULT_INNO_SETUP_ICON, iconTarget, - VERBOSE.fetchFrom(p), - RESOURCE_DIR.fetchFrom(p)); + VERBOSE.fetchFrom(params), + RESOURCE_DIR.fetchFrom(params)); - fetchResource(getConfig_Script(p).getName(), + fetchResource(getConfig_Script(params).getName(), getString("resource.post-install-script"), (String) null, - getConfig_Script(p), - VERBOSE.fetchFrom(p), - RESOURCE_DIR.fetchFrom(p)); + getConfig_Script(params), + VERBOSE.fetchFrom(params), + RESOURCE_DIR.fetchFrom(params)); return true; } private File getConfig_SmallInnoSetupIcon( - Map p) { - return new File(EXE_IMAGE_DIR.fetchFrom(p), - APP_NAME.fetchFrom(p) + "-setup-icon.bmp"); + Map params) { + return new File(EXE_IMAGE_DIR.fetchFrom(params), + APP_NAME.fetchFrom(params) + "-setup-icon.bmp"); } - private File getConfig_ExeProjectFile(Map p) { - return new File(EXE_IMAGE_DIR.fetchFrom(p), - APP_NAME.fetchFrom(p) + ".iss"); + private File getConfig_ExeProjectFile(Map params) { + return new File(EXE_IMAGE_DIR.fetchFrom(params), + APP_NAME.fetchFrom(params) + ".iss"); } - private File buildEXE(Map p, File outdir) + private File buildEXE(Map params, File outdir) throws IOException { Log.verbose(MessageFormat.format( getString("message.outputting-to-location"), @@ -773,11 +775,11 @@ // run Inno Setup ProcessBuilder pb = new ProcessBuilder( - TOOL_INNO_SETUP_COMPILER_EXECUTABLE.fetchFrom(p), + TOOL_INNO_SETUP_COMPILER_EXECUTABLE.fetchFrom(params), "/q", // turn off inno setup output "/o"+outdir.getAbsolutePath(), - getConfig_ExeProjectFile(p).getAbsolutePath()); - pb = pb.directory(EXE_IMAGE_DIR.fetchFrom(p)); + getConfig_ExeProjectFile(params).getAbsolutePath()); + pb = pb.directory(EXE_IMAGE_DIR.fetchFrom(params)); IOUtils.exec(pb); Log.verbose(MessageFormat.format( --- old/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinMsiBundler.java 2019-06-04 11:14:56.150611500 -0400 +++ new/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinMsiBundler.java 2019-06-04 11:14:53.107533400 -0400 @@ -244,21 +244,21 @@ } @Override - public boolean validate(Map p) + public boolean validate(Map params) throws UnsupportedPlatformException, ConfigException { try { - if (p == null) throw new ConfigException( + if (params == null) throw new ConfigException( I18N.getString("error.parameters-null"), I18N.getString("error.parameters-null.advice")); // run basic validation to ensure requirements are met // we are not interested in return code, only possible exception - APP_BUNDLER.fetchFrom(p).validate(p); + APP_BUNDLER.fetchFrom(params).validate(params); String candleVersion = - findToolVersion(TOOL_CANDLE_EXECUTABLE.fetchFrom(p)); + findToolVersion(TOOL_CANDLE_EXECUTABLE.fetchFrom(params)); String lightVersion = - findToolVersion(TOOL_LIGHT_EXECUTABLE.fetchFrom(p)); + findToolVersion(TOOL_LIGHT_EXECUTABLE.fetchFrom(params)); // WiX 3.0+ is required String minVersion = "3.0"; @@ -285,12 +285,12 @@ if (!VersionExtractor.isLessThan(lightVersion, "3.6")) { Log.verbose(I18N.getString("message.use-wix36-features")); - p.put(CAN_USE_WIX36.getID(), Boolean.TRUE); + params.put(CAN_USE_WIX36.getID(), Boolean.TRUE); } /********* validate bundle parameters *************/ - String version = PRODUCT_VERSION.fetchFrom(p); + String version = PRODUCT_VERSION.fetchFrom(params); if (!isVersionStringValid(version)) { throw new ConfigException( MessageFormat.format(I18N.getString( @@ -302,7 +302,7 @@ // only one mime type per association, at least one file extension List> associations = - FILE_ASSOCIATIONS.fetchFrom(p); + FILE_ASSOCIATIONS.fetchFrom(params); if (associations != null) { for (int i = 0; i < associations.size(); i++) { Map assoc = associations.get(i); @@ -378,36 +378,37 @@ return true; } - private boolean prepareProto(Map p) + private boolean prepareProto(Map params) throws PackagerException, IOException { - File appImage = StandardBundlerParam.getPredefinedAppImage(p); + File appImage = StandardBundlerParam.getPredefinedAppImage(params); File appDir = null; // we either have an application image or need to build one if (appImage != null) { - appDir = new File( - MSI_IMAGE_DIR.fetchFrom(p), APP_NAME.fetchFrom(p)); + appDir = new File(MSI_IMAGE_DIR.fetchFrom(params), + APP_NAME.fetchFrom(params)); // copy everything from appImage dir into appDir/name IOUtils.copyRecursive(appImage.toPath(), appDir.toPath()); } else { - appDir = APP_BUNDLER.fetchFrom(p).doBundle(p, - MSI_IMAGE_DIR.fetchFrom(p), true); + appDir = APP_BUNDLER.fetchFrom(params).doBundle(params, + MSI_IMAGE_DIR.fetchFrom(params), true); } - p.put(WIN_APP_IMAGE.getID(), appDir); + params.put(WIN_APP_IMAGE.getID(), appDir); - String licenseFile = LICENSE_FILE.fetchFrom(p); + String licenseFile = LICENSE_FILE.fetchFrom(params); if (licenseFile != null) { // need to copy license file to the working directory and convert to rtf if needed File lfile = new File(licenseFile); - File destFile = new File(CONFIG_ROOT.fetchFrom(p), lfile.getName()); + File destFile = new File(CONFIG_ROOT.fetchFrom(params), + lfile.getName()); IOUtils.copyFile(lfile, destFile); ensureByMutationFileIsRTF(destFile); } // copy file association icons List> fileAssociations = - FILE_ASSOCIATIONS.fetchFrom(p); + FILE_ASSOCIATIONS.fetchFrom(params); for (Map fa : fileAssociations) { File icon = FA_ICON.fetchFrom(fa); // TODO FA_ICON_ICO if (icon == null) { @@ -428,7 +429,7 @@ return appDir != null; } - public File bundle(Map p, File outdir) + public File bundle(Map params, File outdir) throws PackagerException { if (!outdir.isDirectory() && !outdir.mkdirs()) { throw new PackagerException("error.cannot-create-output-dir", @@ -440,8 +441,8 @@ } // validate we have valid tools before continuing - String light = TOOL_LIGHT_EXECUTABLE.fetchFrom(p); - String candle = TOOL_CANDLE_EXECUTABLE.fetchFrom(p); + String light = TOOL_LIGHT_EXECUTABLE.fetchFrom(params); + String candle = TOOL_CANDLE_EXECUTABLE.fetchFrom(params); if (light == null || !new File(light).isFile() || candle == null || !new File(candle).isFile()) { Log.verbose(MessageFormat.format( @@ -451,21 +452,21 @@ throw new PackagerException("error.no-wix-tools"); } - File imageDir = MSI_IMAGE_DIR.fetchFrom(p); + File imageDir = MSI_IMAGE_DIR.fetchFrom(params); try { imageDir.mkdirs(); - boolean menuShortcut = MENU_HINT.fetchFrom(p); - boolean desktopShortcut = SHORTCUT_HINT.fetchFrom(p); + boolean menuShortcut = MENU_HINT.fetchFrom(params); + boolean desktopShortcut = SHORTCUT_HINT.fetchFrom(params); if (!menuShortcut && !desktopShortcut) { // both can not be false - user will not find the app Log.verbose(I18N.getString("message.one-shortcut-required")); - p.put(MENU_HINT.getID(), true); + params.put(MENU_HINT.getID(), true); } - if (prepareProto(p) && prepareWiXConfig(p) - && prepareBasicProjectConfig(p)) { - File configScriptSrc = getConfig_Script(p); + if (prepareProto(params) && prepareWiXConfig(params) + && prepareBasicProjectConfig(params)) { + File configScriptSrc = getConfig_Script(params); if (configScriptSrc.exists()) { // we need to be running post script in the image folder @@ -481,7 +482,7 @@ configScript.getAbsolutePath())); IOUtils.run("wscript", configScript); } - return buildMSI(p, outdir); + return buildMSI(params, outdir); } return null; } catch (IOException ex) { @@ -1038,11 +1039,12 @@ APP_NAME.fetchFrom(params) + ".wxs"); } - private String getLicenseFile(Map p) { - String licenseFile = LICENSE_FILE.fetchFrom(p); + private String getLicenseFile(Map params) { + String licenseFile = LICENSE_FILE.fetchFrom(params); if (licenseFile != null) { File lfile = new File(licenseFile); - File destFile = new File(CONFIG_ROOT.fetchFrom(p), lfile.getName()); + File destFile = new File(CONFIG_ROOT.fetchFrom(params), + lfile.getName()); String filePath = destFile.getAbsolutePath(); if (filePath.contains(" ")) { return "\"" + filePath + "\""; --- old/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WindowsAppImageBuilder.java 2019-06-04 11:15:17.195551100 -0400 +++ new/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WindowsAppImageBuilder.java 2019-06-04 11:15:14.902292300 -0400 @@ -182,22 +182,23 @@ } } - public static String getLauncherName(Map p) { - return APP_NAME.fetchFrom(p) + ".exe"; + public static String getLauncherName(Map params) { + return APP_NAME.fetchFrom(params) + ".exe"; } // Returns launcher resource name for launcher we need to use. public static String getLauncherResourceName( - Map p) { - if (CONSOLE_HINT.fetchFrom(p)) { + Map params) { + if (CONSOLE_HINT.fetchFrom(params)) { return "jpackageapplauncher.exe"; } else { return "jpackageapplauncherw.exe"; } } - public static String getLauncherCfgName(Map p) { - return "app/" + APP_NAME.fetchFrom(p) +".cfg"; + public static String getLauncherCfgName( + Map params) { + return "app/" + APP_NAME.fetchFrom(params) +".cfg"; } private File getConfig_AppIcon(Map params) { @@ -346,12 +347,12 @@ } private void createLauncherForEntryPoint( - Map p) throws IOException { + Map params) throws IOException { - File launcherIcon = ICON_ICO.fetchFrom(p); + File launcherIcon = ICON_ICO.fetchFrom(params); File icon = launcherIcon != null ? launcherIcon : ICON_ICO.fetchFrom(params); - File iconTarget = getConfig_AppIcon(p); + File iconTarget = getConfig_AppIcon(params); InputStream in = locateResource( APP_NAME.fetchFrom(params) + ".ico", @@ -364,15 +365,15 @@ Files.copy(in, iconTarget.toPath(), StandardCopyOption.REPLACE_EXISTING); - writeCfgFile(p, root.resolve( - getLauncherCfgName(p)).toFile(), "$APPDIR\\runtime"); + writeCfgFile(params, root.resolve( + getLauncherCfgName(params)).toFile(), "$APPDIR\\runtime"); - prepareExecutableProperties(p); + prepareExecutableProperties(params); // Copy executable root folder - Path executableFile = root.resolve(getLauncherName(p)); + Path executableFile = root.resolve(getLauncherName(params)); try (InputStream is_launcher = - getResourceAsStream(getLauncherResourceName(p))) { + getResourceAsStream(getLauncherResourceName(params))) { writeEntry(is_launcher, executableFile); } @@ -380,11 +381,12 @@ launcher.setWritable(true, true); // Update branding of EXE file - if (REBRAND_EXECUTABLE.fetchFrom(p)) { + if (REBRAND_EXECUTABLE.fetchFrom(params)) { try { String tempDirectory = WindowsDefender.getUserTempDirectory(); if (Arguments.CLIOptions.context().userProvidedBuildRoot) { - tempDirectory = TEMP_ROOT.fetchFrom(p).getAbsolutePath(); + tempDirectory = + TEMP_ROOT.fetchFrom(params).getAbsolutePath(); } if (WindowsDefender.isThereAPotentialWindowsDefenderIssue( tempDirectory)) { @@ -400,7 +402,8 @@ launcher.getAbsolutePath()); } - File executableProperties = getConfig_ExecutableProperties(p); + File executableProperties = + getConfig_ExecutableProperties(params); if (executableProperties.exists()) { if (versionSwap(executableProperties.getAbsolutePath(), @@ -416,7 +419,7 @@ } Files.copy(iconTarget.toPath(), - root.resolve(APP_NAME.fetchFrom(p) + ".ico")); + root.resolve(APP_NAME.fetchFrom(params) + ".ico")); } private void copyApplication(Map params) --- old/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Param.java 2019-06-04 11:15:49.381176500 -0400 +++ /dev/null 2019-06-04 11:15:53.000000000 -0400 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.jpackage.internal; - -class Param { - String name; - String value; - - void setName(String name) { - this.name = name; - } - - void setValue(String value) { - this.value = value; - } - -}