changeset 5507:10fb5c46af44

RT-30792: Allow multiple "packaging" types to be specified [mhowe] Contributed-by: Danno Ferrin <danno.ferrin@shemnon.com> Minor change added to strip first "[" as well as last and to trim each element in list
author mhowe
date Wed, 23 Oct 2013 11:18:52 -0700
parents 5e2ca3c5b155
children 80479a15026b
files modules/fxpackager/src/main/java/com/sun/javafx/tools/packager/bundlers/BundleParams.java modules/fxpackager/src/main/java/com/sun/javafx/tools/packager/bundlers/Bundler.java modules/fxpackager/src/main/java/com/sun/javafx/tools/packager/bundlers/LinuxDebBundler.java modules/fxpackager/src/main/java/com/sun/javafx/tools/packager/bundlers/LinuxRPMBundler.java modules/fxpackager/src/main/java/com/sun/javafx/tools/packager/bundlers/MacDMGBundler.java modules/fxpackager/src/main/java/com/sun/javafx/tools/packager/bundlers/WinExeBundler.java modules/fxpackager/src/main/java/com/sun/javafx/tools/packager/bundlers/WinMsiBundler.java
diffstat 7 files changed, 18 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/modules/fxpackager/src/main/java/com/sun/javafx/tools/packager/bundlers/BundleParams.java	Mon Oct 21 15:18:12 2013 -0700
+++ b/modules/fxpackager/src/main/java/com/sun/javafx/tools/packager/bundlers/BundleParams.java	Wed Oct 23 11:18:52 2013 -0700
@@ -35,6 +35,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.TreeSet;
 import java.util.jar.Attributes;
 import java.util.jar.JarFile;
 import java.util.jar.Manifest;
@@ -44,7 +45,7 @@
     RelativeFileSet runtime;
     RelativeFileSet appResources;
     Bundler.BundleType type;
