changeset 4026:9c4360ee5f10

Gradle Build: Fix for broken fxpackager build on linux. I needed to change the way it was being built to support multiple source files but produce only a single output lib. Really the other fxpackager builds should be changed to work like this as well and not use the single-shot comple and link mechanism at all.
author rbair
date Thu, 20 Jun 2013 20:56:11 -0700
parents fa8ff5a5b9e6
children 4c80b614717f
files build.gradle gradleBuildSrc/linux.gradle
diffstat 2 files changed, 18 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/build.gradle	Thu Jun 20 17:22:41 2013 -0700
+++ b/build.gradle	Thu Jun 20 20:56:11 2013 -0700
@@ -1290,9 +1290,9 @@
         task compileLauncher(dependsOn: [compileWinLauncher, compileIconSwap])
         jar.dependsOn compileLauncher;
     } else if (COMPILE_FXPACKAGER) {
-        task compileLauncher(type: CCTask, group: "Build") {
-            description = "Compiles native sources for the application co-bundle launcher"
-            if (IS_MAC) {
+        if (IS_MAC) {
+            task compileLauncher(type: CCTask, group: "Build") {
+                description = "Compiles native sources for the application co-bundle launcher"
                 matches = ".*\\.m"
                 output(file("$buildDir/classes/main/com/sun/javafx/tools/resource/mac"))
                 params.addAll(MAC.launcher.ccFlags)
@@ -1301,19 +1301,26 @@
                 eachOutputFile = { f ->
                     return new File(f.getParent(), "JavaAppLauncher")
                 }
-            } else {
+            }
+            jar.dependsOn compileLauncher;
+        } else {
+            def ccTask = project.task("compileLauncher", type: CCTask, group: "Build") {
+                description = "Compiles native sources for the application co-bundle launcher"
                 matches = ".*\\.c"
-                output(file("$buildDir/classes/main/com/sun/javafx/tools/resource/linux"))
+                output(file("$buildDir/native/launcher"))
                 params.addAll(LINUX.launcher.ccFlags)
                 compiler = LINUX.launcher.compiler
-                linkerOptions.addAll(LINUX.launcher.linkFlags)
                 source file("src/main/native/launcher/linux")
-                eachOutputFile = { f ->
-                    return new File(f.getParent(), "JavaAppLauncher")
-                }
             }
+            def linkTask = project.task("linkLauncher", type: LinkTask, dependsOn: ccTask, group: "Build") {
+                description = "Creates native dynamic library for the application co-bundle launcher"
+                linker = LINUX.launcher.linker
+                linkParams.addAll(LINUX.launcher.linkFlags)
+                objectDir = file("$buildDir/native/launcher")
+                lib = file("$buildDir/classes/main/com/sun/javafx/tools/resource/linux/JavaAppLauncher")
+            }
+            jar.dependsOn linkTask;
         }
-        jar.dependsOn compileLauncher;
     }
 
     // Builds the javafxpackager executable. For everything other than windows,
--- a/gradleBuildSrc/linux.gradle	Thu Jun 20 17:22:41 2013 -0700
+++ b/gradleBuildSrc/linux.gradle	Thu Jun 20 20:56:11 2013 -0700
@@ -144,7 +144,7 @@
 
 LINUX.launcher = [:]
 LINUX.launcher.compiler = compiler
-LINUX.launcher.ccFlags = ["-DJAVAARCH=\"$OS_ARCH\"", "-I$JDK_HOME/include", "-I$JDK_HOME/include/linux"];
+LINUX.launcher.ccFlags = ["-DJAVAARCH=\"$OS_ARCH\"", "-I$JDK_HOME/include", "-I$JDK_HOME/include/linux", "-c"]
 LINUX.launcher.linker = linker
 LINUX.launcher.linkFlags = ["-ldl"]