changeset 5525:86c40357ada4

RT-33071: Gradle: command line override sometimes ignored for boolean properties Reviewed-by: felipe
author kcr
date Thu, 24 Oct 2013 15:51:51 -0700
parents ebd1bf49f546
children 405182d0e3c4
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, 60 insertions(+), 65 deletions(-) [+]
line wrap: on
line diff
--- a/build.gradle	Thu Oct 24 15:12:21 2013 -0700
+++ b/build.gradle	Thu Oct 24 15:51:51 2013 -0700
@@ -297,21 +297,21 @@
     apply from: supplementalPreBuildFile
 }
 
-// COMPILE_WEBKIT specifies whether to build all of webkit. COMPILE_MEDIA
-// specifies whether to build all of media. Both of these can be set by a
-// command line property
+// COMPILE_WEBKIT specifies whether to build all of webkit.
 defineProperty("COMPILE_WEBKIT", "false")
+ext.IS_COMPILE_WEBKIT = Boolean.parseBoolean(COMPILE_WEBKIT)
+
+// COMPILE_MEDIA specifies whether to build all of media.
 defineProperty("COMPILE_MEDIA", "false")
-if (COMPILE_WEBKIT instanceof String) ext.COMPILE_WEBKIT = Boolean.parseBoolean(COMPILE_WEBKIT)
-if (COMPILE_MEDIA instanceof String) ext.COMPILE_MEDIA = Boolean.parseBoolean(COMPILE_MEDIA)
+ext.IS_COMPILE_MEDIA = Boolean.parseBoolean(COMPILE_MEDIA)
 
 // COMPILE_PANGO specifies whether to build javafx-font-pango.
 defineProperty("COMPILE_PANGO", "false")
-if (COMPILE_PANGO instanceof String) ext.COMPILE_PANGO = Boolean.parseBoolean(COMPILE_PANGO)
+ext.IS_COMPILE_PANGO = Boolean.parseBoolean(COMPILE_PANGO)
 
 // COMPILE_PARFAIT specifies whether to build parfait
 defineProperty("COMPILE_PARFAIT", "false")
-if (COMPILE_PARFAIT instanceof String) ext.COMPILE_PARFAIT = Boolean.parseBoolean(COMPILE_PARFAIT)
+ext.IS_COMPILE_PARFAIT = Boolean.parseBoolean(COMPILE_PARFAIT)
 
 
 // Define the SWT.jar that we are going to have to download during the build process based
@@ -323,22 +323,16 @@
     IS_LINUX && !IS_64 ? "org.eclipse.swt.gtk.linux.x86_3.7.2.v3740f" : ""
 
 // Build javadocs only if BUILD_JAVADOC=true
-def buildJavadoc = false;
-if (hasProperty("BUILD_JAVADOC")) {
-    buildJavadoc = Boolean.parseBoolean(BUILD_JAVADOC);
-}
-ext.BUILD_JAVADOC = buildJavadoc;
+defineProperty("BUILD_JAVADOC", "false")
+ext.IS_BUILD_JAVADOC = Boolean.parseBoolean(BUILD_JAVADOC)
 
 // Specifies whether to build the javafx-src bundle
 defineProperty("BUILD_SRC_ZIP", "false")
 ext.IS_BUILD_SRC_ZIP = Boolean.parseBoolean(BUILD_SRC_ZIP)
 
 // Specifies whether to run full tests (true) or smoke tests (false)
-def isFullTest = false;
-if (hasProperty("FULL_TEST")) {
-    isFullTest = Boolean.parseBoolean(FULL_TEST);
-}
-ext.IS_FULL_TEST = isFullTest;
+defineProperty("FULL_TEST", "false")
+ext.IS_FULL_TEST = Boolean.parseBoolean(FULL_TEST);
 
 // Specify the build configuration (Release, Debug, or DebugNative)
 defineProperty("CONF", "Debug")
@@ -385,13 +379,14 @@
 project.ext.set("defaultHostTarget", IS_MAC ? "mac" : IS_WINDOWS ? "win" : IS_LINUX ? "linux" : "");
 defineProperty("COMPILE_TARGETS", "$defaultHostTarget")
 
