8216373: temporary build-root left behind when using secondary launcher(s) JDK-8200758-branch
authorherrick
Tue, 08 Jan 2019 17:14:14 -0500
branchJDK-8200758-branch
changeset 57103 fe6bf39ac415
parent 57102 343071ed57f7
child 57104 57fead34cce2
8216373: temporary build-root left behind when using secondary launcher(s) Reviewed-by: almatvee
src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebBundler.java
src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxRpmBundler.java
src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources.properties
src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_ja.properties
src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_zh_CN.properties
src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBaseInstallerBundler.java
src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties
src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_ja.properties
src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_zh_CN.properties
src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java
src/jdk.jpackage/share/classes/jdk/jpackage/internal/StandardBundlerParam.java
src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties
src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties
src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties
src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinExeBundler.java
src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinMsiBundler.java
src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WindowsAppImageBuilder.java
src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources.properties
src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_ja.properties
src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_zh_CN.properties
--- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebBundler.java	Tue Jan 08 17:12:24 2019 -0500
+++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebBundler.java	Tue Jan 08 17:14:14 2019 -0500
@@ -104,15 +104,6 @@
                     + VERSION.fetchFrom(params),
             (s, p) -> s);
 
-    public static final BundlerParamInfo<File> CONFIG_ROOT =
-            new StandardBundlerParam<>(
-            I18N.getString("param.config-root.name"),
-            I18N.getString("param.config-root.description"),
-            "configRoot",
-            File.class,
-            params ->  new File(BUILD_ROOT.fetchFrom(params), "linux"),
-            (s, p) -> new File(s));
-
     public static final BundlerParamInfo<File> DEB_IMAGE_DIR =
             new StandardBundlerParam<>(
             I18N.getString("param.image-dir.name"),
--- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxRpmBundler.java	Tue Jan 08 17:12:24 2019 -0500
+++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxRpmBundler.java	Tue Jan 08 17:14:14 2019 -0500
@@ -69,15 +69,6 @@
             },
             (s, p) -> new File(s));
 
-    public static final BundlerParamInfo<File> CONFIG_ROOT =
-            new StandardBundlerParam<>(
-            I18N.getString("param.config-root.name"),
-            I18N.getString("param.config-root.description"),
-            "configRoot",
-            File.class,
-            params ->  new File(BUILD_ROOT.fetchFrom(params), "linux"),
-            (s, p) -> new File(s));
-
     // Fedora rules for package naming are used here
     // https://fedoraproject.org/wiki/Packaging:NamingGuidelines?rd=Packaging/NamingGuidelines
     //
--- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources.properties	Tue Jan 08 17:12:24 2019 -0500
+++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources.properties	Tue Jan 08 17:14:14 2019 -0500
@@ -43,8 +43,6 @@
 param.full-package-name.description=Deb Package Name
 param.image-dir.name=Image Dir
 param.image-dir.description=Image Dir
-param.config-root.name=Config Root Dir
-param.config-root.description=Config Root Dir
 param.app-image-root.name=Image Root Dir
 param.app-image-root.description=Image Root Dir
 param.config-dir.name=Config Dir
--- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_ja.properties	Tue Jan 08 17:12:24 2019 -0500
+++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_ja.properties	Tue Jan 08 17:14:14 2019 -0500
@@ -43,8 +43,6 @@
 param.full-package-name.description=Deb Package Name
 param.image-dir.name=Image Dir
 param.image-dir.description=Image Dir
-param.config-root.name=Config Root Dir
-param.config-root.description=Config Root Dir
 param.app-image-root.name=Image Root Dir
 param.app-image-root.description=Image Root Dir
 param.config-dir.name=Config Dir
--- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_zh_CN.properties	Tue Jan 08 17:12:24 2019 -0500
+++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_zh_CN.properties	Tue Jan 08 17:14:14 2019 -0500
@@ -43,8 +43,6 @@
 param.full-package-name.description=Deb Package Name
 param.image-dir.name=Image Dir
 param.image-dir.description=Image Dir
