changeset 7805:e4cfda6bac5a

RT-38442: [packager] Java FX Packaging options can cause Windows Packager to fail. Summary: regexp needs double backslash, so that means quadruple in the source code.
author shemnon
date Tue, 26 Aug 2014 14:28:45 -0600
parents 4be6763a301a
children 7e3f564c5a26
files build.gradle modules/fxpackager/src/main/java/com/oracle/tools/packager/windows/WinAppBundler.java modules/fxpackager/src/test/java/com/oracle/tools/packager/windows/WinAppBundlerTest.java modules/graphics/src/main/java/com/sun/javafx/css/converters/SizeConverter.java
diffstat 3 files changed, 43 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/build.gradle	Tue Aug 26 16:28:03 2014 -0700
+++ b/build.gradle	Tue Aug 26 14:28:45 2014 -0600
@@ -2018,6 +2018,21 @@
         }
     }
 
+    task packagerFXPackagedJar(type: Jar) {
+        dependsOn packagerFakeJar
+        from compileTestJava.destinationDir
+        include "hello/**"
+
+        destinationDir project.file("build/tmp/tests/appResources")
+        archiveName "packagedMainApp.jar"
+
+        manifest {
+            attributes(
+                "JavaFX-Application-Class": "hello.TestPackager",
+            )
+        }
+    }
+
     if (!DO_BUILD_SDK_FOR_TEST) {
         def antJavafxJar = new File(TEST_SDK_DIR, "lib/ant-javafx.jar")
         [compileTestJava, test].each {
@@ -2026,7 +2041,7 @@
     }
 
     test {
-        dependsOn packagerFakeJar
+        dependsOn packagerFXPackagedJar
         systemProperty "RETAIN_PACKAGER_TESTS", RETAIN_PACKAGER_TESTS
         systemProperty "FULL_TEST", FULL_TEST
     }
--- a/modules/fxpackager/src/main/java/com/oracle/tools/packager/windows/WinAppBundler.java	Tue Aug 26 16:28:03 2014 -0700
+++ b/modules/fxpackager/src/main/java/com/oracle/tools/packager/windows/WinAppBundler.java	Tue Aug 26 14:28:45 2014 -0600
@@ -163,7 +163,7 @@
                 "lib\\\\rt.jar", // fallback canary for JDK 8
         });
         if (USE_FX_PACKAGING.fetchFrom(p)) {
-            testRuntime(WIN_RUNTIME.fetchFrom(p), new String[] {"lib\\ext\\jfxrt.jar", "lib\\jfxrt.jar"});
+            testRuntime(WIN_RUNTIME.fetchFrom(p), new String[] {"lib\\\\ext\\\\jfxrt.jar", "lib\\\\jfxrt.jar"});
         }
 
         //validate runtime bit-architectire
--- a/modules/fxpackager/src/test/java/com/oracle/tools/packager/windows/WinAppBundlerTest.java	Tue Aug 26 16:28:03 2014 -0700
+++ b/modules/fxpackager/src/test/java/com/oracle/tools/packager/windows/WinAppBundlerTest.java	Tue Aug 26 14:28:45 2014 -0600
@@ -61,7 +61,9 @@
     static File workDir;
     static File appResourcesDir;
     static File fakeMainJar;
+    static File packagedMainJar;
     static Set<File> appResources;
+    static Set<File> packagedAppResources;
     static boolean retain = false;
 
     @BeforeClass
@@ -76,8 +78,10 @@
         workDir = new File("build/tmp/tests", "winapp");
         appResourcesDir = new File("build/tmp/tests", "appResources");
         fakeMainJar = new File(appResourcesDir, "mainApp.jar");
+        packagedMainJar = new File(appResourcesDir, "packagedMainApp.jar");
 
         appResources = new HashSet<>(Arrays.asList(fakeMainJar));
+        packagedAppResources = new HashSet<>(Arrays.asList(packagedMainJar));
     }
 
     @Before
@@ -176,6 +180,28 @@
         assertTrue(output.isDirectory());
     }
     
+    /**
+     * FX Packaging used to trigger a logic bug.  Make sure it doesn't
+     */
+    @Test
+    public void fxPackaging() throws IOException, ConfigException, UnsupportedPlatformException {
+        Bundler bundler = new WinAppBundler();
+
+        Map<String, Object> bundleParams = new HashMap<>();
+
+        bundleParams.put(BUILD_ROOT.getID(), tmpBase);
+
+        bundleParams.put(APP_RESOURCES.getID(), new RelativeFileSet(appResourcesDir, packagedAppResources));
+
+        try {
+            boolean valid = bundler.validate(bundleParams);
+            assertTrue(valid);
+        } catch (ConfigException ce) {
+            assertTrue(ce.getMessage().contains("Java Runtime does not include"));
+        }
+
+    }
+
     public void validatePackageCfg(File root) throws IOException {
         try (FileInputStream fis = new FileInputStream(new File(root, "app\\package.cfg"))) {
             Properties p = new Properties();