Commits

shemnon committed bb232be

tweak to allow for packaging NO_RUNTIME

  • Participants
  • Parent commits 200ffa4

Comments (0)

Files changed (3)

File gradle-javafx-plugin/src/main/groovy/org/bitbucket/shemnon/javafxplugin/JavaFXPluginExtension.groovy

 
 import java.awt.image.BufferedImage
 
-class JavaFXPluginExtension { //extends BasePluginConvention {
+class JavaFXPluginExtension {
+
+    public static final String NO_RUNTIME = '<NO RUNTIME>'
 
     protected Map<String, JavaFXPluginExtension> overrides = [:]
 
     Map<String, String> systemProperties = [:]
     List<String> arguments = []
 
-    File javaRuntime
+    String javaRuntime
 
     // deploy/info attributes
     String category

File gradle-javafx-plugin/src/main/groovy/org/bitbucket/shemnon/javafxplugin/tasks/JavaFXDeployTask.groovy

 import net.sf.image4j.codec.bmp.BMPEncoder
 import net.sf.image4j.codec.ico.ICOEncoder
 import org.bitbucket.shemnon.javafxplugin.IconInfo
+import org.bitbucket.shemnon.javafxplugin.JavaFXPluginExtension
 import org.gradle.api.file.FileCollection
 import org.gradle.api.internal.ConventionTask
 import org.gradle.api.tasks.InputDirectory
 import org.gradle.api.tasks.OutputDirectory
 import org.gradle.api.tasks.TaskAction
 import org.gradle.internal.os.OperatingSystem
+import org.gradle.tooling.BuildException
 import org.gradle.util.ConfigureUtil
 
 import javax.imageio.ImageIO
     Map<String, String> systemProperties = [:]
     List<String> arguments = []
 
-    File javaRuntime
+    String javaRuntime
 
     // deploy/info attributes
     String category
         getSystemProperties().each {k, v -> deployParams.addJvmProperty(k, v)}
         deployParams.arguments = getArguments()
 
-        if (getJavaRuntime() != null) {
-            deployParams.javaRuntimeSource = getJavaRuntime()
+        String runtime = getJavaRuntime()
+        if (runtime != null) {
+            File rtFile
+            if (runtime == JavaFXPluginExtension.NO_RUNTIME) {
+                getLogger().info("Java runtime to be bundled: none, bundle will rely on locally installed runtimes")
+                rtFile = null
+            } else {
+                getLogger().info("Java runtime to be bundled: $runtime")
+                rtFile = new File(runtime)
+                if (!rtFile.exists()) {
+                    throw new BuildException("No files found at specified runime path: $runtime")
+                }
+            }
+            deployParams.javaRuntimeSource = rtFile
+        } else {
+            getLogger().info("Java runtime to be bundled: the runtime executing the Gradle build")
         }
 
         File packageResourcesOutput = project.sourceSets['package'].output.resourcesDir

File samples/FullyExpressed/build.gradle

     // not every possible platform override, but ones that have a known impact
     windows {
         id = 'c533f663-1efd-489f-b910-4c7ec20c7fd0'
-        category='JavaFX Demos'
-        javaRuntime = file('C:/Program Files (x86)/Java/jdk1.7.0_21')
+        category = 'JavaFX Demos'
+        javaRuntime = 'C:/Program Files (x86)/Java/jdk1.7.0_21'
     }
 
     macosx {
         id = 'net.java.openjdk.openjfx.Ensemble2'
         category = 'public.app-category.developer-tools'
-        javaRuntime = file('/Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/')
+        javaRuntime = '/Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/'
     }
 
     linux {
         // linux doesn't care about id, it goes un-used at the moment
-        category='Development'
-        javaRuntime='/usr/lib/jvm/java-7-oracle'
+        category = 'Development'
+        javaRuntime = '/usr/lib/jvm/java-7-oracle'
     }
 
     debugKey {