--- old/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxAppBundler.java 2019-03-05 14:51:13.968722500 -0500 +++ new/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxAppBundler.java 2019-03-05 14:51:12.720706500 -0500 @@ -44,8 +44,6 @@ public static final BundlerParamInfo ICON_PNG = new StandardBundlerParam<>( - I18N.getString("param.icon-png.name"), - I18N.getString("param.icon-png.description"), "icon.png", File.class, params -> { @@ -61,8 +59,6 @@ public static final BundlerParamInfo LINUX_INSTALL_DIR = new StandardBundlerParam<>( - I18N.getString("param.linux-install-dir.name"), - I18N.getString("param.linux-install-dir.description"), "linux-install-dir", String.class, params -> { @@ -80,8 +76,6 @@ public static final BundlerParamInfo LINUX_PACKAGE_DEPENDENCIES = new StandardBundlerParam<>( - I18N.getString("param.linux-package-dependencies.name"), - I18N.getString("param.linux-package-dependencies.description"), Arguments.CLIOptions.LINUX_PACKAGE_DEPENDENCIES.getId(), String.class, params -> { @@ -131,40 +125,18 @@ File doBundle(Map p, File outputDirectory, boolean dependentTask) throws PackagerException { - if (RUNTIME_INSTALLER.fetchFrom(p)) { - return doJreBundle(p, outputDirectory, dependentTask); + if (StandardBundlerParam.isRuntimeInstaller(p)) { + return PREDEFINED_RUNTIME_IMAGE.fetchFrom(p); } else { return doAppBundle(p, outputDirectory, dependentTask); } } - private File doJreBundle(Map p, - File outputDirectory, boolean dependentTask) throws PackagerException { - try { - File rootDirectory = createRoot(p, outputDirectory, dependentTask, - APP_NAME.fetchFrom(p), "linuxapp-image-builder"); - AbstractAppImageBuilder appBuilder = new LinuxAppImageBuilder( - APP_NAME.fetchFrom(p), outputDirectory.toPath()); - File predefined = PREDEFINED_RUNTIME_IMAGE.fetchFrom(p); - if (predefined == null ) { - JLinkBundlerHelper.generateJre(p, appBuilder); - } else { - return predefined; - } - return rootDirectory; - } catch (PackagerException pe) { - throw pe; - } catch (Exception ex) { - Log.verbose(ex); - throw new PackagerException(ex); - } - } - private File doAppBundle(Map p, File outputDirectory, boolean dependentTask) throws PackagerException { try { File rootDirectory = createRoot(p, outputDirectory, dependentTask, - APP_NAME.fetchFrom(p), "linuxapp-image-builder"); + APP_NAME.fetchFrom(p)); AbstractAppImageBuilder appBuilder = new LinuxAppImageBuilder(p, outputDirectory.toPath()); if (PREDEFINED_RUNTIME_IMAGE.fetchFrom(p) == null ) { --- old/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxAppImageBuilder.java 2019-03-05 14:51:20.427205300 -0500 +++ new/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxAppImageBuilder.java 2019-03-05 14:51:19.397592100 -0500 @@ -65,8 +65,6 @@ public static final BundlerParamInfo ICON_PNG = new StandardBundlerParam<>( - I18N.getString("param.icon-png.name"), - I18N.getString("param.icon-png.description"), "icon.png", File.class, params -> { @@ -191,9 +189,9 @@ writeEntry(is_lib, root.resolve(LIBRARY_NAME)); } - // create the secondary launchers, if any + // create the additional launchers, if any List> entryPoints - = StandardBundlerParam.SECONDARY_LAUNCHERS.fetchFrom(params); + = StandardBundlerParam.ADD_LAUNCHERS.fetchFrom(params); for (Map entryPoint : entryPoints) { Map tmp = new HashMap<>(originalParams); tmp.putAll(entryPoint); --- old/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebBundler.java 2019-03-05 14:51:25.871675100 -0500 +++ new/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebBundler.java 2019-03-05 14:51:24.857662100 -0500 @@ -49,8 +49,6 @@ public static final BundlerParamInfo APP_BUNDLER = new StandardBundlerParam<>( - I18N.getString("param.deb-app-bundler.name"), - I18N.getString("param.deb-app-bundler.description"), "linux.app.bundler", LinuxAppBundler.class, params -> new LinuxAppBundler(), @@ -69,8 +67,6 @@ public static final BundlerParamInfo BUNDLE_NAME = new StandardBundlerParam<> ( - I18N.getString("param.bundle-name.name"), - I18N.getString("param.bundle-name.description"), Arguments.CLIOptions.LINUX_BUNDLE_NAME.getId(), String.class, params -> { @@ -96,8 +92,6 @@ public static final BundlerParamInfo FULL_PACKAGE_NAME = new StandardBundlerParam<> ( - I18N.getString("param.full-package-name.name"), - I18N.getString("param.full-package-name.description"), "linux.deb.fullPackageName", String.class, params -> BUNDLE_NAME.fetchFrom(params) + "-" @@ -106,8 +100,6 @@ public static final BundlerParamInfo DEB_IMAGE_DIR = new StandardBundlerParam<>( - I18N.getString("param.image-dir.name"), - I18N.getString("param.image-dir.description"), "linux.deb.imageDir", File.class, params -> { @@ -120,8 +112,6 @@ public static final BundlerParamInfo APP_IMAGE_ROOT = new StandardBundlerParam<>( - I18N.getString("param.app-image-root.name"), - I18N.getString("param.app-image-root.description"), "linux.deb.imageRoot", File.class, params -> { @@ -132,8 +122,6 @@ public static final BundlerParamInfo CONFIG_DIR = new StandardBundlerParam<>( - I18N.getString("param.config-dir.name"), - I18N.getString("param.config-dir.description"), "linux.deb.configDir", File.class, params -> new File(DEB_IMAGE_DIR.fetchFrom(params), "DEBIAN"), @@ -141,8 +129,6 @@ public static final BundlerParamInfo EMAIL = new StandardBundlerParam<> ( - I18N.getString("param.maintainer-email.name"), - I18N.getString("param.maintainer-email.description"), BundleParams.PARAM_EMAIL, String.class, params -> "Unknown", @@ -150,8 +136,6 @@ public static final BundlerParamInfo MAINTAINER = new StandardBundlerParam<> ( - I18N.getString("param.maintainer-name.name"), - I18N.getString("param.maintainer-name.description"), Arguments.CLIOptions.LINUX_DEB_MAINTAINER.getId(), String.class, params -> VENDOR.fetchFrom(params) + " <" @@ -160,8 +144,6 @@ public static final BundlerParamInfo LICENSE_TEXT = new StandardBundlerParam<> ( - I18N.getString("param.license-text.name"), - I18N.getString("param.license-text.description"), "linux.deb.licenseText", String.class, params -> { @@ -179,8 +161,6 @@ public static final BundlerParamInfo XDG_FILE_PREFIX = new StandardBundlerParam<> ( - I18N.getString("param.xdg-prefix.name"), - I18N.getString("param.xdg-prefix.description"), "linux.xdg-prefix", String.class, params -> { @@ -201,6 +181,14 @@ }, (s, p) -> s); + public static final BundlerParamInfo MENU_GROUP = + new StandardBundlerParam<>( + Arguments.CLIOptions.LINUX_MENU_GROUP.getId(), + String.class, + params -> I18N.getString("param.menu-group.default"), + (s, p) -> s + ); + private final static String DEFAULT_ICON = "javalogo_white_32.png"; private final static String DEFAULT_CONTROL_TEMPLATE = "template.control"; private final static String DEFAULT_PRERM_TEMPLATE = "template.prerm"; @@ -410,7 +398,7 @@ File iconTarget = getConfig_IconFile(rootDir, params); File icon = ICON_PNG.fetchFrom(params); - if (!RUNTIME_INSTALLER.fetchFrom(params)) { + if (!StandardBundlerParam.isRuntimeInstaller(params)) { // prepare installer icon if (icon == null || !icon.exists()) { fetchResource(iconTarget.getName(), @@ -431,25 +419,25 @@ StringBuilder installScripts = new StringBuilder(); StringBuilder removeScripts = new StringBuilder(); - for (Map secondaryLauncher : - SECONDARY_LAUNCHERS.fetchFrom(params)) { - Map secondaryLauncherData = - createReplacementData(secondaryLauncher); - secondaryLauncherData.put("APPLICATION_FS_NAME", + for (Map addLauncher : + ADD_LAUNCHERS.fetchFrom(params)) { + Map addLauncherData = + createReplacementData(addLauncher); + addLauncherData.put("APPLICATION_FS_NAME", data.get("APPLICATION_FS_NAME")); - secondaryLauncherData.put("DESKTOP_MIMES", ""); + addLauncherData.put("DESKTOP_MIMES", ""); - if (!RUNTIME_INSTALLER.fetchFrom(params)) { + if (!StandardBundlerParam.isRuntimeInstaller(params)) { // prepare desktop shortcut Writer w = new BufferedWriter(new FileWriter( getConfig_DesktopShortcutFile( - rootDir, secondaryLauncher))); + rootDir, addLauncher))); String content = preprocessTextResource( getConfig_DesktopShortcutFile(rootDir, - secondaryLauncher).getName(), + addLauncher).getName(), I18N.getString("resource.menu-shortcut-descriptor"), DEFAULT_DESKTOP_FILE_TEMPLATE, - secondaryLauncherData, + addLauncherData, VERBOSE.fetchFrom(params), RESOURCE_DIR.fetchFrom(params)); w.write(content); @@ -457,8 +445,8 @@ } // prepare installer icon - iconTarget = getConfig_IconFile(rootDir, secondaryLauncher); - icon = ICON_PNG.fetchFrom(secondaryLauncher); + iconTarget = getConfig_IconFile(rootDir, addLauncher); + icon = ICON_PNG.fetchFrom(addLauncher); if (icon == null || !icon.exists()) { fetchResource(iconTarget.getName(), I18N.getString("resource.menu-icon"), @@ -483,7 +471,7 @@ installScripts.append(data.get("APPLICATION_FS_NAME")); installScripts.append("/"); installScripts.append( - secondaryLauncherData.get("APPLICATION_LAUNCHER_FILENAME")); + addLauncherData.get("APPLICATION_LAUNCHER_FILENAME")); installScripts.append(".desktop\n"); // postrm cleanup of desktop icon @@ -494,11 +482,11 @@ removeScripts.append(data.get("APPLICATION_FS_NAME")); removeScripts.append("/"); removeScripts.append( - secondaryLauncherData.get("APPLICATION_LAUNCHER_FILENAME")); + addLauncherData.get("APPLICATION_LAUNCHER_FILENAME")); removeScripts.append(".desktop\n"); } - data.put("SECONDARY_LAUNCHERS_INSTALL", installScripts.toString()); - data.put("SECONDARY_LAUNCHERS_REMOVE", removeScripts.toString()); + data.put("ADD_LAUNCHERS_INSTALL", installScripts.toString()); + data.put("ADD_LAUNCHERS_REMOVE", removeScripts.toString()); List> associations = FILE_ASSOCIATIONS.fetchFrom(params); @@ -640,7 +628,7 @@ } } - if (!RUNTIME_INSTALLER.fetchFrom(params)) { + if (!StandardBundlerParam.isRuntimeInstaller(params)) { //prepare desktop shortcut Writer w = new BufferedWriter(new FileWriter( getConfig_DesktopShortcutFile(rootDir, params))); @@ -745,7 +733,7 @@ data.put("APPLICATION_LAUNCHER_FILENAME", APP_NAME.fetchFrom(params)); data.put("INSTALLATION_DIRECTORY", LINUX_INSTALL_DIR.fetchFrom(params)); data.put("XDG_PREFIX", XDG_FILE_PREFIX.fetchFrom(params)); - data.put("DEPLOY_BUNDLE_CATEGORY", CATEGORY.fetchFrom(params)); + data.put("DEPLOY_BUNDLE_CATEGORY", MENU_GROUP.fetchFrom(params)); data.put("APPLICATION_DESCRIPTION", DESCRIPTION.fetchFrom(params)); data.put("APPLICATION_SUMMARY", TITLE.fetchFrom(params)); data.put("APPLICATION_COPYRIGHT", COPYRIGHT.fetchFrom(params)); @@ -756,8 +744,8 @@ String deps = LINUX_PACKAGE_DEPENDENCIES.fetchFrom(params); data.put("PACKAGE_DEPENDENCIES", deps.isEmpty() ? "" : "Depends: " + deps); - data.put("RUNTIME_INSTALLER", - RUNTIME_INSTALLER.fetchFrom(params).toString()); + data.put("RUNTIME_INSTALLER", "" + + StandardBundlerParam.isRuntimeInstaller(params)); return data; } @@ -857,7 +845,7 @@ return Arrays.asList( BUNDLE_NAME, COPYRIGHT, - CATEGORY, + MENU_GROUP, DESCRIPTION, EMAIL, ICON_PNG, --- old/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxRpmBundler.java 2019-03-05 14:51:31.191343300 -0500 +++ new/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxRpmBundler.java 2019-03-05 14:51:30.146129900 -0500 @@ -49,8 +49,6 @@ public static final BundlerParamInfo APP_BUNDLER = new StandardBundlerParam<>( - I18N.getString("param.rpm-app-bundler.name"), - I18N.getString("param.rpm-app-bundler.description"), "linux.app.bundler", LinuxAppBundler.class, params -> new LinuxAppBundler(), @@ -58,8 +56,6 @@ public static final BundlerParamInfo RPM_IMAGE_DIR = new StandardBundlerParam<>( - I18N.getString("param.image-dir.name"), - I18N.getString("param.image-dir.description"), "linux.rpm.imageDir", File.class, params -> { @@ -82,8 +78,6 @@ public static final BundlerParamInfo BUNDLE_NAME = new StandardBundlerParam<> ( - I18N.getString("param.bundle-name.name"), - I18N.getString("param.bundle-name.description"), Arguments.CLIOptions.LINUX_BUNDLE_NAME.getId(), String.class, params -> { @@ -108,10 +102,16 @@ } ); + public static final BundlerParamInfo MENU_GROUP = + new StandardBundlerParam<>( + Arguments.CLIOptions.LINUX_MENU_GROUP.getId(), + String.class, + params -> I18N.getString("param.menu-group.default"), + (s, p) -> s + ); + public static final BundlerParamInfo LICENSE_TYPE = new StandardBundlerParam<>( - I18N.getString("param.license-type.name"), - I18N.getString("param.license-type.description"), Arguments.CLIOptions.LINUX_RPM_LICENSE_TYPE.getId(), String.class, params -> I18N.getString("param.license-type.default"), @@ -120,8 +120,6 @@ public static final BundlerParamInfo XDG_FILE_PREFIX = new StandardBundlerParam<> ( - I18N.getString("param.xdg-prefix.name"), - I18N.getString("param.xdg-prefix.description"), "linux.xdg-prefix", String.class, params -> { @@ -316,7 +314,7 @@ // prepare installer icon File iconTarget = getConfig_IconFile(rootDir, params); File icon = LinuxAppBundler.ICON_PNG.fetchFrom(params); - if (!RUNTIME_INSTALLER.fetchFrom(params)) { + if (!StandardBundlerParam.isRuntimeInstaller(params)) { if (icon == null || !icon.exists()) { fetchResource(iconTarget.getName(), I18N.getString("resource.menu-icon"), @@ -336,30 +334,30 @@ StringBuilder installScripts = new StringBuilder(); StringBuilder removeScripts = new StringBuilder(); - for (Map secondaryLauncher : - SECONDARY_LAUNCHERS.fetchFrom(params)) { - Map secondaryLauncherData = - createReplacementData(secondaryLauncher); - secondaryLauncherData.put("APPLICATION_FS_NAME", + for (Map addLauncher : + ADD_LAUNCHERS.fetchFrom(params)) { + Map addLauncherData = + createReplacementData(addLauncher); + addLauncherData.put("APPLICATION_FS_NAME", data.get("APPLICATION_FS_NAME")); - secondaryLauncherData.put("DESKTOP_MIMES", ""); + addLauncherData.put("DESKTOP_MIMES", ""); // prepare desktop shortcut Writer w = new BufferedWriter(new FileWriter( - getConfig_DesktopShortcutFile(rootDir, secondaryLauncher))); + getConfig_DesktopShortcutFile(rootDir, addLauncher))); String content = preprocessTextResource( getConfig_DesktopShortcutFile(rootDir, - secondaryLauncher).getName(), + addLauncher).getName(), I18N.getString("resource.menu-shortcut-descriptor"), - DEFAULT_DESKTOP_FILE_TEMPLATE, secondaryLauncherData, + DEFAULT_DESKTOP_FILE_TEMPLATE, addLauncherData, VERBOSE.fetchFrom(params), RESOURCE_DIR.fetchFrom(params)); w.write(content); w.close(); // prepare installer icon - iconTarget = getConfig_IconFile(rootDir, secondaryLauncher); - icon = LinuxAppBundler.ICON_PNG.fetchFrom(secondaryLauncher); + iconTarget = getConfig_IconFile(rootDir, addLauncher); + icon = LinuxAppBundler.ICON_PNG.fetchFrom(addLauncher); if (icon == null || !icon.exists()) { fetchResource(iconTarget.getName(), I18N.getString("resource.menu-icon"), @@ -382,7 +380,7 @@ installScripts.append("/"); installScripts.append(data.get("APPLICATION_FS_NAME")); installScripts.append("/"); - installScripts.append(secondaryLauncherData.get( + installScripts.append(addLauncherData.get( "APPLICATION_LAUNCHER_FILENAME")); installScripts.append(".desktop\n"); @@ -392,13 +390,13 @@ removeScripts.append("/"); removeScripts.append(data.get("APPLICATION_FS_NAME")); removeScripts.append("/"); - removeScripts.append(secondaryLauncherData.get( + removeScripts.append(addLauncherData.get( "APPLICATION_LAUNCHER_FILENAME")); removeScripts.append(".desktop\n"); } - data.put("SECONDARY_LAUNCHERS_INSTALL", installScripts.toString()); - data.put("SECONDARY_LAUNCHERS_REMOVE", removeScripts.toString()); + data.put("ADD_LAUNCHERS_INSTALL", installScripts.toString()); + data.put("ADD_LAUNCHERS_REMOVE", removeScripts.toString()); StringBuilder cdsScript = new StringBuilder(); @@ -544,7 +542,7 @@ } } - if (!RUNTIME_INSTALLER.fetchFrom(params)) { + if (!StandardBundlerParam.isRuntimeInstaller(params)) { //prepare desktop shortcut Writer w = new BufferedWriter(new FileWriter( getConfig_DesktopShortcutFile(rootDir, params))); @@ -585,7 +583,7 @@ data.put("APPLICATION_LAUNCHER_FILENAME", APP_NAME.fetchFrom(params)); data.put("INSTALLATION_DIRECTORY", LINUX_INSTALL_DIR.fetchFrom(params)); data.put("XDG_PREFIX", XDG_FILE_PREFIX.fetchFrom(params)); - data.put("DEPLOY_BUNDLE_CATEGORY", CATEGORY.fetchFrom(params)); + data.put("DEPLOY_BUNDLE_CATEGORY", MENU_GROUP.fetchFrom(params)); // TODO rpm categories data.put("APPLICATION_DESCRIPTION", DESCRIPTION.fetchFrom(params)); data.put("APPLICATION_SUMMARY", TITLE.fetchFrom(params)); @@ -594,8 +592,8 @@ String deps = LINUX_PACKAGE_DEPENDENCIES.fetchFrom(params); data.put("PACKAGE_DEPENDENCIES", deps.isEmpty() ? "" : "Requires: " + deps); - data.put("RUNTIME_INSTALLER", - RUNTIME_INSTALLER.fetchFrom(params).toString()); + data.put("RUNTIME_INSTALLER", "" + + StandardBundlerParam.isRuntimeInstaller(params)); return data; } @@ -620,7 +618,7 @@ "message.outputting-bundle-location"), outdir.getAbsolutePath())); - File broot = new File(BUILD_ROOT.fetchFrom(params), "rmpbuildroot"); + File broot = new File(TEMP_ROOT.fetchFrom(params), "rmpbuildroot"); outdir.mkdirs(); @@ -691,7 +689,7 @@ public static Collection> getRpmBundleParameters() { return Arrays.asList( BUNDLE_NAME, - CATEGORY, + MENU_GROUP, DESCRIPTION, LinuxAppBundler.ICON_PNG, LICENSE_FILE, --- old/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources.properties 2019-03-05 14:51:36.339409300 -0500 +++ new/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources.properties 2019-03-05 14:51:35.294195900 -0500 @@ -24,44 +24,8 @@ # # -app.bundler.name=Linux Application Image -app.bundler.description=A Directory based image of a linux Application with an optionally co-bundled JRE. Used as a base for the Installer bundlers. -deb.bundler.name=DEB Installer -deb.bundler.description=Linux Debian Bundle. -rpm.bundler.name=RPM Bundle -rpm.bundler.description=Redhat Package Manager (RPM) bundler. - -param.icon-png.name=.png Icon -param.icon-png.description=Icon for the application, in PNG format. -param.linux-install-dir.name=Linux Installation Directory -param.linux-install-dir.description=Installation directory of the application on Linux. -param.linux-package-dependencies.name=Linux Package Dependencies -param.linux-package-dependencies.description=Required packages or capabilities for the application. -param.deb-app-bundler.name=DEB Bundler Name -param.deb-app-bundler.description=DEB Bundler Name -param.full-package-name.name=Deb Package Name -param.full-package-name.description=Deb Package Name -param.image-dir.name=Image Dir -param.image-dir.description=Image Dir -param.app-image-root.name=Image Root Dir -param.app-image-root.description=Image Root Dir -param.config-dir.name=Config Dir -param.config-dir.description=Config Dir -param.maintainer-email.name=DEB Maintainer Email -param.maintainer-email.description=DEB Maintainer Email -param.maintainer-name.name=DEB Maintainer Name -param.maintainer-name.description=DEB Maintainer Name -param.license-type.name=License Type -param.license-type.description=License Type param.license-type.default=Unknown -param.license-text.name=License Content -param.license-text.description=License Content -param.xdg-prefix.name=Prefix for XDG files (mime, desktop) -param.xdg-prefix.description=Prefix for XDG MimeInfo and Desktop Files. Defaults to -, with spaces dropped. -param.rpm-app-bundler.name=RPM Bundler -param.rpm-app-bundler.description=RPM Bundler -param.bundle-name.name=RPM Bundle -param.bundle-name.description=RPM Bundle +param.menu-group.default=Unknown resource.deb-control-file=DEB control file resource.deb-preinstall-script=DEB preinstall script --- old/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_ja.properties 2019-03-05 14:51:41.534275900 -0500 +++ new/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_ja.properties 2019-03-05 14:51:40.520262900 -0500 @@ -24,44 +24,8 @@ # # -app.bundler.name=Linux Application Image -app.bundler.description=A Directory based image of a linux Application with an optionally co-bundled JRE. Used as a base for the Installer bundlers. -deb.bundler.name=DEB Installer -deb.bundler.description=Linux Debian Bundle. -rpm.bundler.name=RPM Bundle -rpm.bundler.description=Redhat Package Manager (RPM) bundler. - -param.icon-png.name=.png Icon -param.icon-png.description=Icon for the application, in PNG format. -param.linux-install-dir.name=Linux Installation Directory -param.linux-install-dir.description=Installation directory of the application on Linux. -param.linux-package-dependencies.name=Linux Package Dependencies -param.linux-package-dependencies.description=Required packages or capabilities for the application. -param.deb-app-bundler.name=DEB Bundler Name -param.deb-app-bundler.description=DEB Bundler Name -param.full-package-name.name=Deb Package Name -param.full-package-name.description=Deb Package Name -param.image-dir.name=Image Dir -param.image-dir.description=Image Dir -param.app-image-root.name=Image Root Dir -param.app-image-root.description=Image Root Dir -param.config-dir.name=Config Dir -param.config-dir.description=Config Dir -param.maintainer-email.name=DEB Maintainer Email -param.maintainer-email.description=DEB Maintainer Email -param.maintainer-name.name=DEB Maintainer Name -param.maintainer-name.description=DEB Maintainer Name -param.license-type.name=License Type -param.license-type.description=License Type param.license-type.default=Unknown -param.license-text.name=License Content -param.license-text.description=License Content -param.xdg-prefix.name=Prefix for XDG files (mime, desktop) -param.xdg-prefix.description=Prefix for XDG MimeInfo and Desktop Files. Defaults to -, with spaces dropped. -param.rpm-app-bundler.name=RPM Bundler -param.rpm-app-bundler.description=RPM Bundler -param.bundle-name.name=RPM Bundle -param.bundle-name.description=RPM Bundle +param.menu-group.default=Unknown resource.deb-control-file=DEB control file resource.deb-preinstall-script=DEB preinstall script --- old/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_zh_CN.properties 2019-03-05 14:51:46.713542300 -0500 +++ new/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_zh_CN.properties 2019-03-05 14:51:45.699529300 -0500 @@ -24,44 +24,8 @@ # # -app.bundler.name=Linux Application Image -app.bundler.description=A Directory based image of a linux Application with an optionally co-bundled JRE. Used as a base for the Installer bundlers. -deb.bundler.name=DEB Installer -deb.bundler.description=Linux Debian Bundle. -rpm.bundler.name=RPM Bundle -rpm.bundler.description=Redhat Package Manager (RPM) bundler. - -param.icon-png.name=.png Icon -param.icon-png.description=Icon for the application, in PNG format. -param.linux-install-dir.name=Linux Installation Directory -param.linux-install-dir.description=Installation directory of the application on Linux. -param.linux-package-dependencies.name=Linux Package Dependencies -param.linux-package-dependencies.description=Required packages or capabilities for the application. -param.deb-app-bundler.name=DEB Bundler Name -param.deb-app-bundler.description=DEB Bundler Name -param.full-package-name.name=Deb Package Name -param.full-package-name.description=Deb Package Name -param.image-dir.name=Image Dir -param.image-dir.description=Image Dir -param.app-image-root.name=Image Root Dir -param.app-image-root.description=Image Root Dir -param.config-dir.name=Config Dir -param.config-dir.description=Config Dir -param.maintainer-email.name=DEB Maintainer Email -param.maintainer-email.description=DEB Maintainer Email -param.maintainer-name.name=DEB Maintainer Name -param.maintainer-name.description=DEB Maintainer Name -param.license-type.name=License Type -param.license-type.description=License Type param.license-type.default=Unknown -param.license-text.name=License Content -param.license-text.description=License Content -param.xdg-prefix.name=Prefix for XDG files (mime, desktop) -param.xdg-prefix.description=Prefix for XDG MimeInfo and Desktop Files. Defaults to -, with spaces dropped. -param.rpm-app-bundler.name=RPM Bundler -param.rpm-app-bundler.description=RPM Bundler -param.bundle-name.name=RPM Bundle -param.bundle-name.description=RPM Bundle +param.menu-group.default=Unknown resource.deb-control-file=DEB control file resource.deb-preinstall-script=DEB preinstall script --- old/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/template.postinst 2019-03-05 14:51:51.939609300 -0500 +++ new/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/template.postinst 2019-03-05 14:51:50.894395900 -0500 @@ -21,7 +21,7 @@ configure) if [ "RUNTIME_INSTALLER" != "true" ]; then echo Adding shortcut to the menu -SECONDARY_LAUNCHERS_INSTALL +ADD_LAUNCHERS_INSTALL xdg-desktop-menu install --novendor INSTALLATION_DIRECTORY/APPLICATION_FS_NAME/APPLICATION_LAUNCHER_FILENAME.desktop FILE_ASSOCIATION_INSTALL fi --- old/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/template.prerm 2019-03-05 14:51:57.181276500 -0500 +++ new/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/template.prerm 2019-03-05 14:51:56.167263500 -0500 @@ -21,7 +21,7 @@ remove|upgrade|deconfigure) if [ "RUNTIME_INSTALLER" != "true" ]; then echo Removing shortcut -SECONDARY_LAUNCHERS_REMOVE +ADD_LAUNCHERS_REMOVE xdg-desktop-menu uninstall --novendor INSTALLATION_DIRECTORY/APPLICATION_FS_NAME/APPLICATION_LAUNCHER_FILENAME.desktop FILE_ASSOCIATION_REMOVE fi --- old/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/template.spec 2019-03-05 14:52:02.407343500 -0500 +++ new/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/template.spec 2019-03-05 14:52:01.393330500 -0500 @@ -36,14 +36,14 @@ %post if [ "RUNTIME_INSTALLER" != "true" ]; then -SECONDARY_LAUNCHERS_INSTALL +ADD_LAUNCHERS_INSTALL xdg-desktop-menu install --novendor INSTALLATION_DIRECTORY/APPLICATION_FS_NAME/APPLICATION_LAUNCHER_FILENAME.desktop FILE_ASSOCIATION_INSTALL fi %preun if [ "RUNTIME_INSTALLER" != "true" ]; then -SECONDARY_LAUNCHERS_REMOVE +ADD_LAUNCHERS_REMOVE xdg-desktop-menu uninstall --novendor INSTALLATION_DIRECTORY/APPLICATION_FS_NAME/APPLICATION_LAUNCHER_FILENAME.desktop FILE_ASSOCIATION_REMOVE fi --- old/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppBundler.java 2019-03-05 14:52:08.007815300 -0500 +++ new/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppBundler.java 2019-03-05 14:52:06.962601900 -0500 @@ -47,7 +47,7 @@ private static final String TEMPLATE_BUNDLE_ICON = "GenericApp.icns"; - private static Map getMacCategories() { + public static Map getMacCategories() { Map map = new HashMap<>(); map.put("Business", "public.app-category.business"); map.put("Developer Tools", "public.app-category.developer-tools"); @@ -97,13 +97,9 @@ public static final EnumeratedBundlerParam MAC_CATEGORY = new EnumeratedBundlerParam<>( - I18N.getString("param.category-name"), - I18N.getString("param.category-name.description"), Arguments.CLIOptions.MAC_APP_STORE_CATEGORY.getId(), String.class, - params -> params.containsKey(CATEGORY.getID()) - ? CATEGORY.fetchFrom(params) - : "Unknown", + params -> "Unknown", (s, p) -> s, getMacCategories(), false //strict - for MacStoreBundler this should be strict @@ -111,8 +107,6 @@ public static final BundlerParamInfo MAC_CF_BUNDLE_NAME = new StandardBundlerParam<>( - I18N.getString("param.cfbundle-name.name"), - I18N.getString("param.cfbundle-name.description"), Arguments.CLIOptions.MAC_BUNDLE_NAME.getId(), String.class, params -> null, @@ -120,8 +114,6 @@ public static final BundlerParamInfo MAC_CF_BUNDLE_IDENTIFIER = new StandardBundlerParam<>( - I18N.getString("param.cfbundle-identifier.name"), - I18N.getString("param.cfbundle-identifier.description"), Arguments.CLIOptions.MAC_BUNDLE_IDENTIFIER.getId(), String.class, IDENTIFIER::fetchFrom, @@ -129,8 +121,6 @@ public static final BundlerParamInfo MAC_CF_BUNDLE_VERSION = new StandardBundlerParam<>( - I18N.getString("param.cfbundle-version.name"), - I18N.getString("param.cfbundle-version.description"), "mac.CFBundleVersion", String.class, p -> { @@ -145,8 +135,6 @@ public static final BundlerParamInfo DEFAULT_ICNS_ICON = new StandardBundlerParam<>( - I18N.getString("param.default-icon-icns"), - I18N.getString("param.default-icon-icns.description"), ".mac.default.icns", String.class, params -> TEMPLATE_BUNDLE_ICON, @@ -154,8 +142,6 @@ public static final BundlerParamInfo DEVELOPER_ID_APP_SIGNING_KEY = new StandardBundlerParam<>( - I18N.getString("param.signing-key-developer-id-app.name"), - I18N.getString("param.signing-key-developer-id-app.description"), "mac.signing-key-developer-id-app", String.class, params -> { @@ -180,8 +166,6 @@ public static final BundlerParamInfo BUNDLE_ID_SIGNING_PREFIX = new StandardBundlerParam<>( - I18N.getString("param.bundle-id-signing-prefix.name"), - I18N.getString("param.bundle-id-signing-prefix.description"), Arguments.CLIOptions.MAC_BUNDLE_SIGNING_PREFIX.getId(), String.class, params -> IDENTIFIER.fetchFrom(params) + ".", @@ -189,8 +173,6 @@ public static final BundlerParamInfo ICON_ICNS = new StandardBundlerParam<>( - I18N.getString("param.icon-icns.name"), - I18N.getString("param.icon-icns.description"), "icon.icns", File.class, params -> { @@ -306,40 +288,18 @@ File doBundle(Map p, File outputDirectory, boolean dependentTask) throws PackagerException { - if (RUNTIME_INSTALLER.fetchFrom(p)) { - return doJreBundle(p, outputDirectory, dependentTask); + if (StandardBundlerParam.isRuntimeInstaller(p)) { + return PREDEFINED_RUNTIME_IMAGE.fetchFrom(p); } else { return doAppBundle(p, outputDirectory, dependentTask); } } - File doJreBundle(Map p, File outputDirectory, - boolean dependentTask) throws PackagerException { - try { - File rootDirectory = createRoot(p, outputDirectory, dependentTask, - APP_NAME.fetchFrom(p), "macapp-image-builder"); - AbstractAppImageBuilder appBuilder = new MacAppImageBuilder(p, - APP_NAME.fetchFrom(p), outputDirectory.toPath()); - File predefined = PREDEFINED_RUNTIME_IMAGE.fetchFrom(p); - if (predefined == null ) { - JLinkBundlerHelper.generateJre(p, appBuilder); - } else { - return predefined; - } - return rootDirectory; - } catch (PackagerException pe) { - throw pe; - } catch (Exception ex) { - Log.verbose(ex); - throw new PackagerException(ex); - } - } - File doAppBundle(Map p, File outputDirectory, boolean dependentTask) throws PackagerException { try { File rootDirectory = createRoot(p, outputDirectory, dependentTask, - APP_NAME.fetchFrom(p) + ".app", "macapp-image-builder"); + APP_NAME.fetchFrom(p) + ".app"); AbstractAppImageBuilder appBuilder = new MacAppImageBuilder(p, outputDirectory.toPath()); if (PREDEFINED_RUNTIME_IMAGE.fetchFrom(p) == null ) { --- old/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java 2019-03-05 14:52:13.405484500 -0500 +++ new/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java 2019-03-05 14:52:12.360271100 -0500 @@ -88,28 +88,23 @@ public static final BundlerParamInfo MAC_CONFIGURE_LAUNCHER_IN_PLIST = new StandardBundlerParam<>( - I18N.getString("param.configure-launcher-in-plist"), - I18N.getString( - "param.configure-launcher-in-plist.description"), "mac.configure-launcher-in-plist", Boolean.class, params -> Boolean.FALSE, (s, p) -> Boolean.valueOf(s)); - public static final BundlerParamInfo MAC_CATEGORY = - new StandardBundlerParam<>( - I18N.getString("param.category-name"), - I18N.getString("param.category-name.description"), - "mac.category", + public static final EnumeratedBundlerParam MAC_CATEGORY = + new EnumeratedBundlerParam<>( + Arguments.CLIOptions.MAC_APP_STORE_CATEGORY.getId(), String.class, - CATEGORY::fetchFrom, - (s, p) -> s + params -> "Unknown", + (s, p) -> s, + MacAppBundler.getMacCategories(), + false //strict - for MacStoreBundler this should be strict ); public static final BundlerParamInfo MAC_CF_BUNDLE_NAME = new StandardBundlerParam<>( - I18N.getString("param.cfbundle-name.name"), - I18N.getString("param.cfbundle-name.description"), "mac.CFBundleName", String.class, params -> null, @@ -117,8 +112,6 @@ public static final BundlerParamInfo MAC_CF_BUNDLE_IDENTIFIER = new StandardBundlerParam<>( - I18N.getString("param.cfbundle-identifier.name"), - I18N.getString("param.cfbundle-identifier.description"), Arguments.CLIOptions.MAC_BUNDLE_IDENTIFIER.getId(), String.class, IDENTIFIER::fetchFrom, @@ -126,8 +119,6 @@ public static final BundlerParamInfo MAC_CF_BUNDLE_VERSION = new StandardBundlerParam<>( - I18N.getString("param.cfbundle-version.name"), - I18N.getString("param.cfbundle-version.description"), "mac.CFBundleVersion", String.class, p -> { @@ -142,8 +133,6 @@ public static final BundlerParamInfo DEFAULT_ICNS_ICON = new StandardBundlerParam<>( - I18N.getString("param.default-icon-icns"), - I18N.getString("param.default-icon-icns.description"), ".mac.default.icns", String.class, params -> TEMPLATE_BUNDLE_ICON, @@ -151,8 +140,6 @@ public static final BundlerParamInfo ICON_ICNS = new StandardBundlerParam<>( - I18N.getString("param.icon-icns.name"), - I18N.getString("param.icon-icns.description"), "icon.icns", File.class, params -> { @@ -168,8 +155,6 @@ public static final StandardBundlerParam SIGN_BUNDLE = new StandardBundlerParam<>( - I18N.getString("param.sign-bundle.name"), - I18N.getString("param.sign-bundle.description"), Arguments.CLIOptions.MAC_SIGN.getId(), Boolean.class, params -> false, @@ -334,21 +319,21 @@ File cfg = new File(root.toFile(), getLauncherCfgName(params)); writeCfgFile(params, cfg, "$APPDIR/PlugIns/Java.runtime"); - // create secondary app launcher(s) and config file(s) + // create additional app launcher(s) and config file(s) List> entryPoints = - StandardBundlerParam.SECONDARY_LAUNCHERS.fetchFrom(params); + StandardBundlerParam.ADD_LAUNCHERS.fetchFrom(params); for (Map entryPoint : entryPoints) { Map tmp = new HashMap<>(originalParams); tmp.putAll(entryPoint); - // add executable for secondary launcher - Path secondaryExecutable = macOSDir.resolve(getLauncherName(tmp)); + // add executable for add launcher + Path addExecutable = macOSDir.resolve(getLauncherName(tmp)); try (InputStream is = getResourceAsStream("jpackageapplauncher");) { - writeEntry(is, secondaryExecutable); + writeEntry(is, addExecutable); } - secondaryExecutable.toFile().setExecutable(true, false); + addExecutable.toFile().setExecutable(true, false); - // add config file for secondary launcher + // add config file for add launcher cfg = new File(root.toFile(), getLauncherCfgName(tmp)); writeCfgFile(tmp, cfg, "$APPDIR/PlugIns/Java.runtime"); } @@ -481,11 +466,11 @@ private void writeRuntimeInfoPlist(File file) throws IOException { Map data = new HashMap<>(); - String identifier = RUNTIME_INSTALLER.fetchFrom(params) ? + String identifier = StandardBundlerParam.isRuntimeInstaller(params) ? MAC_CF_BUNDLE_IDENTIFIER.fetchFrom(params) : "com.oracle.java." + MAC_CF_BUNDLE_IDENTIFIER.fetchFrom(params); data.put("CF_BUNDLE_IDENTIFIER", identifier); - String name = RUNTIME_INSTALLER.fetchFrom(params) ? + String name = StandardBundlerParam.isRuntimeInstaller(params) ? getBundleName(params): "Java Runtime Image"; data.put("CF_BUNDLE_NAME", name); data.put("CF_BUNDLE_VERSION", VERSION.fetchFrom(params)); --- old/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppStoreBundler.java 2019-03-05 14:52:18.959155700 -0500 +++ new/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppStoreBundler.java 2019-03-05 14:52:17.945142700 -0500 @@ -54,8 +54,6 @@ public static final BundlerParamInfo MAC_APP_STORE_APP_SIGNING_KEY = new StandardBundlerParam<>( - I18N.getString("param.signing-key-app.name"), - I18N.getString("param.signing-key-app.description"), "mac.signing-key-app", String.class, params -> { @@ -81,8 +79,6 @@ public static final BundlerParamInfo MAC_APP_STORE_PKG_SIGNING_KEY = new StandardBundlerParam<>( - I18N.getString("param.signing-key-pkg.name"), - I18N.getString("param.signing-key-pkg.description"), "mac.signing-key-pkg", String.class, params -> { @@ -109,8 +105,6 @@ public static final StandardBundlerParam MAC_APP_STORE_ENTITLEMENTS = new StandardBundlerParam<>( - I18N.getString("param.mac-app-store-entitlements.name"), - I18N.getString("param.mac-app-store-entitlements.description"), Arguments.CLIOptions.MAC_APP_STORE_ENTITLEMENTS.getId(), File.class, params -> null, @@ -118,8 +112,6 @@ public static final BundlerParamInfo INSTALLER_SUFFIX = new StandardBundlerParam<> ( - I18N.getString("param.installer-suffix.name"), - I18N.getString("param.installer-suffix.description"), "mac.app-store.installerName.suffix", String.class, params -> "-MacAppStore", @@ -146,7 +138,7 @@ p.put(DEFAULT_ICNS_ICON.getID(), TEMPLATE_BUNDLE_ICON_HIDPI); // now we create the app - File appImageDir = APP_IMAGE_BUILD_ROOT.fetchFrom(p); + File appImageDir = APP_IMAGE_TEMP_ROOT.fetchFrom(p); try { appImageDir.mkdirs(); @@ -369,7 +361,8 @@ @Override public boolean supported(boolean runtimeInstaller) { - return (!runtimeInstaller && - Platform.getPlatform() == Platform.MAC); + // return (!runtimeInstaller && + // Platform.getPlatform() == Platform.MAC); + return false; // mac-app-store not yet supported } } --- old/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBaseInstallerBundler.java 2019-03-05 14:52:24.185222700 -0500 +++ new/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBaseInstallerBundler.java 2019-03-05 14:52:23.155609500 -0500 @@ -51,17 +51,13 @@ // This could be generalized more to be for any type of Image Bundler public static final BundlerParamInfo APP_BUNDLER = new StandardBundlerParam<>( - I18N.getString("param.app-bundler.name"), - I18N.getString("param.app-bundle.description"), "mac.app.bundler", MacAppBundler.class, params -> new MacAppBundler(), (s, p) -> null); - public final BundlerParamInfo APP_IMAGE_BUILD_ROOT = + public final BundlerParamInfo APP_IMAGE_TEMP_ROOT = new StandardBundlerParam<>( - I18N.getString("param.app-image-build-root.name"), - I18N.getString("param.app-image-build-root.description"), "mac.app.imageRoot", File.class, params -> { @@ -78,8 +74,6 @@ public static final BundlerParamInfo SIGNING_KEY_USER = new StandardBundlerParam<>( - I18N.getString("param.signing-key-name.name"), - I18N.getString("param.signing-key-name.description"), Arguments.CLIOptions.MAC_SIGNING_KEY_NAME.getId(), String.class, params -> "", @@ -87,8 +81,6 @@ public static final BundlerParamInfo SIGNING_KEYCHAIN = new StandardBundlerParam<>( - I18N.getString("param.signing-keychain.name"), - I18N.getString("param.signing-keychain.description"), Arguments.CLIOptions.MAC_SIGNING_KEYCHAIN.getId(), String.class, params -> "", @@ -96,8 +88,6 @@ public static final BundlerParamInfo INSTALLER_NAME = new StandardBundlerParam<> ( - I18N.getString("param.installer-name.name"), - I18N.getString("param.installer-name.description"), "mac.installerName", String.class, params -> { @@ -151,7 +141,7 @@ if (predefinedImage != null) { return predefinedImage; } - File appImageRoot = APP_IMAGE_BUILD_ROOT.fetchFrom(p); + File appImageRoot = APP_IMAGE_TEMP_ROOT.fetchFrom(p); if (pkg) { // create pkg in dmg return new MacPkgBundler().bundle(p, appImageRoot); @@ -168,7 +158,7 @@ results.addAll(Arrays.asList( APP_BUNDLER, CONFIG_ROOT, - APP_IMAGE_BUILD_ROOT, + APP_IMAGE_TEMP_ROOT, PREDEFINED_APP_IMAGE )); --- old/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgBundler.java 2019-03-05 14:52:29.972896900 -0500 +++ new/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgBundler.java 2019-03-05 14:52:28.943283700 -0500 @@ -45,8 +45,6 @@ public static final BundlerParamInfo INSTALLER_SUFFIX = new StandardBundlerParam<> ( - I18N.getString("param.installer-suffix.name"), - I18N.getString("param.installer-suffix.description"), "mac.dmg.installerName.suffix", String.class, params -> "", @@ -67,7 +65,7 @@ outdir.getAbsolutePath()); } - File appImageDir = APP_IMAGE_BUILD_ROOT.fetchFrom(params); + File appImageDir = APP_IMAGE_TEMP_ROOT.fetchFrom(params); try { appImageDir.mkdirs(); @@ -262,7 +260,7 @@ + INSTALLER_SUFFIX.fetchFrom(p) + ".dmg"); - File srcFolder = APP_IMAGE_BUILD_ROOT.fetchFrom(p); + File srcFolder = APP_IMAGE_TEMP_ROOT.fetchFrom(p); File predefinedImage = StandardBundlerParam.getPredefinedAppImage(p); if (predefinedImage != null) { srcFolder = predefinedImage; --- old/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgBundler.java 2019-03-05 14:52:35.464167300 -0500 +++ new/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgBundler.java 2019-03-05 14:52:34.450154300 -0500 @@ -63,13 +63,11 @@ private static final BundlerParamInfo PACKAGES_ROOT = new StandardBundlerParam<>( - I18N.getString("param.packages-root.name"), - I18N.getString("param.packages-root.description"), "mac.pkg.packagesRoot", File.class, params -> { File packagesRoot = - new File(BUILD_ROOT.fetchFrom(params), "packages"); + new File(TEMP_ROOT.fetchFrom(params), "packages"); packagesRoot.mkdirs(); return packagesRoot; }, @@ -78,8 +76,6 @@ protected final BundlerParamInfo SCRIPTS_DIR = new StandardBundlerParam<>( - I18N.getString("param.scripts-dir.name"), - I18N.getString("param.scripts-dir.description"), "mac.pkg.scriptsDir", File.class, params -> { @@ -93,9 +89,6 @@ public static final BundlerParamInfo DEVELOPER_ID_INSTALLER_SIGNING_KEY = new StandardBundlerParam<>( - I18N.getString("param.signing-key-developer-id-installer.name"), - I18N.getString( - "param.signing-key-developer-id-installer.description"), "mac.signing-key-developer-id-installer", String.class, params -> { @@ -121,8 +114,6 @@ public static final BundlerParamInfo MAC_INSTALL_DIR = new StandardBundlerParam<>( - I18N.getString("param.mac-install-dir.name"), - I18N.getString("param.mac-install-dir.description"), "mac-install-dir", String.class, params -> { @@ -134,8 +125,6 @@ public static final BundlerParamInfo INSTALLER_SUFFIX = new StandardBundlerParam<> ( - I18N.getString("param.installer-suffix.name"), - I18N.getString("param.installer-suffix.description"), "mac.pkg.installerName.suffix", String.class, params -> "", --- old/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties 2019-03-05 14:52:40.908637100 -0500 +++ new/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties 2019-03-05 14:52:39.801022900 -0500 @@ -24,67 +24,6 @@ # # -app.bundler.name=Mac Application Image -app.bundler.description=A Directory based image of a mac Application with an optionally co-bundled JRE. Used as a base for the Installer bundlers -store.bundler.name=Mac App Store Ready Bundler -store.bundler.description=Creates a binary bundle ready for deployment into the Mac App Store." -dmg.bundler.name=DMG Installer -dmg.bundler.description=Mac DMG Installer Bundle -pkg.bundler.name=PKG Installer -pkg.bundler.description=Mac PKG Installer Bundle. - -param.signing-key-developer-id-app.name=Apple Developer ID Application Signing Key -param.signing-key-developer-id-app.description=The full name of the Apple Developer ID Application signing key. -param.icon-icns.name=.icns Icon -param.icon-icns.description=Icon for the application, in ICNS format. -param.configure-launcher-in-plist=Configure Launcher in Info.plist -param.configure-launcher-in-plist.description=Should the legacy method of configuring hte launcher in the Info.plist be used. -param.category-name=Category -param.category-name.description=Mac App Store Categories. Note that the key is the string to display to the user and the value is the id of the category. -param.cfbundle-name.name=CFBundleName -param.cfbundle-name.description=The name of the app as it appears in the Menu Bar. This can be different from the application name. This name should be less than 16 characters long and be suitable for displaying in the menu bar and the app's Info window. -param.cfbundle-identifier.name=CFBundleIdentifier -param.cfbundle-identifier.description=An identifier that uniquely identifies the application for MacOSX (and on the Mac App Store). May only use alphanumeric (A-Z,a-z,0-9), hyphen (-), and period (.) characters. -param.cfbundle-version.name=CFBundleVersion -param.cfbundle-version.description=An computer readable version for the CFBundle. May contain only digits and from zero to two dots, such as "1.8.1" or "100". -param.bundle-id-signing-prefix.name=Bundle Signing Prefix -param.bundle-id-signing-prefix.description=When signing the application bundle this value is prefixed to all components that need to be signed that don't have an existing CFBundleIdentifier. -param.raw-executable-url.name=Launcher URL -param.raw-executable-url.description=Override the jpackage default launcher with a custom launcher. -param.default-icon-icns=Default Icon -param.default-icon-icns.description=The Default Icon for when a user does not specify an icns file. -param.icon-icns.name=.icns Icon -param.icon-icns.description= Icon for the application, in ICNS format. -param.sign-bundle.name=Sign Bundle -param.sign-bundle.description=Request that the bundle be signed. -param.signing-key-app.name=Application Signing Key -param.signing-key-app.description=The full name of the signing key to sign the application with. -param.signing-key-pkg.name=Installer Signing Key -param.signing-key-pkg.description=The full name of the signing key to sign the PKG Installer with. -param.mac-app-store-entitlements.name=Entitlements File -param.mac-app-store-entitlements.description=File location of a custom mac app store entitlements file -param.installer-suffix.name=Installer Suffix -param.installer-suffix.description=The suffix for the installer this package. -param.app-bundler.name=Mac App Bundler -param.app-bundle.description=Creates a .app bundle for the Mac -param.app-image-build-root.name=Build Root Dir -param.app-image-build-root.description=This is temporary location built by jpackage that is the root of the image application -param.signing-keychain.name=Signing Keychain -param.signing-keychain.description=The location of the keychain to use. If not specified the standard keychains will be used. -param.signing-key-name.name=Signing Key User Name -param.signing-key-name.description=The user name portion of the typical "Mac Developer ID Application: " signing key. -param.installer-name.name=Installer Name -param.installer-name.description=The filename of the generated installer without the file type extension. Default is -. -param.simple-dmg.name=Simple DMG Generation -param.simple-dmg.description=Generate a DMG without AppleScript customizations. Recommended for continuous automated builds. -param.signing-key-developer-id-installer.name=Apple Developer ID Installer Signing Key -param.signing-key-developer-id-installer.description=The full name of the Apple Developer ID Installer signing key. -param.packages-root.name=PKG Root Dir -param.packages-root.description=This is temporary location for component packages (application and daemon). The packages are incorporated into final product package. -param.scripts-dir.name=Scripts Dir -param.scripts-dir.description=This is temporary location for package scripts -param.mac-install-dir.name=Mac Installation Directory -param.mac-install-dir.description=Installation directory of the application on Mac. error.invalid-cfbundle-version=Invalid CFBundleVersion - ''{0}'' error.invalid-cfbundle-version.advice=Set a compatible 'appVersion' or set a 'mac.CFBundleVersion'. Valid versions are one to three integers separated by dots. --- old/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_ja.properties 2019-03-05 14:52:46.243905500 -0500 +++ new/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_ja.properties 2019-03-05 14:52:45.214292300 -0500 @@ -24,67 +24,6 @@ # # -app.bundler.name=Mac Application Image -app.bundler.description=A Directory based image of a mac Application with an optionally co-bundled JRE. Used as a base for the Installer bundlers -store.bundler.name=Mac App Store Ready Bundler -store.bundler.description=Creates a binary bundle ready for deployment into the Mac App Store." -dmg.bundler.name=DMG Installer -dmg.bundler.description=Mac DMG Installer Bundle -pkg.bundler.name=PKG Installer -pkg.bundler.description=Mac PKG Installer Bundle. - -param.signing-key-developer-id-app.name=Apple Developer ID Application Signing Key -param.signing-key-developer-id-app.description=The full name of the Apple Developer ID Application signing key. -param.icon-icns.name=.icns Icon -param.icon-icns.description=Icon for the application, in ICNS format. -param.configure-launcher-in-plist=Configure Launcher in Info.plist -param.configure-launcher-in-plist.description=Should the legacy method of configuring hte launcher in the Info.plist be used. -param.category-name=Category -param.category-name.description=Mac App Store Categories. Note that the key is the string to display to the user and the value is the id of the category. -param.cfbundle-name.name=CFBundleName -param.cfbundle-name.description=The name of the app as it appears in the Menu Bar. This can be different from the application name. This name should be less than 16 characters long and be suitable for displaying in the menu bar and the app's Info window. -param.cfbundle-identifier.name=CFBundleIdentifier -param.cfbundle-identifier.description=An identifier that uniquely identifies the application for MacOSX (and on the Mac App Store). May only use alphanumeric (A-Z,a-z,0-9), hyphen (-), and period (.) characters. -param.cfbundle-version.name=CFBundleVersion -param.cfbundle-version.description=An computer readable version for the CFBundle. May contain only digits and from zero to two dots, such as "1.8.1" or "100". -param.bundle-id-signing-prefix.name=Bundle Signing Prefix -param.bundle-id-signing-prefix.description=When signing the application bundle this value is prefixed to all components that need to be signed that don't have an existing CFBundleIdentifier. -param.raw-executable-url.name=Launcher URL -param.raw-executable-url.description=Override the jpackage default launcher with a custom launcher. -param.default-icon-icns=Default Icon -param.default-icon-icns.description=The Default Icon for when a user does not specify an icns file. -param.icon-icns.name=.icns Icon -param.icon-icns.description= Icon for the application, in ICNS format. -param.sign-bundle.name=Sign Bundle -param.sign-bundle.description=Request that the bundle be signed. -param.signing-key-app.name=Application Signing Key -param.signing-key-app.description=The full name of the signing key to sign the application with. -param.signing-key-pkg.name=Installer Signing Key -param.signing-key-pkg.description=The full name of the signing key to sign the PKG Installer with. -param.mac-app-store-entitlements.name=Entitlements File -param.mac-app-store-entitlements.description=File location of a custom mac app store entitlements file -param.installer-suffix.name=Installer Suffix -param.installer-suffix.description=The suffix for the installer this package. -param.app-bundler.name=Mac App Bundler -param.app-bundle.description=Creates a .app bundle for the Mac -param.app-image-build-root.name=Build Root Dir -param.app-image-build-root.description=This is temporary location built by jpackage that is the root of the image application -param.signing-keychain.name=Signing Keychain -param.signing-keychain.description=The location of the keychain to use. If not specified the standard keychains will be used. -param.signing-key-name.name=Signing Key User Name -param.signing-key-name.description=The user name portion of the typical "Mac Developer ID Application: " signing key. -param.installer-name.name=Installer Name -param.installer-name.description=The filename of the generated installer without the file type extension. Default is -. -param.simple-dmg.name=Simple DMG Generation -param.simple-dmg.description=Generate a DMG without AppleScript customizations. Recommended for continuous automated builds. -param.signing-key-developer-id-installer.name=Apple Developer ID Installer Signing Key -param.signing-key-developer-id-installer.description=The full name of the Apple Developer ID Installer signing key. -param.packages-root.name=PKG Root Dir -param.packages-root.description=This is temporary location for component packages (application and daemon). The packages are incorporated into final product package. -param.scripts-dir.name=Scripts Dir -param.scripts-dir.description=This is temporary location for package scripts -param.mac-install-dir.name=Mac Installation Directory -param.mac-install-dir.description=Installation directory of the application on Mac. error.invalid-cfbundle-version=Invalid CFBundleVersion - ''{0}'' error.invalid-cfbundle-version.advice=Set a compatible 'appVersion' or set a 'mac.CFBundleVersion'. Valid versions are one to three integers separated by dots. --- old/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_zh_CN.properties 2019-03-05 14:52:51.641574700 -0500 +++ new/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_zh_CN.properties 2019-03-05 14:52:50.580761100 -0500 @@ -24,67 +24,6 @@ # # -app.bundler.name=Mac Application Image -app.bundler.description=A Directory based image of a mac Application with an optionally co-bundled JRE. Used as a base for the Installer bundlers -store.bundler.name=Mac App Store Ready Bundler -store.bundler.description=Creates a binary bundle ready for deployment into the Mac App Store." -dmg.bundler.name=DMG Installer -dmg.bundler.description=Mac DMG Installer Bundle -pkg.bundler.name=PKG Installer -pkg.bundler.description=Mac PKG Installer Bundle. - -param.signing-key-developer-id-app.name=Apple Developer ID Application Signing Key -param.signing-key-developer-id-app.description=The full name of the Apple Developer ID Application signing key. -param.icon-icns.name=.icns Icon -param.icon-icns.description=Icon for the application, in ICNS format. -param.configure-launcher-in-plist=Configure Launcher in Info.plist -param.configure-launcher-in-plist.description=Should the legacy method of configuring hte launcher in the Info.plist be used. -param.category-name=Category -param.category-name.description=Mac App Store Categories. Note that the key is the string to display to the user and the value is the id of the category. -param.cfbundle-name.name=CFBundleName -param.cfbundle-name.description=The name of the app as it appears in the Menu Bar. This can be different from the application name. This name should be less than 16 characters long and be suitable for displaying in the menu bar and the app's Info window. -param.cfbundle-identifier.name=CFBundleIdentifier -param.cfbundle-identifier.description=An identifier that uniquely identifies the application for MacOSX (and on the Mac App Store). May only use alphanumeric (A-Z,a-z,0-9), hyphen (-), and period (.) characters. -param.cfbundle-version.name=CFBundleVersion -param.cfbundle-version.description=An computer readable version for the CFBundle. May contain only digits and from zero to two dots, such as "1.8.1" or "100". -param.bundle-id-signing-prefix.name=Bundle Signing Prefix -param.bundle-id-signing-prefix.description=When signing the application bundle this value is prefixed to all components that need to be signed that don't have an existing CFBundleIdentifier. -param.raw-executable-url.name=Launcher URL -param.raw-executable-url.description=Override the jpackage default launcher with a custom launcher. -param.default-icon-icns=Default Icon -param.default-icon-icns.description=The Default Icon for when a user does not specify an icns file. -param.icon-icns.name=.icns Icon -param.icon-icns.description= Icon for the application, in ICNS format. -param.sign-bundle.name=Sign Bundle -param.sign-bundle.description=Request that the bundle be signed. -param.signing-key-app.name=Application Signing Key -param.signing-key-app.description=The full name of the signing key to sign the application with. -param.signing-key-pkg.name=Installer Signing Key -param.signing-key-pkg.description=The full name of the signing key to sign the PKG Installer with. -param.mac-app-store-entitlements.name=Entitlements File -param.mac-app-store-entitlements.description=File location of a custom mac app store entitlements file -param.installer-suffix.name=Installer Suffix -param.installer-suffix.description=The suffix for the installer this package. -param.app-bundler.name=Mac App Bundler -param.app-bundle.description=Creates a .app bundle for the Mac -param.app-image-build-root.name=Build Root Dir -param.app-image-build-root.description=This is temporary location built by jpackage that is the root of the image application -param.signing-keychain.name=Signing Keychain -param.signing-keychain.description=The location of the keychain to use. If not specified the standard keychains will be used. -param.signing-key-name.name=Signing Key User Name -param.signing-key-name.description=The user name portion of the typical "Mac Developer ID Application: " signing key. -param.installer-name.name=Installer Name -param.installer-name.description=The filename of the generated installer without the file type extension. Default is -. -param.simple-dmg.name=Simple DMG Generation -param.simple-dmg.description=Generate a DMG without AppleScript customizations. Recommended for continuous automated builds. -param.signing-key-developer-id-installer.name=Apple Developer ID Installer Signing Key -param.signing-key-developer-id-installer.description=The full name of the Apple Developer ID Installer signing key. -param.packages-root.name=PKG Root Dir -param.packages-root.description=This is temporary location for component packages (application and daemon). The packages are incorporated into final product package. -param.scripts-dir.name=Scripts Dir -param.scripts-dir.description=This is temporary location for package scripts -param.mac-install-dir.name=Mac Installation Directory -param.mac-install-dir.description=Installation directory of the application on Mac. error.invalid-cfbundle-version=Invalid CFBundleVersion - ''{0}'' error.invalid-cfbundle-version.advice=Set a compatible 'appVersion' or set a 'mac.CFBundleVersion'. Valid versions are one to three integers separated by dots. --- old/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractBundler.java 2019-03-05 14:52:56.789640700 -0500 +++ new/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractBundler.java 2019-03-05 14:52:55.713226900 -0500 @@ -53,12 +53,10 @@ public static final BundlerParamInfo IMAGES_ROOT = new StandardBundlerParam<>( - I18N.getString("param.images-root.name"), - I18N.getString("param.images-root.description"), "imagesRoot", File.class, params -> new File( - StandardBundlerParam.BUILD_ROOT.fetchFrom(params), "images"), + StandardBundlerParam.TEMP_ROOT.fetchFrom(params), "images"), (s, p) -> null); public InputStream getResourceAsStream(String name) { @@ -188,7 +186,7 @@ public void cleanup(Map params) { try { IOUtils.deleteRecursive( - StandardBundlerParam.BUILD_ROOT.fetchFrom(params)); + StandardBundlerParam.TEMP_ROOT.fetchFrom(params)); } catch (IOException e) { Log.debug(e.getMessage()); } --- old/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractImageBundler.java 2019-03-05 14:53:01.953306900 -0500 +++ new/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractImageBundler.java 2019-03-05 14:53:00.939293900 -0500 @@ -59,17 +59,6 @@ throws ConfigException { StandardBundlerParam.validateMainClassInfoFromAppResources(p); - boolean hasMainJar = MAIN_JAR.fetchFrom(p) != null; - boolean hasMainModule = - StandardBundlerParam.MODULE.fetchFrom(p) != null; - boolean hasMainClass = MAIN_CLASS.fetchFrom(p) != null; - boolean runtime = RUNTIME_INSTALLER.fetchFrom(p); - - if (!hasMainJar && !hasMainModule && !hasMainClass && !runtime) { - throw new ConfigException( - I18N.getString("error.no-application-class"), - I18N.getString("error.no-application-class.advice")); - } } public static void extractFlagsFromVersion( @@ -121,8 +110,8 @@ } protected File createRoot(Map p, - File outputDirectory, boolean dependentTask, - String name, String jlinkKey) throws PackagerException { + File outputDirectory, boolean dependentTask, String name) + throws PackagerException { if (!outputDirectory.isDirectory() && !outputDirectory.mkdirs()) { throw new RuntimeException(MessageFormat.format( I18N.getString("error.cannot-create-output-dir"), @@ -143,16 +132,10 @@ File rootDirectory = new File(outputDirectory, name); if (rootDirectory.exists()) { - if (!(OVERWRITE.fetchFrom(p))) { - throw new PackagerException("error.root-exists-without-overwrite", - rootDirectory.getAbsolutePath()); - } - try { - IOUtils.deleteRecursive(rootDirectory); - } catch (IOException ioe) { - throw new PackagerException(ioe); - } + throw new PackagerException("error.root-exists", + rootDirectory.getAbsolutePath()); } + rootDirectory.mkdirs(); return rootDirectory; --- old/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java 2019-03-05 14:53:07.522578300 -0500 +++ new/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java 2019-03-05 14:53:06.446164500 -0500 @@ -74,8 +74,6 @@ public static final BundlerParamInfo CREATE_IMAGE = new StandardBundlerParam<>( - I18N.getString("param.create-image.name"), - I18N.getString("param.create-image.description"), IMAGE_MODE, Boolean.class, p -> Boolean.FALSE, @@ -84,15 +82,13 @@ public static final BundlerParamInfo CREATE_INSTALLER = new StandardBundlerParam<>( - I18N.getString("param.create-installer.name"), - I18N.getString("param.create-installer.description"), INSTALLER_MODE, Boolean.class, p -> Boolean.FALSE, (s, p) -> (s == null || "null".equalsIgnoreCase(s)) ? true : Boolean.valueOf(s)); - // regexp for parsing args (for example, for secondary launchers) + // regexp for parsing args (for example, for additional launchers) private static Pattern pattern = Pattern.compile( "(?:(?:([\"'])(?:\\\\\\1|.)*?(?:\\1|$))|(?:\\\\[\"'\\s]|[^\\s]))++"); @@ -123,7 +119,7 @@ private List platformBundlers = null; - private List secondaryLaunchers = null; + private List addLaunchers = null; private static Map argIds = new HashMap<>(); private static Map argShortIds = new HashMap<>(); @@ -159,12 +155,6 @@ context().deployParams.setTargetFormat(format); }), - RUNTIME_INSTALLER("runtime-installer", - OptionCategories.PROPERTY, () -> { - runtimeInstaller = true; - setOptionValue("runtime-installer", true); - }), - INSTALLER_TYPE("installer-type", OptionCategories.PROPERTY, () -> { String type = popArg(); if (BundlerType.INSTALLER.equals(context().bundleType)) { @@ -188,7 +178,7 @@ VENDOR ("vendor", OptionCategories.PROPERTY), - APPCLASS ("main-class", "c", OptionCategories.PROPERTY, () -> { + APPCLASS ("main-class", OptionCategories.PROPERTY, () -> { context().hasMainClass = true; setOptionValue("main-class", popArg()); }), @@ -202,10 +192,6 @@ Log.setVerbose(true); }), - OVERWRITE ("overwrite", OptionCategories.PROPERTY, () -> { - setOptionValue("overwrite", true); - }), - RESOURCE_DIR("resource-dir", OptionCategories.PROPERTY, () -> { String resourceDir = popArg(); @@ -219,18 +205,13 @@ Arrays.asList(files.split(File.pathSeparator))); }), - ARGUMENTS ("arguments", "a", OptionCategories.PROPERTY, () -> { + ARGUMENTS ("arguments", OptionCategories.PROPERTY, () -> { List arguments = getArgumentList(popArg()); setOptionValue("arguments", arguments); }), - STRIP_NATIVE_COMMANDS ("strip-native-commands", - OptionCategories.PROPERTY, () -> { - setOptionValue("strip-native-commands", true); - }), - ICON ("icon", OptionCategories.PROPERTY), - CATEGORY ("category", OptionCategories.PROPERTY), + COPYRIGHT ("copyright", OptionCategories.PROPERTY), LICENSE_FILE ("license-file", OptionCategories.PROPERTY), @@ -279,16 +260,16 @@ }), - SECONDARY_LAUNCHER ("secondary-launcher", + ADD_LAUNCHER ("add-launcher", OptionCategories.PROPERTY, () -> { - context().secondaryLaunchers.add( - new SecondaryLauncherArguments(popArg())); + context().addLaunchers.add( + new AddLauncherArguments(popArg())); }), - BUILD_ROOT ("build-root", OptionCategories.PROPERTY, () -> { + TEMP_ROOT ("temp-root", OptionCategories.PROPERTY, () -> { context().buildRoot = popArg(); context().userProvidedBuildRoot = true; - setOptionValue("build-root", context().buildRoot); + setOptionValue("temp-root", context().buildRoot); }), INSTALL_DIR ("install-dir", OptionCategories.PROPERTY), @@ -300,7 +281,7 @@ PREDEFINED_RUNTIME_IMAGE ("runtime-image", OptionCategories.PROPERTY), - MAIN_JAR ("main-jar", "j", OptionCategories.PROPERTY, () -> { + MAIN_JAR ("main-jar", OptionCategories.PROPERTY, () -> { context().mainJarPath = popArg(); context().hasMainJar = true; setOptionValue("main-jar", context().mainJarPath); @@ -379,7 +360,9 @@ OptionCategories.PLATFORM_LINUX), LINUX_PACKAGE_DEPENDENCIES ("linux-package-deps", - OptionCategories.PLATFORM_LINUX); + OptionCategories.PLATFORM_LINUX), + + LINUX_MENU_GROUP ("linux-menu-group", OptionCategories.PLATFORM_LINUX); private final String id; private final String shortId; @@ -504,7 +487,7 @@ allOptions = new ArrayList<>(); - secondaryLaunchers = new ArrayList<>(); + addLaunchers = new ArrayList<>(); } public boolean processArguments() throws Exception { @@ -553,12 +536,12 @@ List> launchersAsMap = new ArrayList<>(); - for (SecondaryLauncherArguments sl : secondaryLaunchers) { + for (AddLauncherArguments sl : addLaunchers) { launchersAsMap.add(sl.getLauncherMap()); } deployParams.addBundleArgument( - StandardBundlerParam.SECONDARY_LAUNCHERS.getID(), + StandardBundlerParam.ADD_LAUNCHERS.getID(), launchersAsMap); // at this point deployParams should be already configured @@ -571,14 +554,14 @@ ArrayList usedNames = new ArrayList(); usedNames.add(bp.getName()); // add main app name - for (SecondaryLauncherArguments sl : secondaryLaunchers) { + for (AddLauncherArguments sl : addLaunchers) { Map slMap = sl.getLauncherMap(); String slName = (String) slMap.get(Arguments.CLIOptions.NAME.getId()); if (slName == null) { - throw new PackagerException("ERR_NoSecondaryLauncherName"); + throw new PackagerException("ERR_NoAddLauncherName"); } - // same rules apply to secondary launcher names as app name + // same rules apply to additional launcher names as app name DeployParams.validateName(slName, false); for (String usedName : usedNames) { if (slName.equals(usedName)) { @@ -605,18 +588,47 @@ } } - private void validateArguments() { + private void validateArguments() throws PackagerException { CLIOptions mode = allOptions.get(0); + boolean imageOnly = (mode == CLIOptions.CREATE_IMAGE); + boolean hasAppImage = allOptions.contains( + CLIOptions.PREDEFINED_APP_IMAGE); + boolean hasRuntime = allOptions.contains( + CLIOptions.PREDEFINED_RUNTIME_IMAGE); + boolean installerOnly = !imageOnly && hasAppImage; + boolean runtimeInstall = !imageOnly && hasRuntime && !hasAppImage && + !hasMainModule && !hasMainJar; + for (CLIOptions option : allOptions) { - if(!ValidOptions.checkIfSupported(mode, option)) { - String key = "warning.unsupported.option"; - if (ValidOptions.checkIfOtherSupported(mode, option)) { - key = "warning.unsupported.mode.option"; + if (!ValidOptions.checkIfSupported(option)) { + // includes option valid only on different platform + throw new PackagerException("ERR_UnsupportedOption", + option.getIdWithPrefix()); + } + if (imageOnly) { + if (!ValidOptions.checkIfImageSupported(option)) { + throw new PackagerException("ERR_NotImageOption", + option.getIdWithPrefix()); + } + } else if (installerOnly || runtimeInstall) { + if (!ValidOptions.checkIfInstallerSupported(option)) { + String key = runtimeInstaller ? + "ERR_NoInstallerEntryPoint" : "ERR_NotInstallerOption"; + throw new PackagerException(key, option.getIdWithPrefix()); } - Log.info(MessageFormat.format(I18N.getString(key), - option.getId(), mode)); } } + if (installerOnly && hasRuntime) { + // note --runtime-image is only for image or runtime installer. + throw new PackagerException("ERR_NotInstallerOption", + CLIOptions.PREDEFINED_RUNTIME_IMAGE.getIdWithPrefix()); + } + if (hasMainJar && hasMainModule) { + throw new PackagerException("ERR_BothMainJarAndModule"); + } + if (imageOnly && !hasMainJar && !hasMainModule) { + throw new PackagerException("ERR_NoEntryPoint"); + } } private List getPlatformBundlers() { @@ -647,15 +659,19 @@ boolean bundleCreated = false; - // the build-root needs to be fetched from the params early, + // the temp-root needs to be fetched from the params early, // to prevent each copy of the params (such as may be used for - // secondary launchers) from generating a separate build-root when + // additional launchers) from generating a separate temp-root when // the default is used (the default is a new temp directory) // The bundler.cleanup() below would not otherwise be able to // clean these extra (and unneeded) temp directories. - StandardBundlerParam.BUILD_ROOT.fetchFrom(params); - - for (jdk.jpackage.internal.Bundler bundler : getPlatformBundlers()) { + StandardBundlerParam.TEMP_ROOT.fetchFrom(params); + List bundlers = getPlatformBundlers(); + if (bundlers.isEmpty()) { + throw new PackagerException("ERR_InvalidInstallerType", + deployParams.getTargetFormat()); + } + for (jdk.jpackage.internal.Bundler bundler : bundlers) { Map localParams = new HashMap<>(params); try { if (bundler.validate(localParams)) { --- old/src/jdk.jpackage/share/classes/jdk/jpackage/internal/BundleParams.java 2019-03-05 14:53:12.701844700 -0500 +++ new/src/jdk.jpackage/share/classes/jdk/jpackage/internal/BundleParams.java 2019-03-05 14:53:11.672231500 -0500 @@ -74,10 +74,6 @@ // String - Application version. Format may differ for different bundlers public static final String PARAM_VERSION = "appVersion"; - // String - Application category. Used at least on Mac/Linux. - // Value is platform specific - public static final String PARAM_CATEGORY = "applicationCategory"; - // String - Optional short application public static final String PARAM_TITLE = "title"; @@ -165,11 +161,6 @@ putUnlessNull(StandardBundlerParam.LIMIT_MODULES.getID(), value); } - public void setStripNativeCommands(boolean value) { - putUnlessNull(StandardBundlerParam.STRIP_NATIVE_COMMANDS.getID(), - value); - } - public void setModulePath(String value) { putUnlessNull(StandardBundlerParam.MODULE_PATH.getID(), value); } @@ -277,14 +268,6 @@ putUnlessNull(APP_RESOURCES_LIST.getID(), rfs); } - public String getApplicationCategory() { - return fetchParam(CATEGORY); - } - - public void setApplicationCategory(String category) { - putUnlessNull(PARAM_CATEGORY, category); - } - public String getMainClassName() { String applicationClass = getApplicationClass(); --- old/src/jdk.jpackage/share/classes/jdk/jpackage/internal/BundlerParamInfo.java 2019-03-05 14:53:18.130714300 -0500 +++ new/src/jdk.jpackage/share/classes/jdk/jpackage/internal/BundlerParamInfo.java 2019-03-05 14:53:16.960699300 -0500 @@ -35,15 +35,6 @@ * A BundlerParamInfo encapsulates an individual bundler parameter of type . */ class BundlerParamInfo { - /** - * The user friendly name of the parameter - */ - String name; - - /** - * A more verbose description of the parameter - */ - String description; /** * The command line and hashmap name of the parameter @@ -71,22 +62,6 @@ */ BiFunction, T> stringConverter; - String getName() { - return name; - } - - void setName(String name) { - this.name = name; - } - - String getDescription() { - return description; - } - - void setDescription(String description) { - this.description = description; - } - String getID() { return id; } --- old/src/jdk.jpackage/share/classes/jdk/jpackage/internal/DeployParams.java 2019-03-05 14:53:23.794587000 -0500 +++ new/src/jdk.jpackage/share/classes/jdk/jpackage/internal/DeployParams.java 2019-03-05 14:53:22.780574000 -0500 @@ -57,7 +57,6 @@ String vendor; String email; String description; - String category; String licenseType; String copyright; String version; @@ -74,7 +73,6 @@ // Java 9 modules support String addModules = null; String limitModules = null; - Boolean stripNativeCommands = null; String modulePath = null; String module = null; String debugPort = null; @@ -90,10 +88,6 @@ // raw arguments to the bundler Map bundlerArguments = new LinkedHashMap<>(); - void setCategory(String category) { - this.category = category; - } - void setLicenseType(String licenseType) { this.licenseType = licenseType; } @@ -168,10 +162,6 @@ this.debugPort = value; } - void setStripNativeCommands(boolean value) { - this.stripNativeCommands = value; - } - void setDescription(String description) { this.description = description; } @@ -339,7 +329,7 @@ boolean hasModule = (bundlerArguments.get( Arguments.CLIOptions.MODULE.getId()) != null); - boolean hasImage = (bundlerArguments.get( + boolean hasAppImage = (bundlerArguments.get( Arguments.CLIOptions.PREDEFINED_APP_IMAGE.getId()) != null); boolean hasClass = (bundlerArguments.get( Arguments.CLIOptions.APPCLASS.getId()) != null); @@ -351,10 +341,8 @@ Arguments.CLIOptions.INPUT.getId()) != null); boolean hasModulePath = (bundlerArguments.get( Arguments.CLIOptions.MODULE_PATH.getId()) != null); - boolean hasAppImage = (bundlerArguments.get( - Arguments.CLIOptions.PREDEFINED_APP_IMAGE.getId()) != null); - boolean runtimeInstaller = (bundlerArguments.get( - Arguments.CLIOptions.RUNTIME_INSTALLER.getId()) != null); + boolean runtimeInstaller = (BundlerType.INSTALLER == getBundleType()) && + !hasAppImage && !hasModule && !hasMain && hasRuntimeImage; if (getBundleType() == BundlerType.IMAGE) { // Module application requires --runtime-image or --module-path @@ -387,7 +375,7 @@ // if bundling non-modular image, or installer without app-image // then we need some resources and a main class - if (!hasModule && !hasImage && !runtimeInstaller) { + if (!hasModule && !hasAppImage && !runtimeInstaller) { if (resources.isEmpty()) { throw new PackagerException("ERR_MissingAppResources"); } @@ -415,9 +403,9 @@ } } - // Validate build-root + // Validate temp-root String root = (String)bundlerArguments.get( - Arguments.CLIOptions.BUILD_ROOT.getId()); + Arguments.CLIOptions.TEMP_ROOT.getId()); if (root != null) { String [] contents = (new File(root)).list(); @@ -527,7 +515,6 @@ bundleParams.setEmail(email); bundleParams.setInstalldirChooser(installdirChooser); bundleParams.setCopyright(copyright); - bundleParams.setApplicationCategory(category); bundleParams.setDescription(description); bundleParams.setTitle(title); @@ -542,10 +529,6 @@ bundleParams.setLimitModules(limitModules); } - if (stripNativeCommands != null) { - bundleParams.setStripNativeCommands(stripNativeCommands); - } - if (modulePath != null && !modulePath.isEmpty()) { bundleParams.setModulePath(modulePath); } --- old/src/jdk.jpackage/share/classes/jdk/jpackage/internal/EnumeratedBundlerParam.java 2019-03-05 14:53:29.114255200 -0500 +++ new/src/jdk.jpackage/share/classes/jdk/jpackage/internal/EnumeratedBundlerParam.java 2019-03-05 14:53:28.069041800 -0500 @@ -59,13 +59,10 @@ private final Map elements; private final boolean strict; - EnumeratedBundlerParam(String name, String description, - String id, Class valueType, + EnumeratedBundlerParam(String id, Class valueType, Function, T> defaultValueFunction, BiFunction, T> stringConverter, Map elements, boolean strict) { - this.name = name; - this.description = description; this.id = id; this.valueType = valueType; this.defaultValueFunction = defaultValueFunction; @@ -96,19 +93,4 @@ return !isStrict(); } - T validatedFetchFrom(Map params) - throws InvalidBundlerParamException { - if (isStrict()) { - T value = fetchFrom(params); - if (!isInPossibleValues(value)) { - throw new InvalidBundlerParamException("Parameter " - + value.toString() - + " not in valid set of values for BundlerParam " - + name); - } - return value; - } - return fetchFrom(params); - } - } --- old/src/jdk.jpackage/share/classes/jdk/jpackage/internal/JLinkBundlerHelper.java 2019-03-05 14:53:34.340322200 -0500 +++ new/src/jdk.jpackage/share/classes/jdk/jpackage/internal/JLinkBundlerHelper.java 2019-03-05 14:53:33.295108800 -0500 @@ -76,8 +76,6 @@ @SuppressWarnings("unchecked") static final BundlerParamInfo DEBUG = new StandardBundlerParam<>( - "", - "", "-J-Xdebug", Integer.class, p -> null, @@ -190,8 +188,6 @@ StandardBundlerParam.ADD_MODULES.fetchFrom(params); Set 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); @@ -206,18 +202,21 @@ // 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) { + 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 validModules = getValidModules(modulePath, addModules, limitModules); + if (mainModule != null) { validModules.add(mainModule); } @@ -226,39 +225,12 @@ I18N.getString("message.modules"), validModules.toString())); runJLink(outputDir, modulePath, validModules, limitModules, - excludeFileList, stripNativeCommands, - new HashMap()); + excludeFileList, new HashMap()); imageBuilder.prepareApplicationFiles(); } - static void generateJre(Map params, - AbstractAppImageBuilder imageBuilder) - throws IOException, Exception { - List modulePath = - StandardBundlerParam.MODULE_PATH.fetchFrom(params); - Set addModules = - StandardBundlerParam.ADD_MODULES.fetchFrom(params); - Set 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 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()); - - imageBuilder.prepareJreFiles(); - } - // Returns the path to the JDK modules in the user defined module path. static Path findPathOfModule( List modulePath, String moduleName) { @@ -408,7 +380,7 @@ private static void runJLink(Path output, List modulePath, Set modules, Set limitModules, String excludes, - boolean strip, HashMap user) throws IOException { + HashMap 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 @@ -433,16 +405,18 @@ args.add("--exclude-files"); args.add(excludes); } - if (strip) { + if (user != null && !user.isEmpty()) { + for (Map.Entry 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"); } - for (Map.Entry 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); --- old/src/jdk.jpackage/share/classes/jdk/jpackage/internal/StandardBundlerParam.java 2019-03-05 14:53:40.065595600 -0500 +++ new/src/jdk.jpackage/share/classes/jdk/jpackage/internal/StandardBundlerParam.java 2019-03-05 14:53:39.004782000 -0500 @@ -58,7 +58,7 @@ import java.util.stream.Collectors; /** - * StandardBundlerParams + * StandardBundlerParam * * A parameter to a bundler. * @@ -74,13 +74,10 @@ "jdk.jpackage.internal.resources.MainResources"); private static final String JAVABASEJMOD = "java.base.jmod"; - StandardBundlerParam(String name, String description, String id, - Class valueType, + StandardBundlerParam(String id, Class valueType, Function, T> defaultValueFunction, BiFunction, T> stringConverter) { - this.name = name; - this.description = description; this.id = id; this.valueType = valueType; this.defaultValueFunction = defaultValueFunction; @@ -89,8 +86,6 @@ static final StandardBundlerParam APP_RESOURCES = new StandardBundlerParam<>( - I18N.getString("param.app-resources.name"), - I18N.getString("param.app-resource.description"), BundleParams.PARAM_APP_RESOURCES, RelativeFileSet.class, null, // no default. Required parameter @@ -102,8 +97,6 @@ static final StandardBundlerParam> APP_RESOURCES_LIST = new StandardBundlerParam<>( - I18N.getString("param.app-resources-list.name"), - I18N.getString("param.app-resource-list.description"), BundleParams.PARAM_APP_RESOURCES + "List", (Class>) (Object) List.class, // Default is appResources, as a single item list @@ -114,8 +107,6 @@ static final StandardBundlerParam SOURCE_DIR = new StandardBundlerParam<>( - I18N.getString("param.source-dir.name"), - I18N.getString("param.source-dir.description"), Arguments.CLIOptions.INPUT.getId(), String.class, p -> null, @@ -135,8 +126,6 @@ // their own converter static final StandardBundlerParam MAIN_JAR = new StandardBundlerParam<>( - I18N.getString("param.main-jar.name"), - I18N.getString("param.main-jar.description"), Arguments.CLIOptions.MAIN_JAR.getId(), RelativeFileSet.class, params -> { @@ -149,8 +138,6 @@ // TODO: test CLASSPATH jar manifest Attributet static final StandardBundlerParam CLASSPATH = new StandardBundlerParam<>( - I18N.getString("param.classpath.name"), - I18N.getString("param.classpath.description"), "classpath", String.class, params -> { @@ -161,27 +148,12 @@ (s, p) -> s.replace(File.pathSeparator, " ") ); - static final StandardBundlerParam RUNTIME_INSTALLER = - new StandardBundlerParam<>( - "", - "", - Arguments.CLIOptions.RUNTIME_INSTALLER.getId(), - Boolean.class, - params -> false, - // valueOf(null) is false, and we actually do want null - (s, p) -> (s == null || "null".equalsIgnoreCase(s)) ? - true : Boolean.valueOf(s) - ); - - static final StandardBundlerParam MAIN_CLASS = new StandardBundlerParam<>( - I18N.getString("param.main-class.name"), - I18N.getString("param.main-class.description"), Arguments.CLIOptions.APPCLASS.getId(), String.class, params -> { - if (RUNTIME_INSTALLER.fetchFrom(params)) { + if (isRuntimeInstaller(params)) { return null; } extractMainClassInfoFromAppResources(params); @@ -197,8 +169,6 @@ static final StandardBundlerParam APP_NAME = new StandardBundlerParam<>( - I18N.getString("param.app-name.name"), - I18N.getString("param.app-name.description"), Arguments.CLIOptions.NAME.getId(), String.class, params -> { @@ -216,8 +186,6 @@ static final StandardBundlerParam ICON = new StandardBundlerParam<>( - I18N.getString("param.icon-file.name"), - I18N.getString("param.icon-file.description"), Arguments.CLIOptions.ICON.getId(), File.class, params -> null, @@ -226,28 +194,14 @@ static final StandardBundlerParam VENDOR = new StandardBundlerParam<>( - I18N.getString("param.vendor.name"), - I18N.getString("param.vendor.description"), Arguments.CLIOptions.VENDOR.getId(), String.class, params -> I18N.getString("param.vendor.default"), (s, p) -> s ); - static final StandardBundlerParam CATEGORY = - new StandardBundlerParam<>( - I18N.getString("param.category.name"), - I18N.getString("param.category.description"), - Arguments.CLIOptions.CATEGORY.getId(), - String.class, - params -> I18N.getString("param.category.default"), - (s, p) -> s - ); - static final StandardBundlerParam DESCRIPTION = new StandardBundlerParam<>( - I18N.getString("param.description.name"), - I18N.getString("param.description.description"), Arguments.CLIOptions.DESCRIPTION.getId(), String.class, params -> params.containsKey(APP_NAME.getID()) @@ -258,8 +212,6 @@ static final StandardBundlerParam COPYRIGHT = new StandardBundlerParam<>( - I18N.getString("param.copyright.name"), - I18N.getString("param.copyright.description"), Arguments.CLIOptions.COPYRIGHT.getId(), String.class, params -> MessageFormat.format(I18N.getString( @@ -270,8 +222,6 @@ @SuppressWarnings("unchecked") static final StandardBundlerParam> ARGUMENTS = new StandardBundlerParam<>( - I18N.getString("param.arguments.name"), - I18N.getString("param.arguments.description"), Arguments.CLIOptions.ARGUMENTS.getId(), (Class>) (Object) List.class, params -> Collections.emptyList(), @@ -281,8 +231,6 @@ @SuppressWarnings("unchecked") static final StandardBundlerParam> JVM_OPTIONS = new StandardBundlerParam<>( - I18N.getString("param.jvm-options.name"), - I18N.getString("param.jvm-options.description"), Arguments.CLIOptions.JVM_ARGS.getId(), (Class>) (Object) List.class, params -> Collections.emptyList(), @@ -291,8 +239,6 @@ static final StandardBundlerParam TITLE = new StandardBundlerParam<>( - I18N.getString("param.title.name"), - I18N.getString("param.title.description"), BundleParams.PARAM_TITLE, String.class, APP_NAME::fetchFrom, @@ -303,8 +249,6 @@ // their own converter static final StandardBundlerParam VERSION = new StandardBundlerParam<>( - I18N.getString("param.version.name"), - I18N.getString("param.version.description"), Arguments.CLIOptions.VERSION.getId(), String.class, params -> I18N.getString("param.version.default"), @@ -314,19 +258,15 @@ @SuppressWarnings("unchecked") public static final StandardBundlerParam LICENSE_FILE = new StandardBundlerParam<>( - I18N.getString("param.license-file.name"), - I18N.getString("param.license-file.description"), Arguments.CLIOptions.LICENSE_FILE.getId(), String.class, params -> null, (s, p) -> s ); - static final StandardBundlerParam BUILD_ROOT = + static final StandardBundlerParam TEMP_ROOT = new StandardBundlerParam<>( - I18N.getString("param.build-root.name"), - I18N.getString("param.build-root.description"), - Arguments.CLIOptions.BUILD_ROOT.getId(), + Arguments.CLIOptions.TEMP_ROOT.getId(), File.class, params -> { try { @@ -341,13 +281,11 @@ public static final StandardBundlerParam CONFIG_ROOT = new StandardBundlerParam<>( - I18N.getString("param.config-root.name"), - I18N.getString("param.config-root.description"), "configRoot", File.class, params -> { File root = - new File(BUILD_ROOT.fetchFrom(params), "config"); + new File(TEMP_ROOT.fetchFrom(params), "config"); root.mkdirs(); return root; }, @@ -356,8 +294,6 @@ static final StandardBundlerParam IDENTIFIER = new StandardBundlerParam<>( - I18N.getString("param.identifier.name"), - I18N.getString("param.identifier.description"), Arguments.CLIOptions.IDENTIFIER.getId(), String.class, params -> { @@ -375,8 +311,6 @@ static final StandardBundlerParam PREFERENCES_ID = new StandardBundlerParam<>( - I18N.getString("param.preferences-id.name"), - I18N.getString("param.preferences-id.description"), "preferencesID", String.class, p -> Optional.ofNullable(IDENTIFIER.fetchFrom(p)). @@ -386,8 +320,6 @@ static final StandardBundlerParam VERBOSE = new StandardBundlerParam<>( - I18N.getString("param.verbose.name"), - I18N.getString("param.verbose.description"), Arguments.CLIOptions.VERBOSE.getId(), Boolean.class, params -> false, @@ -396,22 +328,8 @@ true : Boolean.valueOf(s) ); - static final StandardBundlerParam OVERWRITE = - new StandardBundlerParam<>( - I18N.getString("param.overwrite.name"), - I18N.getString("param.overwrite.description"), - Arguments.CLIOptions.OVERWRITE.getId(), - Boolean.class, - params -> false, - // valueOf(null) is false, and we actually do want null - (s, p) -> (s == null || "null".equalsIgnoreCase(s)) ? - true : Boolean.valueOf(s) - ); - static final StandardBundlerParam RESOURCE_DIR = new StandardBundlerParam<>( - I18N.getString("param.resource-dir.name"), - I18N.getString("param.resource-dir.description"), Arguments.CLIOptions.RESOURCE_DIR.getId(), File.class, params -> null, @@ -420,8 +338,6 @@ static final BundlerParamInfo INSTALL_DIR = new StandardBundlerParam<>( - I18N.getString("param.install-dir.name"), - I18N.getString("param.install-dir.description"), Arguments.CLIOptions.INSTALL_DIR.getId(), String.class, params -> null, @@ -430,8 +346,6 @@ static final StandardBundlerParam PREDEFINED_APP_IMAGE = new StandardBundlerParam<>( - I18N.getString("param.predefined-app-image.name"), - I18N.getString("param.predefined-app-image.description"), Arguments.CLIOptions.PREDEFINED_APP_IMAGE.getId(), File.class, params -> null, @@ -439,19 +353,15 @@ static final StandardBundlerParam PREDEFINED_RUNTIME_IMAGE = new StandardBundlerParam<>( - I18N.getString("param.predefined-runtime-image.name"), - I18N.getString("param.predefined-runtime-image.description"), Arguments.CLIOptions.PREDEFINED_RUNTIME_IMAGE.getId(), File.class, params -> null, (s, p) -> new File(s)); @SuppressWarnings("unchecked") - static final StandardBundlerParam>> SECONDARY_LAUNCHERS = + static final StandardBundlerParam>> ADD_LAUNCHERS = new StandardBundlerParam<>( - I18N.getString("param.secondary-launchers.name"), - I18N.getString("param.secondary-launchers.description"), - Arguments.CLIOptions.SECONDARY_LAUNCHER.getId(), + Arguments.CLIOptions.ADD_LAUNCHER.getId(), (Class>>) (Object) List.class, params -> new ArrayList<>(1), @@ -463,8 +373,6 @@ static final StandardBundlerParam >> FILE_ASSOCIATIONS = new StandardBundlerParam<>( - I18N.getString("param.file-associations.name"), - I18N.getString("param.file-associations.description"), Arguments.CLIOptions.FILE_ASSOCIATIONS.getId(), (Class>>) (Object) List.class, @@ -476,8 +384,6 @@ @SuppressWarnings("unchecked") static final StandardBundlerParam> FA_EXTENSIONS = new StandardBundlerParam<>( - I18N.getString("param.fa-extension.name"), - I18N.getString("param.fa-extension.description"), "fileAssociation.extension", (Class>) (Object) List.class, params -> null, // null means not matched to an extension @@ -487,8 +393,6 @@ @SuppressWarnings("unchecked") static final StandardBundlerParam> FA_CONTENT_TYPE = new StandardBundlerParam<>( - I18N.getString("param.fa-content-type.name"), - I18N.getString("param.fa-content-type.description"), "fileAssociation.contentType", (Class>) (Object) List.class, params -> null, @@ -498,8 +402,6 @@ static final StandardBundlerParam FA_DESCRIPTION = new StandardBundlerParam<>( - I18N.getString("param.fa-description.name"), - I18N.getString("param.fa-description.description"), "fileAssociation.description", String.class, params -> APP_NAME.fetchFrom(params) + " File", @@ -508,8 +410,6 @@ static final StandardBundlerParam FA_ICON = new StandardBundlerParam<>( - I18N.getString("param.fa-icon.name"), - I18N.getString("param.fa-icon.description"), "fileAssociation.icon", File.class, ICON::fetchFrom, @@ -519,8 +419,6 @@ @SuppressWarnings("unchecked") static final BundlerParamInfo> MODULE_PATH = new StandardBundlerParam<>( - I18N.getString("param.module-path.name"), - I18N.getString("param.module-path.description"), Arguments.CLIOptions.MODULE_PATH.getId(), (Class>) (Object)List.class, p -> { return getDefaultModulePath(); }, @@ -560,8 +458,6 @@ static final BundlerParamInfo MODULE = new StandardBundlerParam<>( - I18N.getString("param.main.module.name"), - I18N.getString("param.main.module.description"), Arguments.CLIOptions.MODULE.getId(), String.class, p -> null, @@ -572,8 +468,6 @@ @SuppressWarnings("unchecked") static final BundlerParamInfo> ADD_MODULES = new StandardBundlerParam<>( - I18N.getString("param.add-modules.name"), - I18N.getString("param.add-modules.description"), Arguments.CLIOptions.ADD_MODULES.getId(), (Class>) (Object) Set.class, p -> new LinkedHashSet(), @@ -583,23 +477,22 @@ @SuppressWarnings("unchecked") static final BundlerParamInfo> LIMIT_MODULES = new StandardBundlerParam<>( - I18N.getString("param.limit-modules.name"), - I18N.getString("param.limit-modules.description"), "limit-modules", (Class>) (Object) Set.class, p -> new LinkedHashSet(), (s, p) -> new LinkedHashSet<>(Arrays.asList(s.split(","))) ); - static final BundlerParamInfo STRIP_NATIVE_COMMANDS = - new StandardBundlerParam<>( - I18N.getString("param.strip-executables.name"), - I18N.getString("param.strip-executables.description"), - Arguments.CLIOptions.STRIP_NATIVE_COMMANDS.getId(), - Boolean.class, - p -> Boolean.FALSE, - (s, p) -> Boolean.valueOf(s) - ); + static boolean isRuntimeInstaller(Map p) { + if (p.containsKey(MODULE.getID()) || + p.containsKey(MAIN_JAR.getID()) || + p.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()); + } static File getPredefinedAppImage(Map p) { File applicationImage = null; @@ -660,11 +553,9 @@ boolean hasMainJar = params.containsKey(MAIN_JAR.getID()); boolean hasMainJarClassPath = params.containsKey(CLASSPATH.getID()); boolean hasModule = params.containsKey(MODULE.getID()); - boolean runtimeInstaller = - params.containsKey(RUNTIME_INSTALLER.getID()); if (hasMainClass && hasMainJar && hasMainJarClassPath || hasModule || - runtimeInstaller) { + isRuntimeInstaller(params)) { return; } @@ -748,11 +639,9 @@ boolean hasMainJarClassPath = params.containsKey(CLASSPATH.getID()); boolean hasModule = params.containsKey(MODULE.getID()); boolean hasAppImage = params.containsKey(PREDEFINED_APP_IMAGE.getID()); - boolean runtimeInstaller = - params.containsKey(RUNTIME_INSTALLER.getID()); if (hasMainClass && hasMainJar && hasMainJarClassPath || - hasModule || runtimeInstaller || hasAppImage) { + hasModule || hasAppImage || isRuntimeInstaller(params)) { return; } @@ -775,7 +664,6 @@ } } - private static List splitStringWithEscapes(String s) { List l = new ArrayList<>(); StringBuilder current = new StringBuilder(); --- old/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ValidOptions.java 2019-03-05 14:53:45.556866000 -0500 +++ new/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ValidOptions.java 2019-03-05 14:53:44.464852000 -0500 @@ -47,137 +47,97 @@ */ class ValidOptions { - private ValidOptions() {}; - - // multimap that contains pairs of (mode, supported args) - private static final Map> options = - new HashMap<>(); + enum USE { + ALL, // valid in all cases + LAUNCHER, // valid when creating a launcher + INSTALL // valid when creating an installer + } + + private static final HashMap options = new HashMap<>(); - private static boolean argsInitialized = false; // initializing list of mandatory arguments - private static void initArgs() { - if (argsInitialized) { - return; - } - - // add options for CREATE_IMAGE - add(CLIOptions.CREATE_IMAGE, CLIOptions.INPUT); - add(CLIOptions.CREATE_IMAGE, CLIOptions.OUTPUT); - add(CLIOptions.CREATE_IMAGE, CLIOptions.APPCLASS); - add(CLIOptions.CREATE_IMAGE, CLIOptions.NAME); - add(CLIOptions.CREATE_IMAGE, CLIOptions.IDENTIFIER); - add(CLIOptions.CREATE_IMAGE, CLIOptions.VERBOSE); - add(CLIOptions.CREATE_IMAGE, CLIOptions.OVERWRITE); - add(CLIOptions.CREATE_IMAGE, CLIOptions.FILES); - add(CLIOptions.CREATE_IMAGE, CLIOptions.ARGUMENTS); - add(CLIOptions.CREATE_IMAGE, CLIOptions.STRIP_NATIVE_COMMANDS); - add(CLIOptions.CREATE_IMAGE, CLIOptions.ICON); - add(CLIOptions.CREATE_IMAGE, CLIOptions.VERSION); - add(CLIOptions.CREATE_IMAGE, CLIOptions.JVM_ARGS); - add(CLIOptions.CREATE_IMAGE, CLIOptions.SECONDARY_LAUNCHER); - add(CLIOptions.CREATE_IMAGE, CLIOptions.BUILD_ROOT); - add(CLIOptions.CREATE_IMAGE, CLIOptions.PREDEFINED_RUNTIME_IMAGE); - add(CLIOptions.CREATE_IMAGE, CLIOptions.MAIN_JAR); - add(CLIOptions.CREATE_IMAGE, CLIOptions.MODULE); - add(CLIOptions.CREATE_IMAGE, CLIOptions.ADD_MODULES); - add(CLIOptions.CREATE_IMAGE, CLIOptions.MODULE_PATH); - add(CLIOptions.CREATE_IMAGE, CLIOptions.RESOURCE_DIR); - - if (Platform.getPlatform() == Platform.MAC) { - add(CLIOptions.CREATE_IMAGE, CLIOptions.MAC_SIGN); - add(CLIOptions.CREATE_IMAGE, CLIOptions.MAC_BUNDLE_NAME); - add(CLIOptions.CREATE_IMAGE, CLIOptions.MAC_BUNDLE_IDENTIFIER); - add(CLIOptions.CREATE_IMAGE, CLIOptions.MAC_BUNDLE_SIGNING_PREFIX); - add(CLIOptions.CREATE_IMAGE, CLIOptions.MAC_SIGNING_KEY_NAME); - add(CLIOptions.CREATE_IMAGE, CLIOptions.MAC_SIGNING_KEYCHAIN); - add(CLIOptions.CREATE_IMAGE, CLIOptions.CATEGORY); - add(CLIOptions.CREATE_IMAGE, CLIOptions.COPYRIGHT); - } + static { + options.put(CLIOptions.CREATE_IMAGE.getId(), USE.ALL); + options.put(CLIOptions.CREATE_INSTALLER.getId(), USE.ALL); + options.put(CLIOptions.NAME.getId(), USE.ALL); + options.put(CLIOptions.VERSION.getId(), USE.ALL); + options.put(CLIOptions.OUTPUT.getId(), USE.ALL); + options.put(CLIOptions.TEMP_ROOT.getId(), USE.ALL); + options.put(CLIOptions.VERBOSE.getId(), USE.ALL); + options.put(CLIOptions.PREDEFINED_RUNTIME_IMAGE.getId(), USE.ALL); + options.put(CLIOptions.RESOURCE_DIR.getId(), USE.ALL); + options.put(CLIOptions.IDENTIFIER.getId(), USE.ALL); + options.put(CLIOptions.DESCRIPTION.getId(), USE.ALL); + options.put(CLIOptions.VENDOR.getId(), USE.ALL); + options.put(CLIOptions.COPYRIGHT.getId(), USE.ALL); + + options.put(CLIOptions.INPUT.getId(), USE.LAUNCHER); + options.put(CLIOptions.FILES.getId(), USE.LAUNCHER); + options.put(CLIOptions.MODULE.getId(), USE.LAUNCHER); + options.put(CLIOptions.MODULE_PATH.getId(), USE.LAUNCHER); + options.put(CLIOptions.ADD_MODULES.getId(), USE.LAUNCHER); + options.put(CLIOptions.MAIN_JAR.getId(), USE.LAUNCHER); + options.put(CLIOptions.APPCLASS.getId(), USE.LAUNCHER); + options.put(CLIOptions.ICON.getId(), USE.LAUNCHER); + options.put(CLIOptions.ARGUMENTS.getId(), USE.LAUNCHER); + options.put(CLIOptions.JVM_ARGS.getId(), USE.LAUNCHER); + options.put(CLIOptions.ADD_LAUNCHER.getId(), USE.LAUNCHER); + + options.put(CLIOptions.INSTALLER_TYPE.getId(), USE.INSTALL); + options.put(CLIOptions.LICENSE_FILE.getId(), USE.INSTALL); + options.put(CLIOptions.FILE_ASSOCIATIONS.getId(), USE.INSTALL); + options.put(CLIOptions.INSTALL_DIR.getId(), USE.INSTALL); + options.put(CLIOptions.PREDEFINED_APP_IMAGE.getId(), USE.INSTALL); + options.put(CLIOptions.INSTALLER_TYPE.getId(), USE.INSTALL); if (Platform.getPlatform() == Platform.WINDOWS) { - add(CLIOptions.CREATE_IMAGE, CLIOptions.DESCRIPTION); - add(CLIOptions.CREATE_IMAGE, CLIOptions.VENDOR); - add(CLIOptions.CREATE_IMAGE, CLIOptions.COPYRIGHT); - add(CLIOptions.CREATE_IMAGE, CLIOptions.WIN_CONSOLE_HINT); - } + options.put(CLIOptions.WIN_CONSOLE_HINT.getId(), USE.LAUNCHER); - // add options for CREATE_INSTALLER - // (start with all options for CREATE_IMAGE) - Set imageOptions = options.get(CLIOptions.CREATE_IMAGE); - imageOptions.forEach(o -> add(CLIOptions.CREATE_INSTALLER, o)); - - add(CLIOptions.CREATE_INSTALLER, CLIOptions.RUNTIME_INSTALLER); - add(CLIOptions.CREATE_INSTALLER, CLIOptions.INSTALLER_TYPE); - add(CLIOptions.CREATE_INSTALLER, CLIOptions.LICENSE_FILE); - add(CLIOptions.CREATE_INSTALLER, CLIOptions.FILE_ASSOCIATIONS); - add(CLIOptions.CREATE_INSTALLER, CLIOptions.INSTALL_DIR); - add(CLIOptions.CREATE_INSTALLER, CLIOptions.PREDEFINED_APP_IMAGE); - add(CLIOptions.CREATE_INSTALLER, CLIOptions.INSTALLER_TYPE); + options.put(CLIOptions.WIN_MENU_HINT.getId(), USE.INSTALL); + options.put(CLIOptions.WIN_MENU_GROUP.getId(), USE.INSTALL); + options.put(CLIOptions.WIN_SHORTCUT_HINT.getId(), USE.INSTALL); + options.put(CLIOptions.WIN_DIR_CHOOSER.getId(), USE.INSTALL); + options.put(CLIOptions.WIN_REGISTRY_NAME.getId(), USE.INSTALL); + options.put(CLIOptions.WIN_UPGRADE_UUID.getId(), USE.INSTALL); + options.put(CLIOptions.WIN_PER_USER_INSTALLATION.getId(), + USE.INSTALL); + } if (Platform.getPlatform() == Platform.MAC) { - add(CLIOptions.CREATE_INSTALLER, CLIOptions.MAC_APP_STORE_CATEGORY); - add(CLIOptions.CREATE_INSTALLER, - CLIOptions.MAC_APP_STORE_ENTITLEMENTS); + options.put(CLIOptions.MAC_SIGN.getId(), USE.INSTALL); + options.put(CLIOptions.MAC_BUNDLE_NAME.getId(), USE.INSTALL); + options.put(CLIOptions.MAC_BUNDLE_IDENTIFIER.getId(), USE.INSTALL); + options.put(CLIOptions.MAC_BUNDLE_SIGNING_PREFIX.getId(), + USE.INSTALL); + options.put(CLIOptions.MAC_SIGNING_KEY_NAME.getId(), USE.INSTALL); + options.put(CLIOptions.MAC_SIGNING_KEYCHAIN.getId(), USE.INSTALL); + options.put(CLIOptions.MAC_APP_STORE_CATEGORY.getId(), USE.INSTALL); + options.put(CLIOptions.MAC_APP_STORE_ENTITLEMENTS.getId(), + USE.INSTALL); } if (Platform.getPlatform() == Platform.LINUX) { - add(CLIOptions.CREATE_INSTALLER, CLIOptions.LINUX_BUNDLE_NAME); - add(CLIOptions.CREATE_INSTALLER, CLIOptions.LINUX_DEB_MAINTAINER); - add(CLIOptions.CREATE_INSTALLER, CLIOptions.LINUX_RPM_LICENSE_TYPE); - add(CLIOptions.CREATE_INSTALLER, - CLIOptions.LINUX_PACKAGE_DEPENDENCIES); - add(CLIOptions.CREATE_INSTALLER, CLIOptions.DESCRIPTION); - add(CLIOptions.CREATE_INSTALLER, CLIOptions.VENDOR); - add(CLIOptions.CREATE_INSTALLER, CLIOptions.CATEGORY); - add(CLIOptions.CREATE_INSTALLER, CLIOptions.COPYRIGHT); + options.put(CLIOptions.LINUX_BUNDLE_NAME.getId(), USE.INSTALL); + options.put(CLIOptions.LINUX_DEB_MAINTAINER.getId(), USE.INSTALL); + options.put(CLIOptions.LINUX_RPM_LICENSE_TYPE.getId(), USE.INSTALL); + options.put(CLIOptions.LINUX_PACKAGE_DEPENDENCIES.getId(), + USE.INSTALL); + options.put(CLIOptions.LINUX_MENU_GROUP.getId(), USE.INSTALL); } - - if (Platform.getPlatform() == Platform.WINDOWS) { - add(CLIOptions.CREATE_INSTALLER, CLIOptions.WIN_MENU_HINT); - add(CLIOptions.CREATE_INSTALLER, CLIOptions.WIN_MENU_GROUP); - add(CLIOptions.CREATE_INSTALLER, CLIOptions.WIN_SHORTCUT_HINT); - add(CLIOptions.CREATE_INSTALLER, - CLIOptions.WIN_PER_USER_INSTALLATION); - add(CLIOptions.CREATE_INSTALLER, CLIOptions.WIN_DIR_CHOOSER); - add(CLIOptions.CREATE_INSTALLER, CLIOptions.WIN_REGISTRY_NAME); - add(CLIOptions.CREATE_INSTALLER, CLIOptions.WIN_UPGRADE_UUID); - add(CLIOptions.CREATE_INSTALLER, CLIOptions.CATEGORY); - add(CLIOptions.CREATE_INSTALLER, CLIOptions.WIN_CONSOLE_HINT); - } - - argsInitialized = true; } - static void add(CLIOptions mode, CLIOptions arg) { - if (mode.equals(arg)) { - return; - } - options.computeIfAbsent(mode, - k -> new HashSet<>()).add(arg); + static boolean checkIfSupported(CLIOptions arg) { + return options.containsKey(arg.getId()); } - static boolean checkIfSupported(CLIOptions mode, CLIOptions arg) { - if (mode.equals(arg)) { - return true; - } - - initArgs(); - Set set = options.get(mode); - if (set != null) { - return set.contains(arg); - } - return false; + static boolean checkIfImageSupported(CLIOptions arg) { + USE use = options.get(arg.getId()); + return USE.ALL == use || USE.LAUNCHER == use; } - static boolean checkIfOtherSupported(CLIOptions mode, CLIOptions arg) { - for (CLIOptions other : options.keySet()) { - if (!other.equals(mode)) { - if (checkIfSupported(other, arg)) { - return true; - } - } - } - return false; + static boolean checkIfInstallerSupported(CLIOptions arg) { + USE use = options.get(arg.getId()); + return USE.ALL == use || USE.INSTALL == use; } } --- old/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties 2019-03-05 14:53:50.768332900 -0500 +++ new/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties 2019-03-05 14:53:49.707519300 -0500 @@ -24,101 +24,11 @@ # # -param.images-root.name=Image Root -param.images-root.description=Image Root -param.config-root.name=Config Root -param.config-root.description=Config root dir -param.create-image.name=Create Image -param.create-image.description=Creates platform-specific application image. -param.create-installer.name=Create Installer -param.create-installer.description=Creates platform-specific installer for the application. -param.create-jre-installer.name=Create JRE Installer -param.create-jre-installer.description=Creates platform-specific JRE installer. -param.app-name.name=App Name -param.app-name.description=The name of the application. -param.app-resource.description=All of the files to place in the resources directory. Including all needed jars as assets. -param.app-resources.name=Resources -param.app-resource-list.description=A List of RelativeFileSet objects containing all of the files to place in the resources directory. Including all needed jars as assets. -param.app-resources-list.name=Resources List -param.build-root.name=Build Root -param.build-root.description=The directory in which to use and place temporary files. -param.category.name=Category -param.category.description=The category or group of the application. Generally speaking you will also want to specify application specific categories as well. param.category.default=Unknown -param.copyright.name=Copyright -param.copyright.description=The copyright for the application. param.copyright.default=Copyright (C) {0,date,YYYY} -param.description.name=Description -param.description.description=A longer description of the application param.description.default=none -param.icon-file.name=Icon -param.icon-file.description=The main icon of the application bundle. -param.identifier.name=Identifier -param.identifier.description=What is the machine readable identifier of this application? The format should be a DNS name in reverse order, such as com.example.myapplication. -param.arguments.name=Command Line Arguments -param.arguments.description=Command Line Arguments to be passed to the main class if no arguments are specified by the launcher. -param.jvm-options.name=JVM Options -param.jvm-options.description=JVM flags and options to be passed in. -param.jvm-system-properties.name=JVM System Properties -param.jvm-system-properties.description=JVM System Properties (of the -Dname\=value variety). -param.license-file.name=License -param.license-file.description=The license file, relative to the assembled application directory. -param.main-class.name=Main Class -param.main-class.description=The main class for the application. Either a javafx.application.Application instance or a java class with a main method. -param.main-module.name=Main Module -param.main-module.description=The main module for the application. This is the module containing the main class. -param.classpath.name=Main Jar Classpath -param.classpath.description=The classpath from the main jar of the application, relative to the assembled application directory. -param.main-jar.name=Main Jar -param.main-jar.description=The main jar of the application. This jar should have the main-class, and is relative to the assembled application dir. -param.name.name=Name -param.name.description=The name of the application. -param.preferences-id.name=Preferences ID -param.preferences-id.description=The preferences node to search for User JVM Options. The format be a slash delimited version of the main package name, such as "com/example/myapplication". -param.title.name=Title -param.title.description=A title for the application. -param.vendor.name=Vendor -param.vendor.description=The vendor of the application. param.vendor.default=Unknown -param.predefined-app-image.name=Predefined Application Image -param.predefined-app-image.description=Location of the predefined application image that is used to build an installable package. -param.predefined-runtime-image.name=Predefined Runtime Image -param.predefined-runtime-image.description=Location of the custom runtime image that is used to build an application image and installable packages. -param.version.name=Version -param.version.description=The version of this application. param.version.default=1.0 -param.verbose.name=Verbose -param.verbose.description=Flag to print out more information and saves configuration files for bundlers. -param.overwrite.name=Overwrite -param.overwrite.description=Flag to allow removal of existing application output directory -param.resource-dir.name=Resource Dir -param.resource-dir.description=The directory to look for bundler specific resources. -param.secondary-launchers.name=Secondary Launchers -param.secondary-launchers.description=A collection of bundle param info for secondary launchers -param.file-associations.name=File Associations -param.file-associations.description=A list of maps where each map describes a file association. Uses the "fileAssociation." series of bundle arguments in each map. -param.fa-extension.name=File Association Extension -param.fa-extension.description=The File Extension to be associated, just the extension no dots. -param.fa-content-type.name=File Association Content Type -param.fa-content-type.description=Content Type to be associated. Such as application/x-vnd.my-awesome-app. -param.fa-icon.name=File Association Icon -param.fa-icon.description=The Icon to be used for associated files. Defaults to the application icon. -param.fa-description.name=File Association Description -param.fa-description.description=The description to be used for associated files. The default is " File". -param.source-dir.name=Source Directory -param.source-dir.description=Path to the directory containing the files to be bundled. -param.module-path.name=Module Path -param.module-path.description=When packaging the Java Runtime, this is the path jlink will look in for modules. -param.add-modules.name=Add Modules -param.add-modules.description=List of Modules to add to JImage creation, including possible services. -param.limit-modules.name=Limit Modules -param.limit-modules.description=Modules to Limit JImage creation to. -param.strip-executables.name=Strip Native Executables -param.strip-executables.description=Removes native executables from the JImage creation. -param.main.module.name=Main Module -param.main.module.description=The main module of the application. This module should have the main-class, and is on the module path. -param.install-dir.name=Installation Directory -param.install-dir.description=Installation directory of the application. message.using-default-resource=Using default package resource {0} {1} (add {2} to the resource-dir to customize) message.no-default-resource=no default package resource {0} {1} (add {2} to the resource-dir to customize) @@ -135,7 +45,7 @@ error.cannot-create-output-dir=Output directory {0} cannot be created. error.cannot-write-to-output-dir=Output directory {0} is not writable. -error.root-exists-without-overwrite=Error: Application output directory {0} already exists and --overwrite is not specified +error.root-exists=Error: Application output directory {0} already exists error.no-application-class=Main application class is missing. error.no-application-class.advice=Please specify main application class. error.no-main-module=Main application module is missing. @@ -149,8 +59,6 @@ warning.module.does.not.exist=Module [{0}] does not exist. warning.no.jdk.modules.found=Warning: No JDK Modules found. -warning.unsupported.option=Warning: Option [{0}] is not supported on this platform. -warning.unsupported.mode.option=Warning: Option [{0}] is not supported in {1} mode. warning.missing.arg.file=Warning: Missing argument file: {0} MSG_BundlerFailed=Error: Bundler "{1}" ({0}) failed to produce a bundle. @@ -163,17 +71,26 @@ MSG_BundlerFailed=Error: Bundler "{1}" ({0}) failed to produce a bundle. + +ERR_UnsupportedOption=Error: Option [{0}] is not valid on this platform. +ERR_NotImageOption=Error: Option [{0}] is not valid in create-image mode. +ERR_NotInstallerOption=Error: Option [{0}] is not valid with --app-image option +ERR_NoInstallerEntryPoint=Error: Option [{0}] is not valid without --module or --main-jar entry point option. + ERR_MissingMode=Error: Mode is not specified ERR_MissingArgument=Error: Missing argument: {0} ERR_MissingAppResources=Error: No application jars found ERR_AppImageNotExist=Error: App image directory "{0}" does not exist ERR_AppImageInvalid=Error: App image directory "{0}" does not contain "app" sub-directory -ERR_NoSecondaryLauncherName=Error: Secondary Launchers require a name parameter. -ERR_NoUniqueName=Error: Secondary Launchers require a unique name parameter. +ERR_NoAddLauncherName=Error: Add Launchers require a name parameter. +ERR_NoUniqueName=Error: Add Launchers require a unique name parameter. ERR_NoJreInstallerName=Error: Jre Installers require a name parameter. ERR_InvalidAppName=Error: Invalid Application name: {0}. -ERR_InvalidSLName=Error: Invalid Secondary Launcher name: {0}. +ERR_InvalidSLName=Error: Invalid Add Launcher name: {0}. ERR_LicenseFileNotExit=Error: Specified license file does not exist. -ERR_BuildRootInvalid=Error: build-root ({0}) must be empty directory. +ERR_BuildRootInvalid=Error: temp-root ({0}) must be non-existant directory. ERR_InvalidOption=Error: Invalid Option: [{0}] ERR_VersionComparison=Error: Failed to compare version {0} with {1}. +ERR_InvalidInstallerType=Error: Invalid or Unsupported Installer type: [{0}]. +ERR_BothMainJarAndModule="Error: Cannot have both --main-jar and --module Options" +ERR_NoEntryPoint="Error: create-image requires --main-jar or --module Option" --- old/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties 2019-03-05 14:53:56.119201500 -0500 +++ new/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties 2019-03-05 14:53:55.073988100 -0500 @@ -24,101 +24,11 @@ # # -param.images-root.name=Image Root -param.images-root.description=Image Root -param.config-root.name=Config Root -param.config-root.description=Config root dir -param.create-image.name=Create Image -param.create-image.description=Creates platform-specific application image. -param.create-installer.name=Create Installer -param.create-installer.description=Creates platform-specific installer for the application. -param.create-jre-installer.name=Create JRE Installer -param.create-jre-installer.description=Creates platform-specific JRE installer. -param.app-name.name=App Name -param.app-name.description=The name of the application. -param.app-resource.description=All of the files to place in the resources directory. Including all needed jars as assets. -param.app-resources.name=Resources -param.app-resource-list.description=A List of RelativeFileSet objects containing all of the files to place in the resources directory. Including all needed jars as assets. -param.app-resources-list.name=Resources List -param.build-root.name=Build Root -param.build-root.description=The directory in which to use and place temporary files. -param.category.name=Category -param.category.description=The category or group of the application. Generally speaking you will also want to specify application specific categories as well. param.category.default=Unknown -param.copyright.name=Copyright -param.copyright.description=The copyright for the application. param.copyright.default=Copyright (C) {0,date,YYYY} -param.description.name=Description -param.description.description=A longer description of the application param.description.default=none -param.icon-file.name=Icon -param.icon-file.description=The main icon of the application bundle. -param.identifier.name=Identifier -param.identifier.description=What is the machine readable identifier of this application? The format should be a DNS name in reverse order, such as com.example.myapplication. -param.arguments.name=Command Line Arguments -param.arguments.description=Command Line Arguments to be passed to the main class if no arguments are specified by the launcher. -param.jvm-options.name=JVM Options -param.jvm-options.description=JVM flags and options to be passed in. -param.jvm-system-properties.name=JVM System Properties -param.jvm-system-properties.description=JVM System Properties (of the -Dname\=value variety). -param.license-file.name=License -param.license-file.description=The license file, relative to the assembled application directory. -param.main-class.name=Main Class -param.main-class.description=The main class for the application. Either a javafx.application.Application instance or a java class with a main method. -param.main-module.name=Main Module -param.main-module.description=The main module for the application. This is the module containing the main class. -param.classpath.name=Main Jar Classpath -param.classpath.description=The classpath from the main jar of the application, relative to the assembled application directory. -param.main-jar.name=Main Jar -param.main-jar.description=The main jar of the application. This jar should have the main-class, and is relative to the assembled application dir. -param.name.name=Name -param.name.description=The name of the application. -param.preferences-id.name=Preferences ID -param.preferences-id.description=The preferences node to search for User JVM Options. The format be a slash delimited version of the main package name, such as "com/example/myapplication". -param.title.name=Title -param.title.description=A title for the application. -param.vendor.name=Vendor -param.vendor.description=The vendor of the application. param.vendor.default=Unknown -param.predefined-app-image.name=Predefined Application Image -param.predefined-app-image.description=Location of the predefined application image that is used to build an installable package. -param.predefined-runtime-image.name=Predefined Runtime Image -param.predefined-runtime-image.description=Location of the custom runtime image that is used to build an application image and installable packages. -param.version.name=Version -param.version.description=The version of this application. param.version.default=1.0 -param.verbose.name=Verbose -param.verbose.description=Flag to print out more information and saves configuration files for bundlers. -param.overwrite.name=Overwrite -param.overwrite.description=Flag to allow removal of existing application output directory -param.resource-dir.name=Resource Dir -param.resource-dir.description=The directory to look for bundler specific resources. -param.secondary-launchers.name=Secondary Launchers -param.secondary-launchers.description=A collection of bundle param info for secondary launchers -param.file-associations.name=File Associations -param.file-associations.description=A list of maps where each map describes a file association. Uses the "fileAssociation." series of bundle arguments in each map. -param.fa-extension.name=File Association Extension -param.fa-extension.description=The File Extension to be associated, just the extension no dots. -param.fa-content-type.name=File Association Content Type -param.fa-content-type.description=Content Type to be associated. Such as application/x-vnd.my-awesome-app. -param.fa-icon.name=File Association Icon -param.fa-icon.description=The Icon to be used for associated files. Defaults to the application icon. -param.fa-description.name=File Association Description -param.fa-description.description=The description to be used for associated files. The default is " File". -param.source-dir.name=Source Directory -param.source-dir.description=Path to the directory containing the files to be bundled. -param.module-path.name=Module Path -param.module-path.description=When packaging the Java Runtime, this is the path jlink will look in for modules. -param.add-modules.name=Add Modules -param.add-modules.description=List of Modules to add to JImage creation, including possible services. -param.limit-modules.name=Limit Modules -param.limit-modules.description=Modules to Limit JImage creation to. -param.strip-executables.name=Strip Native Executables -param.strip-executables.description=Removes native executables from the JImage creation. -param.main.module.name=Main Module -param.main.module.description=The main module of the application. This module should have the main-class, and is on the module path. -param.install-dir.name=Installation Directory -param.install-dir.description=Installation directory of the application. message.using-default-resource=Using default package resource {0} {1} (add {2} to the resource-dir to customize) message.no-default-resource=no default package resource {0} {1} (add {2} to the resource-dir to customize) @@ -135,7 +45,7 @@ error.cannot-create-output-dir=Output directory {0} cannot be created. error.cannot-write-to-output-dir=Output directory {0} is not writable. -error.root-exists-without-overwrite=Error: Application output directory {0} already exists and --overwrite is not specified +error.root-exists=Error: Application output directory {0} already exists error.no-application-class=Main application class is missing. error.no-application-class.advice=Please specify main application class. error.no-main-module=Main application module is missing. @@ -149,8 +59,6 @@ warning.module.does.not.exist=Module [{0}] does not exist. warning.no.jdk.modules.found=Warning: No JDK Modules found. -warning.unsupported.option=Warning: Option [{0}] is not supported on this platform. -warning.unsupported.mode.option=Warning: Option [{0}] is not supported in {1} mode. warning.missing.arg.file=Warning: Missing argument file: {0} MSG_BundlerFailed=Error: Bundler "{1}" ({0}) failed to produce a bundle. @@ -163,17 +71,26 @@ MSG_BundlerFailed=Error: Bundler "{1}" ({0}) failed to produce a bundle. + +ERR_UnsupportedOption=Error: Option [{0}] is not valid on this platform. +ERR_NotImageOption=Error: Option [{0}] is not valid in create-image mode. +ERR_NotInstallerOption=Error: Option [{0}] is not valid with --app-image option +ERR_NoInstallerEntryPoint=Error: Option [{0}] is not valid without --module or --main-jar entry point option. + ERR_MissingMode=Error: Mode is not specified ERR_MissingArgument=Error: Missing argument: {0} ERR_MissingAppResources=Error: No application jars found ERR_AppImageNotExist=Error: App image directory "{0}" does not exist ERR_AppImageInvalid=Error: App image directory "{0}" does not contain "app" sub-directory -ERR_NoSecondaryLauncherName=Error: Secondary Launchers require a name parameter. -ERR_NoUniqueName=Error: Secondary Launchers require a unique name parameter. +ERR_NoAddLauncherName=Error: Add Launchers require a name parameter. +ERR_NoUniqueName=Error: Add Launchers require a unique name parameter. ERR_NoJreInstallerName=Error: Jre Installers require a name parameter. ERR_InvalidAppName=Error: Invalid Application name: {0}. -ERR_InvalidSLName=Error: Invalid Secondary Launcher name: {0}. +ERR_InvalidSLName=Error: Invalid Add Launcher name: {0}. ERR_LicenseFileNotExit=Error: Specified license file does not exist. -ERR_BuildRootInvalid=Error: build-root ({0}) must be empty directory. +ERR_BuildRootInvalid=Error: temp-root ({0}) must be non-existant directory. ERR_InvalidOption=Error: Invalid Option: [{0}] ERR_VersionComparison=Error: Failed to compare version {0} with {1}. +ERR_InvalidInstallerType=Error: Invalid or Unsupported Installer type: [{0}]. +ERR_BothMainJarAndModule="Error: Cannot have both --main-jar and --module Options" +ERR_NoEntryPoint="Error: create-image requires --main-jar or --module Option" --- old/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties 2019-03-05 14:54:01.329668300 -0500 +++ new/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties 2019-03-05 14:54:00.300055100 -0500 @@ -24,101 +24,11 @@ # # -param.images-root.name=Image Root -param.images-root.description=Image Root -param.config-root.name=Config Root -param.config-root.description=Config root dir -param.create-image.name=Create Image -param.create-image.description=Creates platform-specific application image. -param.create-installer.name=Create Installer -param.create-installer.description=Creates platform-specific installer for the application. -param.create-jre-installer.name=Create JRE Installer -param.create-jre-installer.description=Creates platform-specific JRE installer. -param.app-name.name=App Name -param.app-name.description=The name of the application. -param.app-resource.description=All of the files to place in the resources directory. Including all needed jars as assets. -param.app-resources.name=Resources -param.app-resource-list.description=A List of RelativeFileSet objects containing all of the files to place in the resources directory. Including all needed jars as assets. -param.app-resources-list.name=Resources List -param.build-root.name=Build Root -param.build-root.description=The directory in which to use and place temporary files. -param.category.name=Category -param.category.description=The category or group of the application. Generally speaking you will also want to specify application specific categories as well. param.category.default=Unknown -param.copyright.name=Copyright -param.copyright.description=The copyright for the application. param.copyright.default=Copyright (C) {0,date,YYYY} -param.description.name=Description -param.description.description=A longer description of the application param.description.default=none -param.icon-file.name=Icon -param.icon-file.description=The main icon of the application bundle. -param.identifier.name=Identifier -param.identifier.description=What is the machine readable identifier of this application? The format should be a DNS name in reverse order, such as com.example.myapplication. -param.arguments.name=Command Line Arguments -param.arguments.description=Command Line Arguments to be passed to the main class if no arguments are specified by the launcher. -param.jvm-options.name=JVM Options -param.jvm-options.description=JVM flags and options to be passed in. -param.jvm-system-properties.name=JVM System Properties -param.jvm-system-properties.description=JVM System Properties (of the -Dname\=value variety). -param.license-file.name=License -param.license-file.description=The license file, relative to the assembled application directory. -param.main-class.name=Main Class -param.main-class.description=The main class for the application. Either a javafx.application.Application instance or a java class with a main method. -param.main-module.name=Main Module -param.main-module.description=The main module for the application. This is the module containing the main class. -param.classpath.name=Main Jar Classpath -param.classpath.description=The classpath from the main jar of the application, relative to the assembled application directory. -param.main-jar.name=Main Jar -param.main-jar.description=The main jar of the application. This jar should have the main-class, and is relative to the assembled application dir. -param.name.name=Name -param.name.description=The name of the application. -param.preferences-id.name=Preferences ID -param.preferences-id.description=The preferences node to search for User JVM Options. The format be a slash delimited version of the main package name, such as "com/example/myapplication". -param.title.name=Title -param.title.description=A title for the application. -param.vendor.name=Vendor -param.vendor.description=The vendor of the application. param.vendor.default=Unknown -param.predefined-app-image.name=Predefined Application Image -param.predefined-app-image.description=Location of the predefined application image that is used to build an installable package. -param.predefined-runtime-image.name=Predefined Runtime Image -param.predefined-runtime-image.description=Location of the custom runtime image that is used to build an application image and installable packages. -param.version.name=Version -param.version.description=The version of this application. param.version.default=1.0 -param.verbose.name=Verbose -param.verbose.description=Flag to print out more information and saves configuration files for bundlers. -param.overwrite.name=Overwrite -param.overwrite.description=Flag to allow removal of existing application output directory -param.resource-dir.name=Resource Dir -param.resource-dir.description=The directory to look for bundler specific resources. -param.secondary-launchers.name=Secondary Launchers -param.secondary-launchers.description=A collection of bundle param info for secondary launchers -param.file-associations.name=File Associations -param.file-associations.description=A list of maps where each map describes a file association. Uses the "fileAssociation." series of bundle arguments in each map. -param.fa-extension.name=File Association Extension -param.fa-extension.description=The File Extension to be associated, just the extension no dots. -param.fa-content-type.name=File Association Content Type -param.fa-content-type.description=Content Type to be associated. Such as application/x-vnd.my-awesome-app. -param.fa-icon.name=File Association Icon -param.fa-icon.description=The Icon to be used for associated files. Defaults to the application icon. -param.fa-description.name=File Association Description -param.fa-description.description=The description to be used for associated files. The default is " File". -param.source-dir.name=Source Directory -param.source-dir.description=Path to the directory containing the files to be bundled. -param.module-path.name=Module Path -param.module-path.description=When packaging the Java Runtime, this is the path jlink will look in for modules. -param.add-modules.name=Add Modules -param.add-modules.description=List of Modules to add to JImage creation, including possible services. -param.limit-modules.name=Limit Modules -param.limit-modules.description=Modules to Limit JImage creation to. -param.strip-executables.name=Strip Native Executables -param.strip-executables.description=Removes native executables from the JImage creation. -param.main.module.name=Main Module -param.main.module.description=The main module of the application. This module should have the main-class, and is on the module path. -param.install-dir.name=Installation Directory -param.install-dir.description=Installation directory of the application. message.using-default-resource=Using default package resource {0} {1} (add {2} to the resource-dir to customize) message.no-default-resource=no default package resource {0} {1} (add {2} to the resource-dir to customize) @@ -135,7 +45,7 @@ error.cannot-create-output-dir=Output directory {0} cannot be created. error.cannot-write-to-output-dir=Output directory {0} is not writable. -error.root-exists-without-overwrite=Error: Application output directory {0} already exists and --overwrite is not specified +error.root-exists=Error: Application output directory {0} already exists error.no-application-class=Main application class is missing. error.no-application-class.advice=Please specify main application class. error.no-main-module=Main application module is missing. @@ -149,8 +59,6 @@ warning.module.does.not.exist=Module [{0}] does not exist. warning.no.jdk.modules.found=Warning: No JDK Modules found. -warning.unsupported.option=Warning: Option [{0}] is not supported on this platform. -warning.unsupported.mode.option=Warning: Option [{0}] is not supported in {1} mode. warning.missing.arg.file=Warning: Missing argument file: {0} MSG_BundlerFailed=Error: Bundler "{1}" ({0}) failed to produce a bundle. @@ -163,17 +71,26 @@ MSG_BundlerFailed=Error: Bundler "{1}" ({0}) failed to produce a bundle. + +ERR_UnsupportedOption=Error: Option [{0}] is not valid on this platform. +ERR_NotImageOption=Error: Option [{0}] is not valid in create-image mode. +ERR_NotInstallerOption=Error: Option [{0}] is not valid with --app-image option +ERR_NoInstallerEntryPoint=Error: Option [{0}] is not valid without --module or --main-jar entry point option. + ERR_MissingMode=Error: Mode is not specified ERR_MissingArgument=Error: Missing argument: {0} ERR_MissingAppResources=Error: No application jars found ERR_AppImageNotExist=Error: App image directory "{0}" does not exist ERR_AppImageInvalid=Error: App image directory "{0}" does not contain "app" sub-directory -ERR_NoSecondaryLauncherName=Error: Secondary Launchers require a name parameter. -ERR_NoUniqueName=Error: Secondary Launchers require a unique name parameter. +ERR_NoAddLauncherName=Error: Add Launchers require a name parameter. +ERR_NoUniqueName=Error: Add Launchers require a unique name parameter. ERR_NoJreInstallerName=Error: Jre Installers require a name parameter. ERR_InvalidAppName=Error: Invalid Application name: {0}. -ERR_InvalidSLName=Error: Invalid Secondary Launcher name: {0}. +ERR_InvalidSLName=Error: Invalid Add Launcher name: {0}. ERR_LicenseFileNotExit=Error: Specified license file does not exist. -ERR_BuildRootInvalid=Error: build-root ({0}) must be empty directory. +ERR_BuildRootInvalid=Error: temp-root ({0}) must be non-existant directory. ERR_InvalidOption=Error: Invalid Option: [{0}] ERR_VersionComparison=Error: Failed to compare version {0} with {1}. +ERR_InvalidInstallerType=Error: Invalid or Unsupported Installer type: [{0}]. +ERR_BothMainJarAndModule="Error: Cannot have both --main-jar and --module Options" +ERR_NoEntryPoint="Error: create-image requires --main-jar or --module Option" --- old/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinAppBundler.java 2019-03-05 14:54:06.415333500 -0500 +++ new/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinAppBundler.java 2019-03-05 14:54:05.385720300 -0500 @@ -46,8 +46,6 @@ static final BundlerParamInfo ICON_ICO = new StandardBundlerParam<>( - I18N.getString("param.icon-ico.name"), - I18N.getString("param.icon-ico.description"), "icon.ico", File.class, params -> { @@ -171,41 +169,18 @@ File doBundle(Map p, File outputDirectory, boolean dependentTask) throws PackagerException { - if (RUNTIME_INSTALLER.fetchFrom(p)) { - return doJreBundle(p, outputDirectory, dependentTask); + if (StandardBundlerParam.isRuntimeInstaller(p)) { + return PREDEFINED_RUNTIME_IMAGE.fetchFrom(p); } else { return doAppBundle(p, outputDirectory, dependentTask); } } - File doJreBundle(Map p, File outputDirectory, - boolean dependentTask) throws PackagerException { - try { - File rootDirectory = createRoot(p, outputDirectory, dependentTask, - APP_NAME.fetchFrom(p), "windowsapp-image-builder"); - AbstractAppImageBuilder appBuilder = new WindowsAppImageBuilder( - APP_NAME.fetchFrom(p), - outputDirectory.toPath()); - File predefined = PREDEFINED_RUNTIME_IMAGE.fetchFrom(p); - if (predefined == null ) { - JLinkBundlerHelper.generateJre(p, appBuilder); - } else { - return predefined; - } - return rootDirectory; - } catch (PackagerException pe) { - throw pe; - } catch (Exception e) { - Log.verbose(e); - throw new PackagerException(e); - } - } - File doAppBundle(Map p, File outputDirectory, boolean dependentTask) throws PackagerException { try { File rootDirectory = createRoot(p, outputDirectory, dependentTask, - APP_NAME.fetchFrom(p), "windowsapp-image-builder"); + APP_NAME.fetchFrom(p)); AbstractAppImageBuilder appBuilder = new WindowsAppImageBuilder(p, outputDirectory.toPath()); if (PREDEFINED_RUNTIME_IMAGE.fetchFrom(p) == null ) { --- old/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinExeBundler.java 2019-03-05 14:54:11.625800300 -0500 +++ new/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinExeBundler.java 2019-03-05 14:54:10.611787300 -0500 @@ -42,8 +42,6 @@ public static final BundlerParamInfo APP_BUNDLER = new WindowsBundlerParam<>( - getString("param.exe-bundler.name"), - getString("param.exe-bundler.description"), "win.app.bundler", WinAppBundler.class, params -> new WinAppBundler(), @@ -51,8 +49,6 @@ public static final BundlerParamInfo EXE_IMAGE_DIR = new WindowsBundlerParam<>( - getString("param.image-dir.name"), - getString("param.image-dir.description"), "win.exe.imageDir", File.class, params -> { @@ -64,8 +60,6 @@ public static final BundlerParamInfo WIN_APP_IMAGE = new WindowsBundlerParam<>( - getString("param.app-dir.name"), - getString("param.app-dir.description"), "win.app.image", File.class, null, @@ -73,8 +67,6 @@ public static final BundlerParamInfo UPGRADE_UUID = new WindowsBundlerParam<>( - I18N.getString("param.upgrade-uuid.name"), - I18N.getString("param.upgrade-uuid.description"), Arguments.CLIOptions.WIN_UPGRADE_UUID.getId(), UUID.class, params -> UUID.randomUUID(), @@ -82,8 +74,6 @@ public static final StandardBundlerParam EXE_SYSTEM_WIDE = new StandardBundlerParam<>( - getString("param.system-wide.name"), - getString("param.system-wide.description"), Arguments.CLIOptions.WIN_PER_USER_INSTALLATION.getId(), Boolean.class, params -> true, // default to system wide @@ -92,8 +82,6 @@ ); public static final StandardBundlerParam PRODUCT_VERSION = new StandardBundlerParam<>( - getString("param.product-version.name"), - getString("param.product-version.description"), "win.msi.productVersion", String.class, VERSION::fetchFrom, @@ -102,8 +90,6 @@ public static final StandardBundlerParam MENU_HINT = new WindowsBundlerParam<>( - getString("param.menu-shortcut-hint.name"), - getString("param.menu-shortcut-hint.description"), Arguments.CLIOptions.WIN_MENU_HINT.getId(), Boolean.class, params -> false, @@ -113,8 +99,6 @@ public static final StandardBundlerParam SHORTCUT_HINT = new WindowsBundlerParam<>( - getString("param.desktop-shortcut-hint.name"), - getString("param.desktop-shortcut-hint.description"), Arguments.CLIOptions.WIN_SHORTCUT_HINT.getId(), Boolean.class, params -> false, @@ -128,8 +112,6 @@ public static final BundlerParamInfo TOOL_INNO_SETUP_COMPILER_EXECUTABLE = new WindowsBundlerParam<>( - getString("param.iscc-path.name"), - getString("param.iscc-path.description"), "win.exe.iscc.exe", String.class, params -> { @@ -374,7 +356,7 @@ String tempDirectory = WindowsDefender.getUserTempDirectory(); if (Arguments.CLIOptions.context().userProvidedBuildRoot) { - tempDirectory = BUILD_ROOT.fetchFrom(p).getAbsolutePath(); + tempDirectory = TEMP_ROOT.fetchFrom(p).getAbsolutePath(); } if (WindowsDefender.isThereAPotentialWindowsDefenderIssue( tempDirectory)) { @@ -539,36 +521,36 @@ Log.verbose("setting APPLICATION_IMAGE to " + innosetupEscape(imagePathString) + " for InnoSetup"); - StringBuilder secondaryLaunchersCfg = new StringBuilder(); + StringBuilder addLaunchersCfg = new StringBuilder(); for (Map - launcher : SECONDARY_LAUNCHERS.fetchFrom(p)) { + launcher : ADD_LAUNCHERS.fetchFrom(p)) { String application_name = APP_NAME.fetchFrom(launcher); if (MENU_HINT.fetchFrom(launcher)) { // Name: "{group}\APPLICATION_NAME"; // Filename: "{app}\APPLICATION_NAME.exe"; // IconFilename: "{app}\APPLICATION_NAME.ico" - secondaryLaunchersCfg.append("Name: \"{group}\\"); - secondaryLaunchersCfg.append(application_name); - secondaryLaunchersCfg.append("\"; Filename: \"{app}\\"); - secondaryLaunchersCfg.append(application_name); - secondaryLaunchersCfg.append(".exe\"; IconFilename: \"{app}\\"); - secondaryLaunchersCfg.append(application_name); - secondaryLaunchersCfg.append(".ico\"\r\n"); + addLaunchersCfg.append("Name: \"{group}\\"); + addLaunchersCfg.append(application_name); + addLaunchersCfg.append("\"; Filename: \"{app}\\"); + addLaunchersCfg.append(application_name); + addLaunchersCfg.append(".exe\"; IconFilename: \"{app}\\"); + addLaunchersCfg.append(application_name); + addLaunchersCfg.append(".ico\"\r\n"); } if (SHORTCUT_HINT.fetchFrom(launcher)) { // Name: "{commondesktop}\APPLICATION_NAME"; // Filename: "{app}\APPLICATION_NAME.exe"; // IconFilename: "{app}\APPLICATION_NAME.ico" - secondaryLaunchersCfg.append("Name: \"{commondesktop}\\"); - secondaryLaunchersCfg.append(application_name); - secondaryLaunchersCfg.append("\"; Filename: \"{app}\\"); - secondaryLaunchersCfg.append(application_name); - secondaryLaunchersCfg.append(".exe\"; IconFilename: \"{app}\\"); - secondaryLaunchersCfg.append(application_name); - secondaryLaunchersCfg.append(".ico\"\r\n"); + addLaunchersCfg.append("Name: \"{commondesktop}\\"); + addLaunchersCfg.append(application_name); + addLaunchersCfg.append("\"; Filename: \"{app}\\"); + addLaunchersCfg.append(application_name); + addLaunchersCfg.append(".exe\"; IconFilename: \"{app}\\"); + addLaunchersCfg.append(application_name); + addLaunchersCfg.append(".ico\"\r\n"); } } - data.put("SECONDARY_LAUNCHERS", secondaryLaunchersCfg.toString()); + data.put("ADD_LAUNCHERS", addLaunchersCfg.toString()); StringBuilder registryEntries = new StringBuilder(); String regName = APP_REGISTRY_NAME.fetchFrom(p); @@ -723,8 +705,7 @@ data.put("FILE_ASSOCIATIONS", ""); } - // TODO - alternate template for JRE installer - String iss = RUNTIME_INSTALLER.fetchFrom(p) ? + String iss = StandardBundlerParam.isRuntimeInstaller(p) ? DEFAULT_JRE_EXE_TEMPLATE : DEFAULT_EXE_PROJECT_TEMPLATE; Writer w = new BufferedWriter(new FileWriter( --- old/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinMsiBundler.java 2019-03-05 14:54:17.023469500 -0500 +++ new/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinMsiBundler.java 2019-03-05 14:54:15.931455500 -0500 @@ -42,8 +42,6 @@ public static final BundlerParamInfo APP_BUNDLER = new WindowsBundlerParam<>( - I18N.getString("param.msi-bundler.name"), - I18N.getString("param.msi-bundler.description"), "win.app.bundler", WinAppBundler.class, params -> new WinAppBundler(), @@ -51,8 +49,6 @@ public static final BundlerParamInfo CAN_USE_WIX36 = new WindowsBundlerParam<>( - I18N.getString("param.can-use-wix36.name"), - I18N.getString("param.can-use-wix36.description"), "win.msi.canUseWix36", Boolean.class, params -> false, @@ -60,8 +56,6 @@ public static final BundlerParamInfo MSI_IMAGE_DIR = new WindowsBundlerParam<>( - I18N.getString("param.image-dir.name"), - I18N.getString("param.image-dir.description"), "win.msi.imageDir", File.class, params -> { @@ -73,8 +67,6 @@ public static final BundlerParamInfo WIN_APP_IMAGE = new WindowsBundlerParam<>( - I18N.getString("param.app-dir.name"), - I18N.getString("param.app-dir.description"), "win.app.image", File.class, null, @@ -82,8 +74,6 @@ public static final StandardBundlerParam MSI_SYSTEM_WIDE = new StandardBundlerParam<>( - I18N.getString("param.system-wide.name"), - I18N.getString("param.system-wide.description"), Arguments.CLIOptions.WIN_PER_USER_INSTALLATION.getId(), Boolean.class, params -> true, // MSIs default to system wide @@ -96,8 +86,6 @@ public static final StandardBundlerParam PRODUCT_VERSION = new StandardBundlerParam<>( - I18N.getString("param.product-version.name"), - I18N.getString("param.product-version.description"), "win.msi.productVersion", String.class, VERSION::fetchFrom, @@ -106,8 +94,6 @@ public static final BundlerParamInfo UPGRADE_UUID = new WindowsBundlerParam<>( - I18N.getString("param.upgrade-uuid.name"), - I18N.getString("param.upgrade-uuid.description"), Arguments.CLIOptions.WIN_UPGRADE_UUID.getId(), UUID.class, params -> UUID.randomUUID(), @@ -130,8 +116,6 @@ public static final BundlerParamInfo TOOL_CANDLE_EXECUTABLE = new WindowsBundlerParam<>( - I18N.getString("param.candle-path.name"), - I18N.getString("param.candle-path.description"), "win.msi.candle.exe", String.class, params -> { @@ -148,8 +132,6 @@ public static final BundlerParamInfo TOOL_LIGHT_EXECUTABLE = new WindowsBundlerParam<>( - I18N.getString("param.light-path.name"), - I18N.getString("param.light-path.description"), "win.msi.light.exe", String.class, params -> { @@ -166,8 +148,6 @@ public static final StandardBundlerParam MENU_HINT = new WindowsBundlerParam<>( - I18N.getString("param.menu-shortcut-hint.name"), - I18N.getString("param.menu-shortcut-hint.description"), Arguments.CLIOptions.WIN_MENU_HINT.getId(), Boolean.class, params -> false, @@ -179,8 +159,6 @@ public static final StandardBundlerParam SHORTCUT_HINT = new WindowsBundlerParam<>( - I18N.getString("param.desktop-shortcut-hint.name"), - I18N.getString("param.desktop-shortcut-hint.description"), Arguments.CLIOptions.WIN_SHORTCUT_HINT.getId(), Boolean.class, params -> false, @@ -592,31 +570,31 @@ data.put("UI_BLOCK", getUIBlock(params)); - List> secondaryLaunchers = - SECONDARY_LAUNCHERS.fetchFrom(params); + List> addLaunchers = + ADD_LAUNCHERS.fetchFrom(params); - StringBuilder secondaryLauncherIcons = new StringBuilder(); - for (int i = 0; i < secondaryLaunchers.size(); i++) { - Map sl = secondaryLaunchers.get(i); + StringBuilder addLauncherIcons = new StringBuilder(); + for (int i = 0; i < addLaunchers.size(); i++) { + Map sl = addLaunchers.get(i); // if (SHORTCUT_HINT.fetchFrom(sl) || MENU_HINT.fetchFrom(sl)) { - File secondaryLauncher = new File(imageRootDir, + File addLauncher = new File(imageRootDir, WinAppBundler.getLauncherName(sl)); - String secondaryLauncherPath = - relativePath(imageRootDir, secondaryLauncher); - String secondaryLauncherIconPath = - secondaryLauncherPath.replace(".exe", ".ico"); + String addLauncherPath = + relativePath(imageRootDir, addLauncher); + String addLauncherIconPath = + addLauncherPath.replace(".exe", ".ico"); - secondaryLauncherIcons.append(" \r\n"); + addLauncherIcons.append(" \r\n"); } } - data.put("SECONDARY_LAUNCHER_ICONS", secondaryLauncherIcons.toString()); + data.put("ADD_LAUNCHER_ICONS", addLauncherIcons.toString()); - String wxs = RUNTIME_INSTALLER.fetchFrom(params) ? + String wxs = StandardBundlerParam.isRuntimeInstaller(params) ? MSI_PROJECT_TEMPLATE_SERVER_JRE : MSI_PROJECT_TEMPLATE; Writer w = new BufferedWriter( @@ -797,13 +775,13 @@ + " IconIndex=\"0\" />"); } - List> secondaryLaunchers = - SECONDARY_LAUNCHERS.fetchFrom(params); - for (int i = 0; i < secondaryLaunchers.size(); i++) { - Map sl = secondaryLaunchers.get(i); - File secondaryLauncherFile = new File(imageRootDir, + List> addLaunchers = + ADD_LAUNCHERS.fetchFrom(params); + for (int i = 0; i < addLaunchers.size(); i++) { + Map sl = addLaunchers.get(i); + File addLauncherFile = new File(imageRootDir, WinAppBundler.getLauncherName(sl)); - if (f.equals(secondaryLauncherFile)) { + if (f.equals(addLauncherFile)) { if (SHORTCUT_HINT.fetchFrom(sl)) { out.println(prefix + " params, File outdir) throws IOException { - File tmpDir = new File(BUILD_ROOT.fetchFrom(params), "tmp"); + File tmpDir = new File(TEMP_ROOT.fetchFrom(params), "tmp"); File candleOut = new File( tmpDir, APP_NAME.fetchFrom(params) +".wixobj"); File msiOut = new File( --- old/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WindowsAppImageBuilder.java 2019-03-05 14:54:22.172535600 -0500 +++ new/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WindowsAppImageBuilder.java 2019-03-05 14:54:21.157522500 -0500 @@ -80,8 +80,6 @@ public static final BundlerParamInfo REBRAND_EXECUTABLE = new WindowsBundlerParam<>( - I18N.getString("param.rebrand-executable.name"), - I18N.getString("param.rebrand-executable.description"), "win.launcher.rebrand", Boolean.class, params -> Boolean.TRUE, @@ -89,8 +87,6 @@ public static final BundlerParamInfo ICON_ICO = new StandardBundlerParam<>( - I18N.getString("param.icon-ico.name"), - I18N.getString("param.icon-ico.description"), "icon.ico", File.class, params -> { @@ -106,8 +102,6 @@ public static final StandardBundlerParam CONSOLE_HINT = new WindowsBundlerParam<>( - I18N.getString("param.console-hint.name"), - I18N.getString("param.console-hint.description"), Arguments.CLIOptions.WIN_CONSOLE_HINT.getId(), Boolean.class, params -> false, @@ -256,9 +250,9 @@ copyMSVCDLLs(); - // create the secondary launchers, if any + // create the additional launcher(s), if any List> entryPoints = - StandardBundlerParam.SECONDARY_LAUNCHERS.fetchFrom(params); + StandardBundlerParam.ADD_LAUNCHERS.fetchFrom(params); for (Map entryPoint : entryPoints) { Map tmp = new HashMap<>(originalParams); tmp.putAll(entryPoint); @@ -389,7 +383,7 @@ try { String tempDirectory = WindowsDefender.getUserTempDirectory(); if (Arguments.CLIOptions.context().userProvidedBuildRoot) { - tempDirectory = BUILD_ROOT.fetchFrom(p).getAbsolutePath(); + tempDirectory = TEMP_ROOT.fetchFrom(p).getAbsolutePath(); } if (WindowsDefender.isThereAPotentialWindowsDefenderIssue( tempDirectory)) { --- old/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WindowsBundlerParam.java 2019-03-05 14:54:27.414202800 -0500 +++ new/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WindowsBundlerParam.java 2019-03-05 14:54:26.337789000 -0500 @@ -35,19 +35,15 @@ private static final ResourceBundle I18N = ResourceBundle.getBundle( "jdk.jpackage.internal.resources.WinResources"); - WindowsBundlerParam(String name, String description, String id, - Class valueType, + WindowsBundlerParam(String id, Class valueType, Function, T> defaultValueFunction, BiFunction, T> stringConverter) { - super(name, description, id, valueType, - defaultValueFunction, stringConverter); + super(id, valueType, defaultValueFunction, stringConverter); } static final BundlerParamInfo INSTALLER_FILE_NAME = new StandardBundlerParam<> ( - I18N.getString("param.installer-name.name"), - I18N.getString("param.installer-name.description"), "win.installerName", String.class, params -> { @@ -65,8 +61,6 @@ static final BundlerParamInfo APP_REGISTRY_NAME = new StandardBundlerParam<> ( - I18N.getString("param.registry-name.name"), - I18N.getString("param.registry-name.description"), Arguments.CLIOptions.WIN_REGISTRY_NAME.getId(), String.class, params -> { @@ -79,22 +73,14 @@ static final StandardBundlerParam MENU_GROUP = new StandardBundlerParam<>( - I18N.getString("param.menu-group.name"), - I18N.getString("param.menu-group.description"), Arguments.CLIOptions.WIN_MENU_GROUP.getId(), String.class, - params -> params.containsKey(VENDOR.getID()) - ? VENDOR.fetchFrom(params) - : params.containsKey(CATEGORY.getID()) - ? CATEGORY.fetchFrom(params) - : I18N.getString("param.menu-group.default"), + params -> I18N.getString("param.menu-group.default"), (s, p) -> s ); static final BundlerParamInfo INSTALLDIR_CHOOSER = new StandardBundlerParam<> ( - I18N.getString("param.installdir-chooser.name"), - I18N.getString("param.installdir-chooser.description"), Arguments.CLIOptions.WIN_DIR_CHOOSER.getId(), Boolean.class, params -> Boolean.FALSE, --- old/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources.properties 2019-03-05 14:54:32.749471200 -0500 +++ new/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources.properties 2019-03-05 14:54:31.735458200 -0500 @@ -31,49 +31,7 @@ msi.bundler.name=MSI Installer msi.bundler.description=Microsoft Windows MSI Installer, via WiX. -param.raw-executable-url.name=Launcher URL -param.raw-executable-url.description=Override the jpackage default launcher with a custom launcher. -param.rebrand-executable.name=Rebrand Launcher -param.rebrand-executable.description=Update the launcher with the application icon and update ownership information. -param.icon-ico.name=.ico Icon -param.icon-ico.description=Icon for the application, in ICO format. -param.console-hint.name=Console Hint -param.console-hint.description=Indicates if the bundler should use console launcher -param.menu-group.name=Menu Group -param.menu-group.description=The Start Menu group this application should be placed in param.menu-group.default=Unknown -param.installer-name.name=Installer Name -param.installer-name.description=The filename of the generated installer without the file type extension. Default is -. -param.registry-name.name=Registry Name -param.registry-name.description=The name of the application for registry references. Default is the Application Name with only alphanumerics, dots, and dashes (no whitespace). -param.installdir-chooser.name=Install Directory Chooser -param.installdir-chooser.description=Adds a dialog to let the user choose a directory where the product will be installed. -param.system-wide.name=System Wide -param.system-wide.description=Should this application attempt to install itself system wide, or only for each user? Null means use the system default. -param.exe-bundler.name=Exe Installer Bundler -param.exe-bundler.description=Exe Installer Bundler -param.image-dir.name=Image Dir -param.image-dir.description=Image Dir -param.app-dir.name=App Dir -param.app-dir.description=App Dir -param.menu-shortcut-hint.name=Menu Hint -param.menu-shortcut-hint.description=If the bundler can add the application to the system menu, should it? -param.desktop-shortcut-hint.name=Shortcut Hint -param.desktop-shortcut-hint.description=If the bundler can create desktop shortcuts, should it make one? -param.upgrade-uuid.name=Upgrade UUID -param.upgrade-uuid.description=The UUID associated with upgrades for this package. -param.product-version.name=Product Version -param.product-version.description=The version of the application as seen by Windows and MSI, of the form "1.2.3" -param.iscc-path.name=InnoSetup iscc.exe location -param.iscc-path.description=File path to iscc.exe from the InnoSetup tool. -param.msi-bundler.name=MSI App Bundler -param.msi-bundler.description=MSI App Bundler -param.can-use-wix36.name=Can Use Wix -param.can-use-wix36.description=Can Use Wix -param.candle-path.name=WiX candle.exe location -param.candle-path.description=File path to candle.exe from the WiX toolset. -param.light-path.name=WiX light.exe location -param.light-path.description=File path to light.exe from the WiX toolset. resource.application-icon=application icon resource.executable-properties-template=Template for creating executable properties file. --- old/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_ja.properties 2019-03-05 14:54:37.991138400 -0500 +++ new/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_ja.properties 2019-03-05 14:54:36.930324800 -0500 @@ -31,49 +31,7 @@ msi.bundler.name=MSI Installer msi.bundler.description=Microsoft Windows MSI Installer, via WiX. -param.raw-executable-url.name=Launcher URL -param.raw-executable-url.description=Override the jpackage default launcher with a custom launcher. -param.rebrand-executable.name=Rebrand Launcher -param.rebrand-executable.description=Update the launcher with the application icon and update ownership information. -param.icon-ico.name=.ico Icon -param.icon-ico.description=Icon for the application, in ICO format. -param.console-hint.name=Console Hint -param.console-hint.description=Indicates if the bundler should use console launcher -param.menu-group.name=Menu Group -param.menu-group.description=The Start Menu group this application should be placed in param.menu-group.default=Unknown -param.installer-name.name=Installer Name -param.installer-name.description=The filename of the generated installer without the file type extension. Default is -. -param.registry-name.name=Registry Name -param.registry-name.description=The name of the application for registry references. Default is the Application Name with only alphanumerics, dots, and dashes (no whitespace). -param.installdir-chooser.name=Install Directory Chooser -param.installdir-chooser.description=Adds a dialog to let the user choose a directory where the product will be installed. -param.system-wide.name=System Wide -param.system-wide.description=Should this application attempt to install itself system wide, or only for each user? Null means use the system default. -param.exe-bundler.name=Exe Installer Bundler -param.exe-bundler.description=Exe Installer Bundler -param.image-dir.name=Image Dir -param.image-dir.description=Image Dir -param.app-dir.name=App Dir -param.app-dir.description=App Dir -param.menu-shortcut-hint.name=Menu Hint -param.menu-shortcut-hint.description=If the bundler can add the application to the system menu, should it? -param.desktop-shortcut-hint.name=Shortcut Hint -param.desktop-shortcut-hint.description=If the bundler can create desktop shortcuts, should it make one? -param.upgrade-uuid.name=Upgrade UUID -param.upgrade-uuid.description=The UUID associated with upgrades for this package. -param.product-version.name=Product Version -param.product-version.description=The version of the application as seen by Windows and MSI, of the form "1.2.3" -param.iscc-path.name=InnoSetup iscc.exe location -param.iscc-path.description=File path to iscc.exe from the InnoSetup tool. -param.msi-bundler.name=MSI App Bundler -param.msi-bundler.description=MSI App Bundler -param.can-use-wix36.name=Can Use Wix -param.can-use-wix36.description=Can Use Wix -param.candle-path.name=WiX candle.exe location -param.candle-path.description=File path to candle.exe from the WiX toolset. -param.light-path.name=WiX light.exe location -param.light-path.description=File path to light.exe from the WiX toolset. resource.application-icon=application icon resource.executable-properties-template=Template for creating executable properties file. --- old/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_zh_CN.properties 2019-03-05 14:54:43.451208400 -0500 +++ new/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_zh_CN.properties 2019-03-05 14:54:42.374794600 -0500 @@ -31,49 +31,7 @@ msi.bundler.name=MSI Installer msi.bundler.description=Microsoft Windows MSI Installer, via WiX. -param.raw-executable-url.name=Launcher URL -param.raw-executable-url.description=Override the jpackage default launcher with a custom launcher. -param.rebrand-executable.name=Rebrand Launcher -param.rebrand-executable.description=Update the launcher with the application icon and update ownership information. -param.icon-ico.name=.ico Icon -param.icon-ico.description=Icon for the application, in ICO format. -param.console-hint.name=Console Hint -param.console-hint.description=Indicates if the bundler should use console launcher -param.menu-group.name=Menu Group -param.menu-group.description=The Start Menu group this application should be placed in param.menu-group.default=Unknown -param.installer-name.name=Installer Name -param.installer-name.description=The filename of the generated installer without the file type extension. Default is -. -param.registry-name.name=Registry Name -param.registry-name.description=The name of the application for registry references. Default is the Application Name with only alphanumerics, dots, and dashes (no whitespace). -param.installdir-chooser.name=Install Directory Chooser -param.installdir-chooser.description=Adds a dialog to let the user choose a directory where the product will be installed. -param.system-wide.name=System Wide -param.system-wide.description=Should this application attempt to install itself system wide, or only for each user? Null means use the system default. -param.exe-bundler.name=Exe Installer Bundler -param.exe-bundler.description=Exe Installer Bundler -param.image-dir.name=Image Dir -param.image-dir.description=Image Dir -param.app-dir.name=App Dir -param.app-dir.description=App Dir -param.menu-shortcut-hint.name=Menu Hint -param.menu-shortcut-hint.description=If the bundler can add the application to the system menu, should it? -param.desktop-shortcut-hint.name=Shortcut Hint -param.desktop-shortcut-hint.description=If the bundler can create desktop shortcuts, should it make one? -param.upgrade-uuid.name=Upgrade UUID -param.upgrade-uuid.description=The UUID associated with upgrades for this package. -param.product-version.name=Product Version -param.product-version.description=The version of the application as seen by Windows and MSI, of the form "1.2.3" -param.iscc-path.name=InnoSetup iscc.exe location -param.iscc-path.description=File path to iscc.exe from the InnoSetup tool. -param.msi-bundler.name=MSI App Bundler -param.msi-bundler.description=MSI App Bundler -param.can-use-wix36.name=Can Use Wix -param.can-use-wix36.description=Can Use Wix -param.candle-path.name=WiX candle.exe location -param.candle-path.description=File path to candle.exe from the WiX toolset. -param.light-path.name=WiX light.exe location -param.light-path.description=File path to light.exe from the WiX toolset. resource.application-icon=application icon resource.executable-properties-template=Template for creating executable properties file. --- old/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/template.iss 2019-03-05 14:54:48.693875700 -0500 +++ new/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/template.iss 2019-03-05 14:54:47.679862700 -0500 @@ -42,7 +42,7 @@ [Icons] Name: "{group}\INSTALLER_NAME"; Filename: "{app}\LAUNCHER_NAME.exe"; IconFilename: "{app}\LAUNCHER_NAME.ico"; Check: APPLICATION_MENU_SHORTCUT() Name: "{commondesktop}\INSTALLER_NAME"; Filename: "{app}\LAUNCHER_NAME.exe"; IconFilename: "{app}\LAUNCHER_NAME.ico"; Check: APPLICATION_DESKTOP_SHORTCUT() -SECONDARY_LAUNCHERS +ADD_LAUNCHERS [Run] Filename: "{app}\RUN_FILENAME.exe"; Parameters: "-Xappcds:generatecache"; Check: APPLICATION_APP_CDS_INSTALL() --- old/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/template.wxs 2019-03-05 14:54:53.919942700 -0500 +++ new/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/template.wxs 2019-03-05 14:54:52.859129100 -0500 @@ -43,6 +43,6 @@ UI_BLOCK -SECONDARY_LAUNCHER_ICONS +ADD_LAUNCHER_ICONS --- /dev/null 2019-03-05 14:54:59.000000000 -0500 +++ new/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AddLauncherArguments.java 2019-03-05 14:54:57.897993700 -0500 @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2018, 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; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.io.File; +import jdk.jpackage.internal.Arguments.CLIOptions; + +/* + * AddLauncherArguments + * + * Processes a add-launcher properties file to create the Map of + * bundle params applicable to the add-launcher: + * + * BundlerParams p = (new AddLauncherArguments(file)).getLauncherMap(); + * + * A add-launcher is another executable program generated by either the + * create-image mode or the create-installer mode. + * The add-launcher may be the same program with different configuration, + * or a completely different program created from the same files. + * + * There may be multiple add-launchers, each created by using the + * command line arg "--add-launcher + * + * The add-launcher properties file may have any of: + * + * name (required) + * appVersion + * module + * add-modules + * main-jar + * main-class + * icon + * arguments + * jvm-args + * win-console + * + */ +class AddLauncherArguments { + + private final String filename; + private Map allArgs; + private Map bundleParams; + + AddLauncherArguments(String filename) { + this.filename = filename; + } + + private void initLauncherMap() { + if (bundleParams != null) { + return; + } + + allArgs = Arguments.getPropertiesFromFile(filename); + + bundleParams = new HashMap<>(); + String mainJar = getOptionValue(CLIOptions.MAIN_JAR); + String mainClass = getOptionValue(CLIOptions.APPCLASS); + String module = getOptionValue(CLIOptions.MODULE); + + if (module != null && mainClass != null) { + putUnlessNull(bundleParams, Arguments.CLIOptions.MODULE.getId(), + module + "/" + mainClass); + } else if (module != null) { + putUnlessNull(bundleParams, Arguments.CLIOptions.MODULE.getId(), + module); + } else { + putUnlessNull(bundleParams, Arguments.CLIOptions.MAIN_JAR.getId(), + mainJar); + putUnlessNull(bundleParams, Arguments.CLIOptions.APPCLASS.getId(), + mainClass); + } + + putUnlessNull(bundleParams, Arguments.CLIOptions.NAME.getId(), + getOptionValue(CLIOptions.NAME)); + + putUnlessNull(bundleParams, Arguments.CLIOptions.VERSION.getId(), + getOptionValue(CLIOptions.VERSION)); + + putUnlessNull(bundleParams, + Arguments.CLIOptions.ADD_MODULES.getId(), + getOptionValue(CLIOptions.ADD_MODULES)); + + putUnlessNull(bundleParams, + Arguments.CLIOptions.WIN_CONSOLE_HINT.getId(), + getOptionValue(CLIOptions.WIN_CONSOLE_HINT)); + + String value = getOptionValue(CLIOptions.ICON); + putUnlessNull(bundleParams, Arguments.CLIOptions.ICON.getId(), + (value == null) ? null : new File(value)); + + String argumentStr = getOptionValue(CLIOptions.ARGUMENTS); + putUnlessNullOrEmpty(bundleParams, + CLIOptions.ARGUMENTS.getId(), + Arguments.getArgumentList(argumentStr)); + + String jvmargsStr = getOptionValue(CLIOptions.JVM_ARGS); + putUnlessNullOrEmpty(bundleParams, + CLIOptions.JVM_ARGS.getId(), + Arguments.getArgumentList(jvmargsStr)); + } + + private String getOptionValue(CLIOptions option) { + if (option == null || allArgs == null) { + return null; + } + + String id = option.getId(); + + if (allArgs.containsKey(id)) { + return allArgs.get(id); + } + + return null; + } + + Map getLauncherMap() { + initLauncherMap(); + return bundleParams; + } + + private void putUnlessNull(Map params, + String param, Object value) { + if (value != null) { + params.put(param, value); + } + } + + private void putUnlessNullOrEmpty(Map params, + String param, Collection value) { + if (value != null && !value.isEmpty()) { + params.put(param, value); + } + } + + private void putUnlessNullOrEmpty(Map params, + String param, Map value) { + if (value != null && !value.isEmpty()) { + params.put(param, value); + } + } +} --- /dev/null 2019-03-05 14:55:03.000000000 -0500 +++ new/test/jdk/tools/jpackage/createimage/JPackageCreateImageAddLauncherBase.java 2019-03-05 14:55:02.017446600 -0500 @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2018, 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. + * + * 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. + */ + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.PrintWriter; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.List; + +public class JPackageCreateImageAddLauncherBase { + private static final String app = JPackagePath.getApp(); + private static final String app2 = JPackagePath.getAppSL(); + private static final String appOutput = JPackagePath.getAppOutputFile(); + private static final String appWorkingDir = JPackagePath.getAppWorkingDir(); + + // Note: quotes in argument for add launcher is not support by test + private static final String ARGUMENT1 = "argument 1"; + private static final String ARGUMENT2 = "argument 2"; + private static final String ARGUMENT3 = "argument 3"; + + private static final List arguments = new ArrayList<>(); + + private static final String PARAM1 = "-Dparam1=Some Param 1"; + private static final String PARAM2 = "-Dparam2=Some Param 2"; + private static final String PARAM3 = "-Dparam3=Some Param 3"; + + private static final List vmArguments = new ArrayList<>(); + + private static void validateResult(List args, List vmArgs) + throws Exception { + File outfile = new File(appWorkingDir + File.separator + appOutput); + if (!outfile.exists()) { + throw new AssertionError(appOutput + " was not created"); + } + + String output = Files.readString(outfile.toPath()); + String[] result = output.split("\n"); + + if (result.length != (args.size() + vmArgs.size() + 2)) { + throw new AssertionError("Unexpected number of lines: " + + result.length); + } + + if (!result[0].trim().equals("jpackage test application")) { + throw new AssertionError("Unexpected result[0]: " + result[0]); + } + + if (!result[1].trim().equals("args.length: " + args.size())) { + throw new AssertionError("Unexpected result[1]: " + result[1]); + } + + int index = 2; + for (String arg : args) { + if (!result[index].trim().equals(arg)) { + throw new AssertionError("Unexpected result[" + index + "]: " + + result[index]); + } + index++; + } + + for (String vmArg : vmArgs) { + if (!result[index].trim().equals(vmArg)) { + throw new AssertionError("Unexpected result[" + index + "]: " + + result[index]); + } + index++; + } + } + + private static void validate() throws Exception { + int retVal = JPackageHelper.execute(null, app); + if (retVal != 0) { + throw new AssertionError("Test application exited with error: " + + retVal); + } + validateResult(new ArrayList<>(), new ArrayList<>()); + + retVal = JPackageHelper.execute(null, app2); + if (retVal != 0) { + throw new AssertionError("Test application exited with error: " + + retVal); + } + validateResult(arguments, vmArguments); + } + + public static void testCreateImage(String [] cmd) throws Exception { + JPackageHelper.executeCLI(true, cmd); + validate(); + } + + public static void testCreateImageToolProvider(String [] cmd) throws Exception { + JPackageHelper.executeToolProvider(true, cmd); + validate(); + } + + public static void createSLProperties() throws Exception { + arguments.add(ARGUMENT1); + arguments.add(ARGUMENT2); + arguments.add(ARGUMENT3); + + String argumentsMap = + JPackageHelper.listToArgumentsMap(arguments, true); + + vmArguments.add(PARAM1); + vmArguments.add(PARAM2); + vmArguments.add(PARAM3); + + String vmArgumentsMap = + JPackageHelper.listToArgumentsMap(vmArguments, true); + + try (PrintWriter out = new PrintWriter(new BufferedWriter( + new FileWriter("sl.properties")))) { + out.println("name=test2"); + out.println("arguments=" + argumentsMap); + out.println("jvm-args=" + vmArgumentsMap); + } + } + +} --- /dev/null 2019-03-05 14:55:07.000000000 -0500 +++ new/test/jdk/tools/jpackage/createimage/JPackageCreateImageAddLauncherModuleTest.java 2019-03-05 14:55:05.917496600 -0500 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2018, 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. + * + * 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. + */ + + /* + * @test + * @summary jpackage create image with additional launcher test + * @library ../helpers + * @build JPackageHelper + * @build JPackagePath + * @build JPackageCreateImageAddLauncherBase + * @modules jdk.jpackage + * @run main/othervm -Xmx512m JPackageCreateImageAddLauncherModuleTest + */ +public class JPackageCreateImageAddLauncherModuleTest { + private static final String OUTPUT = "output"; + private static final String [] CMD = { + "create-image", + "--output", OUTPUT, + "--name", "test", + "--module", "com.hello/com.hello.Hello", + "--module-path", "input", + "--add-launcher", "sl.properties"}; + + public static void main(String[] args) throws Exception { + JPackageHelper.createHelloModule(); + JPackageCreateImageAddLauncherBase.createSLProperties(); + JPackageCreateImageAddLauncherBase.testCreateImage(CMD); + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageCreateImageAddLauncherBase.testCreateImageToolProvider(CMD); + } + +} --- /dev/null 2019-03-05 14:55:11.000000000 -0500 +++ new/test/jdk/tools/jpackage/createimage/JPackageCreateImageAddLauncherTest.java 2019-03-05 14:55:09.770746000 -0500 @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2018, 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. + * + * 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. + */ + + /* + * @test + * @summary jpackage create image with additional launcher test + * @library ../helpers + * @build JPackageHelper + * @build JPackagePath + * @build JPackageCreateImageAddLauncherBase + * @modules jdk.jpackage + * @run main/othervm -Xmx512m JPackageCreateImageAddLauncherTest + */ +public class JPackageCreateImageAddLauncherTest { + private static final String OUTPUT = "output"; + private static final String [] CMD = { + "create-image", + "--input", "input", + "--output", OUTPUT, + "--name", "test", + "--main-jar", "hello.jar", + "--main-class", "Hello", + "--files", "hello.jar", + "--add-launcher", "sl.properties"}; + + public static void main(String[] args) throws Exception { + JPackageHelper.createHelloImageJar(); + JPackageCreateImageAddLauncherBase.createSLProperties(); + JPackageCreateImageAddLauncherBase.testCreateImage(CMD); + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageCreateImageAddLauncherBase.testCreateImageToolProvider(CMD); + } + +} --- /dev/null 2019-03-05 14:55:15.000000000 -0500 +++ new/test/jdk/tools/jpackage/createimage/JPackageCreateImageTempRootTest.java 2019-03-05 14:55:13.608395200 -0500 @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2018, 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. + * + * 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. + */ + +import java.io.File; + + /* + * @test + * @requires (os.family == "windows") + * @summary jpackage create image to test --temp-root + * @library ../helpers + * @build JPackageHelper + * @build JPackagePath + * @modules jdk.jpackage + * @run main/othervm -Xmx512m JPackageCreateImageTempRootTest + */ +public class JPackageCreateImageTempRootTest { + private static final String OUTPUT = "output"; + private static String buildRoot = null; + private static final String BUILD_ROOT = "buildRoot"; + private static final String BUILD_ROOT_TB = "buildRootToolProvider"; + + private static final String [] CMD = { + "create-image", + "--input", "input", + "--output", OUTPUT, + "--name", "test", + "--main-jar", "hello.jar", + "--main-class", "Hello", + "--files", "hello.jar" }; + + private static final String [] CMD_BUILD_ROOT = { + "create-image", + "--input", "input", + "--output", OUTPUT, + "--name", "test", + "--main-jar", "hello.jar", + "--main-class", "Hello", + "--files", "hello.jar", + "--temp-root", "TBD"}; + + private static void validate(boolean retain) throws Exception { + File br = new File(buildRoot); + if (retain) { + if (!br.exists()) { + throw new AssertionError(br.getAbsolutePath() + " does not exist"); + } + } else { + if (br.exists()) { + throw new AssertionError(br.getAbsolutePath() + " exist"); + } + } + } + + private static void init(boolean toolProvider) { + if (toolProvider) { + buildRoot = BUILD_ROOT_TB; + } else { + buildRoot = BUILD_ROOT; + } + + CMD_BUILD_ROOT[CMD_BUILD_ROOT.length - 1] = buildRoot; + } + + private static void testTempRoot() throws Exception { + init(false); + JPackageHelper.executeCLI(true, CMD); + validate(false); + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageHelper.executeCLI(true, CMD_BUILD_ROOT); + validate(true); + } + + private static void testTempRootToolProvider() throws Exception { + init(true); + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageHelper.executeToolProvider(true, CMD); + validate(false); + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageHelper.executeToolProvider(true, CMD_BUILD_ROOT); + validate(true); + } + + public static void main(String[] args) throws Exception { + JPackageHelper.createHelloImageJar(); + testTempRoot(); + testTempRootToolProvider(); + } + +} --- old/src/jdk.jpackage/share/classes/jdk/jpackage/internal/SecondaryLauncherArguments.java 2019-03-05 14:55:18.506858000 -0500 +++ /dev/null 2019-03-05 14:55:18.000000000 -0500 @@ -1,164 +0,0 @@ -/* - * Copyright (c) 2018, 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; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.io.File; -import jdk.jpackage.internal.Arguments.CLIOptions; - -/* - * SecondaryLauncherArguments - * - * Processes a secondary launcher properties file to create the Map of - * bundle params applicable to the secondary launcher: - * - * BundlerParams p = (new SecondaryLauncherArguments(file)).getLauncherMap(); - * - * A secondary launcher is another executable program generated by either the - * create-image mode or the create-installer mode. - * The secondary launcher may be the same program with different configuration, - * or a completely different program created from the same files. - * - * There may be multiple secondary launchers, each created by using the - * command line arg "--secondary-launcher - * - * The secondary launcher properties file may have any of: - * - * name (required) - * version - * module - * class - * icon - * arguments - * jvm-args - * win-menu - * win-shortcut - * win-console - * - */ -class SecondaryLauncherArguments { - - private final String filename; - private Map allArgs; - private Map bundleParams; - - SecondaryLauncherArguments(String filename) { - this.filename = filename; - } - - private void initLauncherMap() { - if (bundleParams != null) { - return; - } - - allArgs = Arguments.getPropertiesFromFile(filename); - - bundleParams = new HashMap<>(); - String mainClass = getOptionValue(CLIOptions.APPCLASS); - String module = getOptionValue(CLIOptions.MODULE); - - if (module != null && mainClass != null) { - putUnlessNull(bundleParams, Arguments.CLIOptions.MODULE.getId(), - module + "/" + mainClass); - } else if (module != null) { - putUnlessNull(bundleParams, Arguments.CLIOptions.MODULE.getId(), - module); - } else if (mainClass != null) { - putUnlessNull(bundleParams, Arguments.CLIOptions.APPCLASS.getId(), - mainClass); - } - - putUnlessNull(bundleParams, Arguments.CLIOptions.NAME.getId(), - getOptionValue(CLIOptions.NAME)); - putUnlessNull(bundleParams, Arguments.CLIOptions.VERSION.getId(), - getOptionValue(CLIOptions.VERSION)); - - putUnlessNull(bundleParams, Arguments.CLIOptions.WIN_MENU_HINT.getId(), - getOptionValue(CLIOptions.WIN_MENU_HINT)); - putUnlessNull(bundleParams, - Arguments.CLIOptions.WIN_SHORTCUT_HINT.getId(), - getOptionValue(CLIOptions.WIN_SHORTCUT_HINT)); - putUnlessNull(bundleParams, - Arguments.CLIOptions.WIN_CONSOLE_HINT.getId(), - getOptionValue(CLIOptions.WIN_CONSOLE_HINT)); - - String value = getOptionValue(CLIOptions.ICON); - putUnlessNull(bundleParams, Arguments.CLIOptions.ICON.getId(), - (value == null) ? null : new File(value)); - - String argumentStr = getOptionValue(CLIOptions.ARGUMENTS); - putUnlessNullOrEmpty(bundleParams, - CLIOptions.ARGUMENTS.getId(), - Arguments.getArgumentList(argumentStr)); - - String jvmargsStr = getOptionValue(CLIOptions.JVM_ARGS); - putUnlessNullOrEmpty(bundleParams, - CLIOptions.JVM_ARGS.getId(), - Arguments.getArgumentList(jvmargsStr)); - } - - private String getOptionValue(CLIOptions option) { - if (option == null || allArgs == null) { - return null; - } - - String id = option.getId(); - - if (allArgs.containsKey(id)) { - return allArgs.get(id); - } - - return null; - } - - Map getLauncherMap() { - initLauncherMap(); - return bundleParams; - } - - private void putUnlessNull(Map params, - String param, Object value) { - if (value != null) { - params.put(param, value); - } - } - - private void putUnlessNullOrEmpty(Map params, - String param, Collection value) { - if (value != null && !value.isEmpty()) { - params.put(param, value); - } - } - - private void putUnlessNullOrEmpty(Map params, - String param, Map value) { - if (value != null && !value.isEmpty()) { - params.put(param, value); - } - } -} --- old/test/jdk/tools/jpackage/createimage/JPackageCreateImageBuildRootTest.java 2019-03-05 14:55:21.424095400 -0500 +++ /dev/null 2019-03-05 14:55:21.000000000 -0500 @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2018, 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. - * - * 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. - */ - -import java.io.File; - - /* - * @test - * @requires (os.family == "windows") - * @summary jpackage create image to test --build-root - * @library ../helpers - * @build JPackageHelper - * @build JPackagePath - * @modules jdk.jpackage - * @run main/othervm -Xmx512m JPackageCreateImageBuildRootTest - */ -public class JPackageCreateImageBuildRootTest { - private static final String OUTPUT = "output"; - private static String buildRoot = null; - private static final String BUILD_ROOT = "buildRoot"; - private static final String BUILD_ROOT_TB = "buildRootToolProvider"; - - private static final String [] CMD = { - "create-image", - "--input", "input", - "--output", OUTPUT, - "--name", "test", - "--main-jar", "hello.jar", - "--main-class", "Hello", - "--files", "hello.jar" }; - - private static final String [] CMD_BUILD_ROOT = { - "create-image", - "--input", "input", - "--output", OUTPUT, - "--name", "test", - "--main-jar", "hello.jar", - "--main-class", "Hello", - "--files", "hello.jar", - "--build-root", "TBD"}; - - private static void validate(boolean retain) throws Exception { - File br = new File(buildRoot); - if (retain) { - if (!br.exists()) { - throw new AssertionError(br.getAbsolutePath() + " does not exist"); - } - } else { - if (br.exists()) { - throw new AssertionError(br.getAbsolutePath() + " exist"); - } - } - } - - private static void init(boolean toolProvider) { - if (toolProvider) { - buildRoot = BUILD_ROOT_TB; - } else { - buildRoot = BUILD_ROOT; - } - - CMD_BUILD_ROOT[CMD_BUILD_ROOT.length - 1] = buildRoot; - } - - private static void testBuildRoot() throws Exception { - init(false); - JPackageHelper.executeCLI(true, CMD); - validate(false); - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageHelper.executeCLI(true, CMD_BUILD_ROOT); - validate(true); - } - - private static void testBuildRootToolProvider() throws Exception { - init(true); - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageHelper.executeToolProvider(true, CMD); - validate(false); - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageHelper.executeToolProvider(true, CMD_BUILD_ROOT); - validate(true); - } - - public static void main(String[] args) throws Exception { - JPackageHelper.createHelloImageJar(); - testBuildRoot(); - testBuildRootToolProvider(); - } - -} --- old/test/jdk/tools/jpackage/createimage/JPackageCreateImageSecondaryLauncherBase.java 2019-03-05 14:55:24.356933000 -0500 +++ /dev/null 2019-03-05 14:55:24.000000000 -0500 @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2018, 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. - * - * 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. - */ - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.PrintWriter; -import java.nio.file.Files; -import java.util.ArrayList; -import java.util.List; - -public class JPackageCreateImageSecondaryLauncherBase { - private static final String app = JPackagePath.getApp(); - private static final String app2 = JPackagePath.getAppSL(); - private static final String appOutput = JPackagePath.getAppOutputFile(); - private static final String appWorkingDir = JPackagePath.getAppWorkingDir(); - - // Note: quotes in argument for secondary launcher is not support by test - private static final String ARGUMENT1 = "argument 1"; - private static final String ARGUMENT2 = "argument 2"; - private static final String ARGUMENT3 = "argument 3"; - - private static final List arguments = new ArrayList<>(); - - private static final String PARAM1 = "-Dparam1=Some Param 1"; - private static final String PARAM2 = "-Dparam2=Some Param 2"; - private static final String PARAM3 = "-Dparam3=Some Param 3"; - - private static final List vmArguments = new ArrayList<>(); - - private static void validateResult(List args, List vmArgs) - throws Exception { - File outfile = new File(appWorkingDir + File.separator + appOutput); - if (!outfile.exists()) { - throw new AssertionError(appOutput + " was not created"); - } - - String output = Files.readString(outfile.toPath()); - String[] result = output.split("\n"); - - if (result.length != (args.size() + vmArgs.size() + 2)) { - throw new AssertionError("Unexpected number of lines: " - + result.length); - } - - if (!result[0].trim().equals("jpackage test application")) { - throw new AssertionError("Unexpected result[0]: " + result[0]); - } - - if (!result[1].trim().equals("args.length: " + args.size())) { - throw new AssertionError("Unexpected result[1]: " + result[1]); - } - - int index = 2; - for (String arg : args) { - if (!result[index].trim().equals(arg)) { - throw new AssertionError("Unexpected result[" + index + "]: " - + result[index]); - } - index++; - } - - for (String vmArg : vmArgs) { - if (!result[index].trim().equals(vmArg)) { - throw new AssertionError("Unexpected result[" + index + "]: " - + result[index]); - } - index++; - } - } - - private static void validate() throws Exception { - int retVal = JPackageHelper.execute(null, app); - if (retVal != 0) { - throw new AssertionError("Test application exited with error: " - + retVal); - } - validateResult(new ArrayList<>(), new ArrayList<>()); - - retVal = JPackageHelper.execute(null, app2); - if (retVal != 0) { - throw new AssertionError("Test application exited with error: " - + retVal); - } - validateResult(arguments, vmArguments); - } - - public static void testCreateImage(String [] cmd) throws Exception { - JPackageHelper.executeCLI(true, cmd); - validate(); - } - - public static void testCreateImageToolProvider(String [] cmd) throws Exception { - JPackageHelper.executeToolProvider(true, cmd); - validate(); - } - - public static void createSLProperties() throws Exception { - arguments.add(ARGUMENT1); - arguments.add(ARGUMENT2); - arguments.add(ARGUMENT3); - - String argumentsMap = - JPackageHelper.listToArgumentsMap(arguments, true); - - vmArguments.add(PARAM1); - vmArguments.add(PARAM2); - vmArguments.add(PARAM3); - - String vmArgumentsMap = - JPackageHelper.listToArgumentsMap(vmArguments, true); - - try (PrintWriter out = new PrintWriter(new BufferedWriter( - new FileWriter("sl.properties")))) { - out.println("name=test2"); - out.println("arguments=" + argumentsMap); - out.println("jvm-args=" + vmArgumentsMap); - } - } - -} --- old/test/jdk/tools/jpackage/createimage/JPackageCreateImageSecondaryLauncherModuleTest.java 2019-03-05 14:55:27.242970000 -0500 +++ /dev/null 2019-03-05 14:55:27.000000000 -0500 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2018, 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. - * - * 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. - */ - - /* - * @test - * @summary jpackage create image with secondary launcher test - * @library ../helpers - * @build JPackageHelper - * @build JPackagePath - * @build JPackageCreateImageSecondaryLauncherBase - * @modules jdk.jpackage - * @run main/othervm -Xmx512m JPackageCreateImageSecondaryLauncherModuleTest - */ -public class JPackageCreateImageSecondaryLauncherModuleTest { - private static final String OUTPUT = "output"; - private static final String [] CMD = { - "create-image", - "--output", OUTPUT, - "--name", "test", - "--module", "com.hello/com.hello.Hello", - "--module-path", "input", - "--secondary-launcher", "sl.properties"}; - - public static void main(String[] args) throws Exception { - JPackageHelper.createHelloModule(); - JPackageCreateImageSecondaryLauncherBase.createSLProperties(); - JPackageCreateImageSecondaryLauncherBase.testCreateImage(CMD); - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageCreateImageSecondaryLauncherBase.testCreateImageToolProvider(CMD); - } - -} --- old/test/jdk/tools/jpackage/createimage/JPackageCreateImageSecondaryLauncherTest.java 2019-03-05 14:55:30.145607300 -0500 +++ /dev/null 2019-03-05 14:55:30.000000000 -0500 @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2018, 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. - * - * 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. - */ - - /* - * @test - * @summary jpackage create image with secondary launcher test - * @library ../helpers - * @build JPackageHelper - * @build JPackagePath - * @build JPackageCreateImageSecondaryLauncherBase - * @modules jdk.jpackage - * @run main/othervm -Xmx512m JPackageCreateImageSecondaryLauncherTest - */ -public class JPackageCreateImageSecondaryLauncherTest { - private static final String OUTPUT = "output"; - private static final String [] CMD = { - "create-image", - "--input", "input", - "--output", OUTPUT, - "--name", "test", - "--main-jar", "hello.jar", - "--main-class", "Hello", - "--files", "hello.jar", - "--secondary-launcher", "sl.properties"}; - - public static void main(String[] args) throws Exception { - JPackageHelper.createHelloImageJar(); - JPackageCreateImageSecondaryLauncherBase.createSLProperties(); - JPackageCreateImageSecondaryLauncherBase.testCreateImage(CMD); - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageCreateImageSecondaryLauncherBase.testCreateImageToolProvider(CMD); - } - -}