-param.config-root.name=Config Root Dir
-param.config-root.description=Config Root Dir
 param.app-image-root.name=Image Root Dir
 param.app-image-root.description=Image Root Dir
 param.config-dir.name=Config Dir
--- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBaseInstallerBundler.java	Tue Jan 08 17:12:24 2019 -0500
+++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBaseInstallerBundler.java	Tue Jan 08 17:14:14 2019 -0500
@@ -76,20 +76,6 @@
             },
             (s, p) -> new File(s));
 
-    public static final BundlerParamInfo<File> CONFIG_ROOT =
-            new StandardBundlerParam<>(
-            I18N.getString("param.config-root.name"),
-            I18N.getString("param.config-root.description"),
-            "configRoot",
-            File.class,
-            params -> {
-                File imagesRoot =
-                        new File(BUILD_ROOT.fetchFrom(params), "macosx");
-                imagesRoot.mkdirs();
-                return imagesRoot;
-            },
-            (s, p) -> null);
-
     public static final BundlerParamInfo<String> SIGNING_KEY_USER =
             new StandardBundlerParam<>(
             I18N.getString("param.signing-key-name.name"),
--- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties	Tue Jan 08 17:12:24 2019 -0500
+++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties	Tue Jan 08 17:14:14 2019 -0500
@@ -37,8 +37,6 @@
 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.config-root.name=Config Root Dir
-param.config-root.description=Configuration directory.
 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
--- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_ja.properties	Tue Jan 08 17:12:24 2019 -0500
+++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_ja.properties	Tue Jan 08 17:14:14 2019 -0500
@@ -37,8 +37,6 @@
 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.config-root.name=Config Root Dir
-param.config-root.description=Configuration directory.
 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
--- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_zh_CN.properties	Tue Jan 08 17:12:24 2019 -0500
+++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_zh_CN.properties	Tue Jan 08 17:14:14 2019 -0500
@@ -37,8 +37,6 @@
 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.config-root.name=Config Root Dir
-param.config-root.description=Configuration directory.
 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
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java	Tue Jan 08 17:12:24 2019 -0500
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java	Tue Jan 08 17:14:14 2019 -0500
@@ -719,8 +719,16 @@
 
     private boolean generateBundle(Map<String,? super Object> params)
             throws PackagerException {
+
         boolean bundleCreated = false;
-        File imageDir = null;
+
+        // the build-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
+        // 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()) {
             Map<String, ? super Object> localParams = new HashMap<>(params);
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/StandardBundlerParam.java	Tue Jan 08 17:12:24 2019 -0500
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/StandardBundlerParam.java	Tue Jan 08 17:14:14 2019 -0500
@@ -340,6 +340,21 @@
                     (s, p) -> new File(s)
             );
 
+    public static final StandardBundlerParam<File> 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");
+                    root.mkdirs();
+                    return root;
+                },
+                (s, p) -> null
+            );
+
     static final StandardBundlerParam<String> IDENTIFIER =
             new StandardBundlerParam<>(
                     I18N.getString("param.identifier.name"),
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties	Tue Jan 08 17:12:24 2019 -0500
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties	Tue Jan 08 17:14:14 2019 -0500
@@ -26,6 +26,8 @@
 
 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
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties	Tue Jan 08 17:12:24 2019 -0500
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties	Tue Jan 08 17:14:14 2019 -0500
@@ -26,6 +26,8 @@
 
 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
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties	Tue Jan 08 17:12:24 2019 -0500
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties	Tue Jan 08 17:14:14 2019 -0500
@@ -26,6 +26,8 @@
 
 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
--- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinExeBundler.java	Tue Jan 08 17:12:24 2019 -0500
+++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinExeBundler.java	Tue Jan 08 17:14:14 2019 -0500
@@ -49,20 +49,6 @@
             params -> new WinAppBundler(),
             null);
 
