changeset 4165:35618c416587

RT-31378: Gradle build doesn't produce .a files for iOS, only dylib Contributed-By: Danno Ferrin <shemnon>
author rbair
date Wed, 03 Jul 2013 10:08:46 -0700
parents cb27f5403f2e
children d56bf9890fe6
files build.gradle buildSrc/android.gradle buildSrc/armv6hf.gradle buildSrc/armv6sf.gradle buildSrc/ios.gradle buildSrc/linux.gradle buildSrc/mac.gradle buildSrc/win.gradle
diffstat 8 files changed, 31 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/build.gradle	Wed Jul 03 10:55:04 2013 -0400
+++ b/build.gradle	Wed Jul 03 10:08:46 2013 -0700
@@ -96,18 +96,6 @@
 }
 
 /**
- * Converts the simple name of a library to the full name. For example, on mac
- * the simple name "glass" becomes "libglass.dylib". On Linux or Solaris, it would
- * be "libglass.so", and on Windows "glass.dll".
- *
- * @param name The simple name of the library
- * @return The name of the shared library file
- */
-String library(String name) {
-    return "${IS_WINDOWS ? '' : 'lib'}$name.${IS_WINDOWS ? 'dll' : IS_MAC ? 'dylib' : 'so'}"
-}
-
-/**
  * Converts cygwin style paths to windows style paths, but with a forward slash.
  * This method is safe to call from any platform, and will only do work if
  * called on Windows (in all other cases it simply returns the supplied path.
@@ -649,6 +637,7 @@
     // For each compile target, create a javah / cc / link triplet
     compileTargets { t ->
         def targetProperties = project.rootProject.ext[t.upper]
+        def library = targetProperties.library
         def properties = targetProperties.get(name)
         def nativeDir = file("$nativeRootDir/${t.name}")
         def headerDir = file("$headerRootDir/${t.name}")
@@ -1051,6 +1040,7 @@
         def upperTarget = t.upper
         def capitalTarget = t.capital
         def properties = rootProject.ext[upperTarget];
+        def library = properties.library
 
         def ccTask = task("compileDecoraNativeShaders$capitalTarget", type: CCTask, dependsOn: generateDecoraNativeHeaders) {
             description = "Compiles Decora SSE natives"
@@ -1652,6 +1642,7 @@
 
 compileTargets { t ->
     def targetProperties = project.ext[t.upper]
+    def library = targetProperties.library
     // The jfxrt task is responsible for creating the jfxrt.jar. A developer may
     // have multiple SDK's on their system at any one time, depending on which
     // cross compiles they have done. For example, I might have:
@@ -1703,20 +1694,14 @@
             // TODO instead of using copy everywhere, I probably want to use "sync" instead?
             // Copy all of the .dll / .so / .dylib native libraries into build/sdk/rt/lib/
             copy {
-                from("modules/graphics/build/libs/jsl-decora/${t.name}/${library(targetProperties.decora.lib)}",
-                     "modules/graphics/build/libs/prism/${t.name}/${library(targetProperties.prism.lib)}",
-                     "modules/graphics/build/libs/prismSW/${t.name}/${library(targetProperties.prismSW.lib)}",
-                     "modules/graphics/build/libs/font/${t.name}/${library(targetProperties.font.lib)}",
-                     "modules/graphics/build/libs/iio/${t.name}/${library(targetProperties.iio.lib)}");
-                def es2Variants = targetProperties.prismES2.containsKey("variants") ? targetProperties.prismES2.variants : [""];
-                es2Variants.each { variant ->
-                    def variantProperties = variant == "" ? targetProperties.prismES2 : targetProperties.prismES2.get(variant)
-                    from ("modules/graphics/build/libs/prismES2/${t.name}/${library(variantProperties.lib)}");
-                }
-                def glassVariants = targetProperties.glass.containsKey("variants") ? targetProperties.glass.variants : [""];
-                glassVariants.each { variant ->
-                    def variantProperties = variant == "" ? targetProperties.glass : targetProperties.glass.get(variant)
-                    from ("modules/graphics/build/libs/glass/${t.name}/${library(variantProperties.lib)}");
+                from("modules/graphics/build/libs/jsl-decora/${t.name}/${library(targetProperties.decora.lib)}")
+                ['font', 'prism', 'prismSW', 'prismES2', 'glass', 'iio'].each { lib ->
+                    def variants = targetProperties[lib].containsKey('variants') ? targetProperties[lib].variants : [null]
+                    variants.each { variant ->
+                        def variantProperties = variant ? targetProperties[lib][variant] : targetProperties[lib]
+                        println "modules/graphics/build/libs/$lib/$t.name/${library(variantProperties.lib)}"
+                        from ("modules/graphics/build/libs/$lib/$t.name/${library(variantProperties.lib)}")
+                    }
                 }
                 if (IS_WINDOWS) {
                     from ("modules/graphics/build/libs/prismD3D/${t.name}/${library(targetProperties.prismD3D.lib)}");
--- a/buildSrc/android.gradle	Wed Jul 03 10:55:04 2013 -0400
+++ b/buildSrc/android.gradle	Wed Jul 03 10:08:46 2013 -0700
@@ -234,6 +234,8 @@
 android.com.sun.javafx.isEmbedded=true
 """
 
+ANDROID.library = { name -> return "lib${name}.so" as String }
+
 def ccFlags = ["-std=c99", "-DANDROID", "-c", "-nostdlib", "-DANDROID_NDK"]
 def ccOptFlags = ["-fpic", "-ffunction-sections", "-funwind-tables","-fstack-protector",
                   "-Os", "-O2", "-fno-strict-aliasing", "-finline-limit=64", "-fomit-frame-pointer"]
--- a/buildSrc/armv6hf.gradle	Wed Jul 03 10:55:04 2013 -0400
+++ b/buildSrc/armv6hf.gradle	Wed Jul 03 10:08:46 2013 -0700
@@ -42,6 +42,9 @@
     return;
 }
 
+// Lambda for naming the generated libs
+ARMv6HF.library = { name -> return "lib${name}.so" as String }
+
 // alias for this platform in legacy artifacts
 ARMV6HF.artifactsName = "armv6hf-vfp"
 
--- a/buildSrc/armv6sf.gradle	Wed Jul 03 10:55:04 2013 -0400
+++ b/buildSrc/armv6sf.gradle	Wed Jul 03 10:08:46 2013 -0700
@@ -41,6 +41,9 @@
     return;
 }
 
+// Lambda for naming the generated libs
+ARMv6SF.library = { name -> return "lib${name}.so" as String }
+
 // alias for this platform in legacy artifacts
 ARMV6SF.artifactsName = "armv6-vfp"
 
--- a/buildSrc/ios.gradle	Wed Jul 03 10:55:04 2013 -0400
+++ b/buildSrc/ios.gradle	Wed Jul 03 10:08:46 2013 -0700
@@ -34,6 +34,9 @@
 IOS.compileFXPackager = false;
 IOS.compileDesignTime = false;
 
+// Lambda for naming the generated libs
+IOS.library = { name -> return "lib${name}.a" as String }
+
 IOS.libDest = "lib"
 
 IOS.jfxrtJarExcludes = [
--- a/buildSrc/linux.gradle	Wed Jul 03 10:55:04 2013 -0400
+++ b/buildSrc/linux.gradle	Wed Jul 03 10:08:46 2013 -0700
@@ -66,6 +66,9 @@
     "com/sun/prism/es2/MacGL*",
 ]
 
+// Lambda for naming the generated libs
+LINUX.library = { name -> return "lib${name}.so" as String }
+
 // A set of common parameters to use for both compiling and linking
 def commonFlags = [
         "-fno-strict-aliasing", "-fPIC", "-fno-omit-frame-pointer", // optimization flags
--- a/buildSrc/mac.gradle	Wed Jul 03 10:55:04 2013 -0400
+++ b/buildSrc/mac.gradle	Wed Jul 03 10:08:46 2013 -0700
@@ -34,6 +34,9 @@
 MAC.compileFXPackager = true;
 MAC.compileDesignTime = true;
 
+// Lambda for naming the generated libs
+MAC.library = { name -> return "lib${name}.dylib" as String }
+
 MAC.libDest = "lib"
 MAC.jfxrtJarExcludes = [
     "**/*.hlsl",
--- a/buildSrc/win.gradle	Wed Jul 03 10:55:04 2013 -0400
+++ b/buildSrc/win.gradle	Wed Jul 03 10:08:46 2013 -0700
@@ -33,6 +33,9 @@
 WIN.compileFXPackager = true;
 WIN.compileDesignTime = true;
 
+// Lambda for naming the generated libs
+WIN.library = { name -> return "${name}.dll" as String }
+
 WIN.libDest = "bin"
 WIN.jfxrtJarExcludes = [
     "com/sun/glass/events/mac",