-// Location of the cross compile tools
+// Flag indicating whether to import cross compile tools
 def importCrossTools = BUILD_CLOSED ? true : false;
 if (!importCrossTools && hasProperty("IMPORT_CROSS_TOOLS")) {
-    importCrossTools = Boolean.parseBoolean(BUILD_CLOSED);
+    importCrossTools = Boolean.parseBoolean(IMPORT_CROSS_TOOLS);
 }
-ext.IMPORT_CROSS_TOOLS = importCrossTools
+ext.IS_IMPORT_CROSS_TOOLS = importCrossTools
 
+// Location of the cross compile tools
 def crossToolsDir = "../crosslibs" 
 if (hasProperty("CROSS_TOOLS_DIR")) {
     crossToolsDir = CROSS_TOOLS_DIR
@@ -986,7 +981,7 @@
     // when generating JavaDocs for a specific project. When generating the JavaDocs for the
     // entire SDK, a different javadoc command is used (see the javadoc task on the top level)
     javadoc {
-        enabled = BUILD_JAVADOC
+        enabled = IS_BUILD_JAVADOC
         exclude("com/**/*", "javafx/scene/ParentDesignInfo*", "Compile*", "javafx/builder/**/*");
         executable = JAVADOC;
         options.windowTitle("JavaFX Project ${project.name} ${RELEASE_NAME}")
@@ -1084,7 +1079,7 @@
 
     // Currently lets not build pango by default
     if (IS_LINUX) {
-        addNative(project, "fontPango", ["linux","armv6hf", "armv6sf"],!COMPILE_PANGO)
+        addNative(project, "fontPango", ["linux","armv6hf", "armv6sf"],!IS_COMPILE_PANGO)
     }
 
     if (IS_WINDOWS) {
@@ -1402,7 +1397,7 @@
 
     if (!COMPILE_SWING) sourceSets.main.java.exclude ("**/swing/**")
     if (!COMPILE_SWT)   sourceSets.main.java.exclude ("**/swt/**")
-    if (!COMPILE_WEBKIT) sourceSets.main.java.exclude ("**/web/**")
+    if (!IS_COMPILE_WEBKIT) sourceSets.main.java.exclude ("**/web/**")
 
     dependencies {
         compile BUILD_SRC, project(":base"), project(":graphics"),
@@ -1655,7 +1650,7 @@
     }
 
     compileToolsJava {
-        enabled = COMPILE_MEDIA
+        enabled = IS_COMPILE_MEDIA
         classpath = sourceSets.main.output;
     }
 
@@ -1666,7 +1661,7 @@
     def generatedHeadersDir = file("${buildDir}/generated-src/headers")
     
     task generateHeaders(dependsOn: compileJava) {
-        enabled = COMPILE_MEDIA
+        enabled = IS_COMPILE_MEDIA
         doLast {
             def classpath = sourceSets.main.output;
             mkdir generatedHeadersDir;
@@ -1697,7 +1692,7 @@
     }
     
     task generateMediaErrorHeader(dependsOn: [compileToolsJava, compileJava]) {
-        enabled = COMPILE_MEDIA
+        enabled = IS_COMPILE_MEDIA
         doLast {
             def classpath = files(sourceSets.main.output, sourceSets.tools.output);
             def sourcepath = sourceSets.main.java.srcDirs;
@@ -1714,7 +1709,7 @@
     }
 
     task buildNativeTargets {
-        enabled = COMPILE_MEDIA
+        enabled = IS_COMPILE_MEDIA
     }
     
     compileTargets { t->        
@@ -1723,7 +1718,7 @@
         def mediaProperties = project.rootProject.ext[t.upper].media
         
         def buildNative = task("build${t.capital}Native", dependsOn: [generateHeaders, generateMediaErrorHeader]) {
-            enabled = COMPILE_MEDIA
+            enabled = IS_COMPILE_MEDIA
             doLast {
                 exec {
                     commandLine ("make", "${makeJobsFlag}", "-C", "${nativeSrcDir}/jfxmedia/projects/${projectDir}")
@@ -1748,7 +1743,7 @@
         if (!t.name.startsWith("arm")) {
             // Building GStreamer
             def buildGStreamer = task("build${t.capital}GStreamer") {
-                enabled = COMPILE_MEDIA
+                enabled = IS_COMPILE_MEDIA
                 doLast {
                     exec {
                         commandLine ("make", "${makeJobsFlag}", "-C", "${nativeSrcDir}/gstreamer/projects/${projectDir}/gstreamer-lite")
@@ -1764,7 +1759,7 @@
             }
 
             def buildPlugins = task("build${t.capital}Plugins", dependsOn: buildGStreamer) {
-                enabled = COMPILE_MEDIA
+                enabled = IS_COMPILE_MEDIA
 
                 if (!project.ext.properties.containsKey("ON2_SRCDIR"))
                     project.ext.ON2_SRCDIR = "";
@@ -1800,7 +1795,7 @@
 
             if (t.name == "linux") {
                 def buildAVPlugin = task( "buildAVPlugin", dependsOn: [buildPlugins]) {
-                    enabled = COMPILE_MEDIA
+                    enabled = IS_COMPILE_MEDIA
 
                     if (!project.ext.properties.containsKey("LIBAV"))
                         project.ext.LIBAV = "";
@@ -1819,7 +1814,7 @@
 
             if (t.name == "win" || t.name == "mac") {
                 def buildGlib = task("build${t.capital}Glib") {
-                    enabled = COMPILE_MEDIA
+                    enabled = IS_COMPILE_MEDIA
                     doLast {
                         exec {
                             commandLine ("make", "${makeJobsFlag}", "-C", "${nativeSrcDir}/gstreamer/projects/${projectDir}/glib-lite")
@@ -1844,7 +1839,7 @@
         exclude("headergen/**")
 
         dependsOn compileJava
-        if (COMPILE_MEDIA)
+        if (IS_COMPILE_MEDIA)
             dependsOn buildNativeTargets
     }
 }
@@ -1918,7 +1913,7 @@
 
 
 task javadoc(type: Javadoc) {
-    enabled = BUILD_JAVADOC
+    enabled = IS_BUILD_JAVADOC
     group = "Basic"
     description = "Generates the JavaDoc for all the public API"
     executable = JAVADOC
@@ -1992,7 +1987,7 @@
 // TODO: consider moving the "public-sdk" portion of this task here
 task publicExports() {
     doFirst {
-        if (!BUILD_JAVADOC) {
+        if (!IS_BUILD_JAVADOC) {
             fail("publicExports task requires: -PBUILD_JAVADOC=true")
         }
     }
@@ -2015,7 +2010,7 @@
 
 task zips() {
     doFirst {
-        if (!BUILD_JAVADOC) {
+        if (!IS_BUILD_JAVADOC) {
             fail("zips task requires: -PBUILD_JAVADOC=true")
         }
     }
@@ -2165,7 +2160,7 @@
                 def useLipo = targetProperties.containsKey('useLipo') ? targetProperties.useLipo : false
                 from("modules/graphics/build/libs/jsl-decora/${t.name}/${library(targetProperties.decora.lib)}")
                 def libs = ['font', 'prism', 'prismSW', 'prismES2', 'glass', 'iio']
-                if (COMPILE_PANGO) {
+                if (IS_COMPILE_PANGO) {
                     libs += 'fontPango';
                 }
                 libs.each { lib ->
@@ -2179,7 +2174,7 @@
                 if (IS_WINDOWS) {
                     from ("modules/graphics/build/libs/prismD3D/${t.name}/${library(targetProperties.prismD3D.lib)}");
                 }
-                if (COMPILE_WEBKIT) {
+                if (IS_COMPILE_WEBKIT) {
                     from ("modules/web/build/libs/${t.name}/${library('jfxwebkit')}")
                 } else {
                     if (t.name != "android" && t.name != "ios") {
@@ -2188,7 +2183,7 @@
                 }
 
                 def mediaBuildType = project(":media").ext.buildType
-                if (COMPILE_MEDIA) {
+                if (IS_COMPILE_MEDIA) {
                     [ "fxplugins", "gstreamer-lite", "jfxmedia" ].each { name ->
                         from ("modules/media/build/native/${t.name}/${mediaBuildType}/${library(name)}") }
                     
@@ -2227,7 +2222,7 @@
             // Copy over the javadocs that were generated. This is done rather than just generating
             // the docs into the "right place" because for a cross-compile you only need one set of
             // docs but need to have a copy in each created sdk
-            if (BUILD_JAVADOC) {
+            if (IS_BUILD_JAVADOC) {
                 copy {
                     from "build/javadoc"
                     into "build/${t.name}-sdk/docs/api"
@@ -2367,7 +2362,7 @@
         compile project(":base"), project(":graphics"), project(":controls"), project(":media")
     }
     
-    compileJava.enabled = COMPILE_WEBKIT
+    compileJava.enabled = IS_COMPILE_WEBKIT
     
     task generateHeaders(dependsOn: compileJava) {
         doLast {
@@ -2446,7 +2441,7 @@
                 workingDir("$projectDir/src/main/native")
                 if (t.name == "win") {
                     String qtDir = cygpath(System.getenv().get("QTSDK_DIR"))
-                    String parfaitPath = COMPILE_PARFAIT ? System.getenv().get("PARFAIT_PATH") + ";" : "";
+                    String parfaitPath = IS_COMPILE_PARFAIT ? System.getenv().get("PARFAIT_PATH") + ";" : "";
                     Map environmentSettings = new HashMap(WINDOWS_NATIVE_COMPILE_ENVIRONMENT)
                     environmentSettings["PATH"] = parfaitPath + "$WINDOWS_VS_PATH;$qtDir/bin;$qtDir/qt/bin"
                     environmentSettings["QMAKESPEC"] = "win32-msvc2008"
@@ -2498,7 +2493,7 @@
                     "WEBKITOUTPUTDIR" : webkitOutputDir,
                 ])
 
-                if (COMPILE_PARFAIT) {
+                if (IS_COMPILE_PARFAIT) {
                     environment([
                         "CC"        : "parfait-gcc",
                         "QMAKE_CC"  : "parfait-gcc",
@@ -2562,7 +2557,7 @@
         }
     }
 
-    if (COMPILE_WEBKIT) {
+    if (IS_COMPILE_WEBKIT) {
         jar.dependsOn compileGenerated, drtJar
     } else {
         jar.dependsOn copyClassesFromBinaryStub
--- a/buildSrc/android.gradle	Thu Oct 24 15:12:21 2013 -0700
+++ b/buildSrc/android.gradle	Thu Oct 24 15:51:51 2013 -0700
@@ -95,8 +95,6 @@
 def toolchainArchs = ["arm-linux-androideabi", "mipsel-linux-android", "x86"]
 def armArchs = ["armeabi", "armeabiv-7a"]
 
-defineProperty("COMPILE_PANGO", "false")
-
 ANDROID = [:]
 ANDROID.compileSwing = false;
 ANDROID.compileSWT = false;
@@ -544,4 +542,4 @@
 ANDROID.media = [:]
 ANDROID.media.compiler = compiler
 ANDROID.media.linker = linker
-ANDROID.media.lib = file("$compilerHome/bin/${toolchainArchs[0]}-ar").getAbsolutePath()
\ No newline at end of file
+ANDROID.media.lib = file("$compilerHome/bin/${toolchainArchs[0]}-ar").getAbsolutePath()
--- a/buildSrc/armv6hf.gradle	Thu Oct 24 15:12:21 2013 -0700
+++ b/buildSrc/armv6hf.gradle	Thu Oct 24 15:51:51 2013 -0700
@@ -28,7 +28,7 @@
 fetchExternalTools('ARMV6HF', 
   ["armhf-raspberry-pi-10.tgz",
    "gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux.tgz" ], 
-  rootProject.CROSS_TOOLS_DIR, rootProject.IMPORT_CROSS_TOOLS)
+  rootProject.CROSS_TOOLS_DIR, rootProject.IS_IMPORT_CROSS_TOOLS)
 
 // Define the location of the sdk and toolchain
 def sdk=file("${rootProject.CROSS_TOOLS_DIR}/armhf-raspberry-pi-10")
@@ -451,4 +451,4 @@
 ARMV6HF.media.compiler = compiler
 ARMV6HF.media.linker = linker
 ARMV6HF.media.extra_cflags = mediaCFlags.join(' ')
-ARMV6HF.media.extra_ldflags = mediaLFlags.join(' ')
\ No newline at end of file
+ARMV6HF.media.extra_ldflags = mediaLFlags.join(' ')
--- a/buildSrc/armv6sf.gradle	Thu Oct 24 15:12:21 2013 -0700
+++ b/buildSrc/armv6sf.gradle	Thu Oct 24 15:51:51 2013 -0700
@@ -26,7 +26,7 @@
 ext.ARMV6SF = [:]
 
 fetchExternalTools('ARMV6SF', [ "armv6-vfp-04.tgz" ], 
-  rootProject.CROSS_TOOLS_DIR, rootProject.IMPORT_CROSS_TOOLS)
+  rootProject.CROSS_TOOLS_DIR, rootProject.IS_IMPORT_CROSS_TOOLS)
 
 // Define the location of the sdk and toolchain
 def sdk=file("${rootProject.CROSS_TOOLS_DIR}/armv6-vfp-04")
@@ -470,4 +470,4 @@
 ARMV6SF.media.compiler = compiler
 ARMV6SF.media.linker = linker
 ARMV6SF.media.extra_cflags = mediaCFlags.join(' ')
-ARMV6SF.media.extra_ldflags = mediaLFlags.join(' ')
\ No newline at end of file
+ARMV6SF.media.extra_ldflags = mediaLFlags.join(' ')
--- a/buildSrc/ios.gradle	Thu Oct 24 15:12:21 2013 -0700
+++ b/buildSrc/ios.gradle	Thu Oct 24 15:51:51 2013 -0700
@@ -28,7 +28,7 @@
 if (BUILD_CLOSED) {
     fetchExternalTools('IOS', 
       ["ios-libs-08.tgz"], 
-      rootProject.CROSS_TOOLS_DIR, rootProject.IMPORT_CROSS_TOOLS)
+      rootProject.CROSS_TOOLS_DIR, rootProject.IS_IMPORT_CROSS_TOOLS)
 }
 
 // TODO Check for presence of iOS tools
@@ -43,11 +43,13 @@
 IOS.compileDesignTime = false;
 
 defineProperty("USE_LIPO", "false")
+IOS.useLipo = Boolean.parseBoolean(USE_LIPO)
+
 defineProperty("GENERATE_SYMBOLS", "false")
+IOS.generateSymbols = Boolean.parseBoolean(GENERATE_SYMBOLS)
+
 defineProperty("BUILD_IOS_TOOLS", "true")
-if (USE_LIPO instanceof String) IOS.useLipo = Boolean.parseBoolean(USE_LIPO)
-if (GENERATE_SYMBOLS instanceof String) IOS.generateSymbols = Boolean.parseBoolean(GENERATE_SYMBOLS)
-if (BUILD_IOS_TOOLS instanceof String) ext.BUILD_IOS_TOOLS = Boolean.parseBoolean(BUILD_IOS_TOOLS)
+ext.IS_BUILD_IOS_TOOLS = Boolean.parseBoolean(BUILD_IOS_TOOLS)
 
 IOS.generateSymbolsExcludes = [
     "libprism_sw.a",
--- a/buildSrc/linux.gradle	Thu Oct 24 15:12:21 2013 -0700
+++ b/buildSrc/linux.gradle	Thu Oct 24 15:51:51 2013 -0700
@@ -128,9 +128,9 @@
     }
 )
 
-def compiler = COMPILE_PARFAIT ? "parfait-gcc" : "gcc";
-def cc_compiler = COMPILE_PARFAIT ? "parfait-cc" : "cc";
-def linker = COMPILE_PARFAIT ? "parfait-g++" : "g++";
+def compiler = IS_COMPILE_PARFAIT ? "parfait-gcc" : "gcc";
+def cc_compiler = IS_COMPILE_PARFAIT ? "parfait-cc" : "cc";
+def linker = IS_COMPILE_PARFAIT ? "parfait-g++" : "g++";
 
 LINUX.glass = [:]
 LINUX.glass.javahInclude = [
@@ -238,4 +238,4 @@
 LINUX.media = [:]
 LINUX.media.compiler = compiler
 LINUX.media.linker = linker
-LINUX.media.lib = "ar"
\ No newline at end of file
+LINUX.media.lib = "ar"
--- a/buildSrc/mac.gradle	Thu Oct 24 15:12:21 2013 -0700
+++ b/buildSrc/mac.gradle	Thu Oct 24 15:51:51 2013 -0700
@@ -91,9 +91,9 @@
         commonParams,
         IS_DEBUG_NATIVE ? "-DDEBUG" : ["-O3", "-DNDEBUG"]].flatten()
 
-def compiler = COMPILE_PARFAIT ? "parfait-gcc" : "gcc";
-def cc_compiler = COMPILE_PARFAIT ? "parfait-cc" : "cc";
-def linker = COMPILE_PARFAIT ? "parfait-g++" : "g++";
+def compiler = IS_COMPILE_PARFAIT ? "parfait-gcc" : "gcc";
+def cc_compiler = IS_COMPILE_PARFAIT ? "parfait-cc" : "cc";
+def linker = IS_COMPILE_PARFAIT ? "parfait-g++" : "g++";
 
 MAC.glass = [:]
 MAC.glass.javahInclude = [
--- a/buildSrc/win.gradle	Thu Oct 24 15:12:21 2013 -0700
+++ b/buildSrc/win.gradle	Thu Oct 24 15:51:51 2013 -0700
@@ -103,7 +103,7 @@
         defineProperty("WINDOWS_VS_VER", properties, "70")
         defineProperty("WINDOWS_VS_LIB", properties, "$WINDOWS_VS_VCINSTALLDIR/LIB;" + "$WINDOWS_SDK_DIR/lib;")
         defineProperty("WINDOWS_VS_LIBPATH", properties, "$WINDOWS_VS_VCINSTALLDIR/LIB;")
-        def parfaitPath = COMPILE_PARFAIT ? System.getenv().get("PARFAIT_PATH") + ";" : "";
+        def parfaitPath = IS_COMPILE_PARFAIT ? System.getenv().get("PARFAIT_PATH") + ";" : "";
         defineProperty("WINDOWS_VS_PATH", properties, parfaitPath + "$WINDOWS_VS_DEVENVDIR;" +
                 "$WINDOWS_VS_VSINSTALLDIR/VC/BIN;" +
                 "$WINDOWS_VS_VSINSTALLDIR/Common7/Tools;" +
@@ -129,8 +129,8 @@
 String msvcBinDir = (IS_64
                   ? "$WINDOWS_VS_VSINSTALLDIR/VC/BIN/amd64"
                   : "$WINDOWS_VS_VSINSTALLDIR/VC/BIN")
-def compiler = COMPILE_PARFAIT ? "cl.exe" : cygpath("$msvcBinDir/cl.exe")
-def linker = COMPILE_PARFAIT ? "link.exe" : cygpath("$msvcBinDir/link.exe")
+def compiler = IS_COMPILE_PARFAIT ? "cl.exe" : cygpath("$msvcBinDir/cl.exe")
+def linker = IS_COMPILE_PARFAIT ? "link.exe" : cygpath("$msvcBinDir/link.exe")
 ext.RC = cygpath("$WINDOWS_SDK_DIR/Bin/RC.Exe")
 def resourcesCompiler = cygpath("$WINDOWS_SDK_DIR/Bin/RC.Exe")
 ext.FXC = cygpath("$WINDOWS_DXSDK_DIR/utilities/bin/x86/fxc.exe")