-    public static final BundlerParamInfo<File> CONFIG_ROOT =
-            new WindowsBundlerParam<>(
-            getString("param.config-root.name"),
-            getString("param.config-root.description"),
-            "configRoot",
-            File.class,
-            params -> {
-                File imagesRoot =
-                        new File(BUILD_ROOT.fetchFrom(params), "windows");
-                imagesRoot.mkdirs();
-                return imagesRoot;
-            },
-            (s, p) -> null);
-
     public static final BundlerParamInfo<File> EXE_IMAGE_DIR =
             new WindowsBundlerParam<>(
             getString("param.image-dir.name"),
--- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinMsiBundler.java	Tue Jan 08 17:12:24 2019 -0500
+++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinMsiBundler.java	Tue Jan 08 17:14:14 2019 -0500
@@ -58,20 +58,6 @@
             params -> false,
             (s, p) -> Boolean.valueOf(s));
 
-    public static final BundlerParamInfo<File> CONFIG_ROOT =
-            new WindowsBundlerParam<>(
-            I18N.getString("param.config-root.name"),
-            I18N.getString("param.config-root.description"),
-            "configRoot",
-            File.class,
-            params -> {
-                File imagesRoot =
-                        new File(BUILD_ROOT.fetchFrom(params), "windows");
-                imagesRoot.mkdirs();
-                return imagesRoot;
-            },
-            (s, p) -> null);
-
     public static final BundlerParamInfo<File> MSI_IMAGE_DIR =
             new WindowsBundlerParam<>(
             I18N.getString("param.image-dir.name"),
--- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WindowsAppImageBuilder.java	Tue Jan 08 17:12:24 2019 -0500
+++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WindowsAppImageBuilder.java	Tue Jan 08 17:14:14 2019 -0500
@@ -76,20 +76,6 @@
 
     private final Map<String, ? super Object> params;
 
-    public static final BundlerParamInfo<File> CONFIG_ROOT =
-            new WindowsBundlerParam<>(
-            I18N.getString("param.config-root.name"),
-            I18N.getString("param.config-root.description"),
-            "configRoot",
-            File.class,
-            params -> {
-                File imagesRoot =
-                        new File(BUILD_ROOT.fetchFrom(params), "windows");
-                imagesRoot.mkdirs();
-                return imagesRoot;
-            },
-            (s, p) -> null);
-
     public static final BundlerParamInfo<Boolean> REBRAND_EXECUTABLE =
             new WindowsBundlerParam<>(
             I18N.getString("param.rebrand-executable.name"),
@@ -272,7 +258,7 @@
         List<Map<String, ? super Object>> entryPoints =
                 StandardBundlerParam.SECONDARY_LAUNCHERS.fetchFrom(params);
         for (Map<String, ? super Object> entryPoint : entryPoints) {
-        Map<String, ? super Object> tmp = new HashMap<>(originalParams);
+            Map<String, ? super Object> tmp = new HashMap<>(originalParams);
             tmp.putAll(entryPoint);
             createLauncherForEntryPoint(tmp);
         }
--- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources.properties	Tue Jan 08 17:12:24 2019 -0500
+++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources.properties	Tue Jan 08 17:14:14 2019 -0500
@@ -31,8 +31,6 @@
 msi.bundler.name=MSI Installer
 msi.bundler.description=Microsoft Windows MSI Installer, via WiX.
 
-param.config-root.name=Config Root Dir
-param.config-root.description=Config Root Dir
 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
--- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_ja.properties	Tue Jan 08 17:12:24 2019 -0500
+++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_ja.properties	Tue Jan 08 17:14:14 2019 -0500
@@ -31,8 +31,6 @@
 msi.bundler.name=MSI Installer
 msi.bundler.description=Microsoft Windows MSI Installer, via WiX.
 
-param.config-root.name=Config Root Dir
-param.config-root.description=Config Root Dir
 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
--- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_zh_CN.properties	Tue Jan 08 17:12:24 2019 -0500
+++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_zh_CN.properties	Tue Jan 08 17:14:14 2019 -0500
@@ -31,8 +31,6 @@
 msi.bundler.name=MSI Installer
 msi.bundler.description=Microsoft Windows MSI Installer, via WiX.
 
-param.config-root.name=Config Root Dir
-param.config-root.description=Config Root Dir
 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