-    String bundleFormat;
+    Set<String> bundleFormat = new TreeSet<String>();
     File icon;
 
     /* Name of bundle file and native launcher.
@@ -194,7 +195,16 @@
     }
 
     public void setBundleFormat(String t) {
-        bundleFormat = t;
+        bundleFormat.clear();
+        if (t != null) {
+            if (t.startsWith("[") && t.endsWith("]")) {
+                t = t.substring(1, t.length() - 1);
+            }
+            for (String s : t.split(",")) {
+                if (s.isEmpty()) continue;
+                bundleFormat.add(s.trim());
+            }
+        }
     }
 
     private boolean shouldExclude(File baseDir, File f, Rule ruleset[]) {
--- a/modules/fxpackager/src/main/java/com/sun/javafx/tools/packager/bundlers/Bundler.java	Mon Oct 21 15:18:12 2013 -0700
+++ b/modules/fxpackager/src/main/java/com/sun/javafx/tools/packager/bundlers/Bundler.java	Wed Oct 23 11:18:52 2013 -0700
@@ -106,7 +106,7 @@
         } catch (IOException ioe) {}
 
         Log.verbose("Looking for bundlers for type=" + p.type.toString()
-                + " format=" + (p.bundleFormat != null ? p.bundleFormat : "any"));
+                + " format=" + (p.bundleFormat.isEmpty() ? "any" : p.bundleFormat.toString()));
         for (Bundler b: knownBundlers) {
             if (verbose) {
                 b.setVerbose(true);
--- a/modules/fxpackager/src/main/java/com/sun/javafx/tools/packager/bundlers/LinuxDebBundler.java	Mon Oct 21 15:18:12 2013 -0700
+++ b/modules/fxpackager/src/main/java/com/sun/javafx/tools/packager/bundlers/LinuxDebBundler.java	Wed Oct 23 11:18:52 2013 -0700
@@ -91,7 +91,7 @@
     @Override
     boolean validate(BundleParams p) throws Bundler.UnsupportedPlatformException, Bundler.ConfigException {
         if (!(p.type == Bundler.BundleType.ALL || p.type == Bundler.BundleType.INSTALLER)
-                 || !(p.bundleFormat == null || "deb".equals(p.bundleFormat))) {
+                 || !(p.bundleFormat.isEmpty() || p.bundleFormat.contains("deb"))) {
             return false;
         }
         //run basic validation to ensure requirements are met
--- a/modules/fxpackager/src/main/java/com/sun/javafx/tools/packager/bundlers/LinuxRPMBundler.java	Mon Oct 21 15:18:12 2013 -0700
+++ b/modules/fxpackager/src/main/java/com/sun/javafx/tools/packager/bundlers/LinuxRPMBundler.java	Wed Oct 23 11:18:52 2013 -0700
@@ -86,7 +86,7 @@
     @Override
     boolean validate(BundleParams p) throws Bundler.UnsupportedPlatformException, Bundler.ConfigException {
         if (!(p.type == Bundler.BundleType.ALL || p.type == Bundler.BundleType.INSTALLER)
-                 || !(p.bundleFormat == null || "rpm".equals(p.bundleFormat))) {
+                 || !(p.bundleFormat.isEmpty() || p.bundleFormat.contains("rpm"))) {
             return false;
         }
         //run basic validation to ensure requirements are met
--- a/modules/fxpackager/src/main/java/com/sun/javafx/tools/packager/bundlers/MacDMGBundler.java	Mon Oct 21 15:18:12 2013 -0700
+++ b/modules/fxpackager/src/main/java/com/sun/javafx/tools/packager/bundlers/MacDMGBundler.java	Wed Oct 23 11:18:52 2013 -0700
@@ -62,7 +62,7 @@
     boolean validate(BundleParams p)
             throws UnsupportedPlatformException, ConfigException {
         if (!(p.type == Bundler.BundleType.ALL || p.type == Bundler.BundleType.INSTALLER)
-                 || !(p.bundleFormat == null || "dmg".equals(p.bundleFormat))) {
+                 || !(p.bundleFormat.isEmpty() || p.bundleFormat.contains("dmg"))) {
             return false;
         }
         //run basic validation to ensure requirements are met
--- a/modules/fxpackager/src/main/java/com/sun/javafx/tools/packager/bundlers/WinExeBundler.java	Mon Oct 21 15:18:12 2013 -0700
+++ b/modules/fxpackager/src/main/java/com/sun/javafx/tools/packager/bundlers/WinExeBundler.java	Wed Oct 23 11:18:52 2013 -0700
@@ -104,7 +104,7 @@
     @Override
     boolean validate(BundleParams p) throws Bundler.UnsupportedPlatformException, Bundler.ConfigException {
         if (!(p.type == Bundler.BundleType.ALL || p.type == Bundler.BundleType.INSTALLER)
-                 || !(p.bundleFormat == null || "exe".equals(p.bundleFormat))) {
+                 || !(p.bundleFormat.isEmpty() || p.bundleFormat.contains("exe"))) {
             return false;
         }
         //run basic validation to ensure requirements are met
--- a/modules/fxpackager/src/main/java/com/sun/javafx/tools/packager/bundlers/WinMsiBundler.java	Mon Oct 21 15:18:12 2013 -0700
+++ b/modules/fxpackager/src/main/java/com/sun/javafx/tools/packager/bundlers/WinMsiBundler.java	Wed Oct 23 11:18:52 2013 -0700
@@ -104,7 +104,7 @@
     @Override
     boolean validate(BundleParams p) throws UnsupportedPlatformException, ConfigException {
         if (!(p.type == Bundler.BundleType.ALL || p.type == Bundler.BundleType.INSTALLER)
-                 || !(p.bundleFormat == null || "msi".equals(p.bundleFormat))) {
+                 || !(p.bundleFormat.isEmpty() || p.bundleFormat.contains("msi"))) {
             return false;
         }
         //run basic validation to ensure requirements are met