## ./build.gradle

Print this page

    rev 4839 : RT-2529: Locale specific runtime errors (Turkish)

     142  */
     143 class CompileTarget {
     144     String name;
     145     String upper;
     146     String capital;
     147 }
     148
     149 /**
     150  * Iterates over each of the compile targets, passing the given closure
     151  * a CompileTarget instance.
     152  *
     153  * @param c The closure to call
     154  */
     155 void compileTargets(Closure c) {
     156     if (COMPILE_TARGETS == "") {
     157         return
     158     }
     159     COMPILE_TARGETS.split(",").each { target ->
     160         CompileTarget ct = new CompileTarget();
     161         ct.name = target;
     162         ct.upper = target.trim().toUpperCase()
     163         ct.capital = target.trim().capitalize()
     164         c(ct)
     165     }
     166 }
     167
     168 /**
     169  * Manages the execution of some closure which is responsible for producing
     170  * content for a properties file built at build time and stored in the
     171  * root project's $buildDir, and then loading that properties file and
     172  * passing it to the processor closure.
     173  *
     174  * This is used on windows to produce a properties file containing all the
     175  * windows visual studio paths and environment variables, and on Linux
     176  * for storing the results of pkg-config calls.
     177  *
     178  * @param name the name of the file to produce
     179  * @param loader a closure which is invoked, given the properties file. This
     180  *        closure is invoked only if the properties file needs to be created
     181  *        and is responsible for populating the properties file.
     182  * @param processor a closure which is invoked every time this method is
     486         if (errors.size > 0) {
     487             throw new GradleException("Error: missing tool packages: $errors")
     488         } else {
     489             logger.quiet "all tool packages are present $packages"
     490         }
     491     }
     492 }
     493
     494 // Now we need to define the native compilation tasks. The set of parameters to
     495 // native compilation depends on the target platform (and also to some extent what platform
     496 // you are compiling on). These settings are contained in various gradle files
     497 // such as mac.gradle and linux.gradle and armhf.gradle. Additionally, the developer
     498 // can specify COMPILE_FLAGS_FILE to be a URL or path to a different gradle file
     499 // that will contain the appropriate flags.
     500 defineProperty("COMPILE_FLAGS_FILES", COMPILE_TARGETS.split(",").collect {"buildSrc/${it.trim()}.gradle"}.join(","))
     501 if (COMPILE_TARGETS == "all") {
     502     def tmp = []
     503     File buildSrcDir = file("buildSrc")
     504     buildSrcDir.listFiles().each { File f ->
     505         if (f.isFile() && f.name.endsWith(".gradle") && !f.name.equals("build.gradle")) {
     506             def target = f.name.substring(0, f.name.lastIndexOf('.gradle')).toUpperCase()
     507             apply from: f
     508             if (project.ext["${target}"].canBuild) {
     509                 tmp.add(target)
     510             }
     511         }
     512     }
     513     COMPILE_FLAGS_FILES = tmp.collect { "buildSrc/${it}.gradle"}.join(",")
     514     COMPILE_TARGETS = tmp.collect { "${it.toLowerCase()}"}.join(",")
     515 } else {
     516     COMPILE_FLAGS_FILES.split(",").each {
     517         logger.info("Applying COMPILE_FLAGS_FILE '$it'")
     518         apply from: it
     519     }
     520 }
     521
     522 if (COMPILE_TARGETS != "") {
     523     def tmp = []
     524     COMPILE_TARGETS.split(",").each {target ->
     525         if (project.ext["${target.toUpperCase()}"].canBuild) {
     526             tmp.add(target)
     527         }
     528     }
     529     COMPILE_TARGETS = tmp.collect { "${it.toLowerCase()}"}.join(",")
     530 }
     531
     532 // Sanity check the expected properties all exist
     533 compileTargets { t ->
     534     // Every platform must define these variables
     535     if (!project.hasProperty(t.upper)) throw new Exception("ERROR: Incorrectly configured compile flags file, missing ${t.name} property")
     536     def props = project.ext[t.upper];
     537     ["jfxrtJarExcludes", "compileSwing", "compileSWT", "compileFXPackager", "compileDesignTime", "libDest"].each { prop ->
     538         if (!props.containsKey(prop)) throw new Exception("ERROR: Incorrectly configured compile flags file, missing ${prop} property on ${t.name}")
     539     }
     540 }
     541
     542 // Various build flags may be set by the different target files, such as
     543 // whether to build Swing, SWT, FXPackager, etc. We iterate over all
     544 // compile targets and look for these settings in our properties. Note that
     545 // these properties cannot be set from the command line, but are set by
     142  */
     143 class CompileTarget {
     144     String name;
     145     String upper;
     146     String capital;
     147 }
     148
     149 /**
     150  * Iterates over each of the compile targets, passing the given closure
     151  * a CompileTarget instance.
     152  *
     153  * @param c The closure to call
     154  */
     155 void compileTargets(Closure c) {
     156     if (COMPILE_TARGETS == "") {
     157         return
     158     }
     159     COMPILE_TARGETS.split(",").each { target ->
     160         CompileTarget ct = new CompileTarget();
     161         ct.name = target;
     162         ct.upper = target.trim().toUpperCase(Locale.ROOT)
     163         ct.capital = target.trim().capitalize()
     164         c(ct)
     165     }
     166 }
     167
     168 /**
     169  * Manages the execution of some closure which is responsible for producing
     170  * content for a properties file built at build time and stored in the
     171  * root project's $buildDir, and then loading that properties file and
     172  * passing it to the processor closure.
     173  *
     174  * This is used on windows to produce a properties file containing all the
     175  * windows visual studio paths and environment variables, and on Linux
     176  * for storing the results of pkg-config calls.
     177  *
     178  * @param name the name of the file to produce
     179  * @param loader a closure which is invoked, given the properties file. This
     180  *        closure is invoked only if the properties file needs to be created
     181  *        and is responsible for populating the properties file.
     182  * @param processor a closure which is invoked every time this method is
     486         if (errors.size > 0) {
     487             throw new GradleException("Error: missing tool packages: $errors")
     488         } else {
     489             logger.quiet "all tool packages are present $packages"
     490         }
     491     }
     492 }
     493
     494 // Now we need to define the native compilation tasks. The set of parameters to
     495 // native compilation depends on the target platform (and also to some extent what platform
     496 // you are compiling on). These settings are contained in various gradle files
     497 // such as mac.gradle and linux.gradle and armhf.gradle. Additionally, the developer
     498 // can specify COMPILE_FLAGS_FILE to be a URL or path to a different gradle file
     499 // that will contain the appropriate flags.
     500 defineProperty("COMPILE_FLAGS_FILES", COMPILE_TARGETS.split(",").collect {"buildSrc/${it.trim()}.gradle"}.join(","))
     501 if (COMPILE_TARGETS == "all") {
     502     def tmp = []
     503     File buildSrcDir = file("buildSrc")
     504     buildSrcDir.listFiles().each { File f ->
     505         if (f.isFile() && f.name.endsWith(".gradle") && !f.name.equals("build.gradle")) {
     506             def target = f.name.substring(0, f.name.lastIndexOf('.gradle')).toUpperCase(Locale.ROOT)
     507             apply from: f
     508             if (project.ext["${target}"].canBuild) {
     509                 tmp.add(target)
     510             }
     511         }
     512     }
     513     COMPILE_FLAGS_FILES = tmp.collect { "buildSrc/${it}.gradle"}.join(",")
     514     COMPILE_TARGETS = tmp.collect { "${it.toLowerCase()}"}.join(",")
     515 } else {
     516     COMPILE_FLAGS_FILES.split(",").each {
     517         logger.info("Applying COMPILE_FLAGS_FILE '$it'")
     518         apply from: it
     519     }
     520 }
     521
     522 if (COMPILE_TARGETS != "") {
     523     def tmp = []
     524     COMPILE_TARGETS.split(",").each {target ->
     525         if (project.ext["${target.toUpperCase(Locale.ROOT)}"].canBuild) {
     526             tmp.add(target)
     527         }
     528     }
     529     COMPILE_TARGETS = tmp.collect { "${it.toLowerCase()}"}.join(",")
     530 }
     531
     532 // Sanity check the expected properties all exist
     533 compileTargets { t ->
     534     // Every platform must define these variables
     535     if (!project.hasProperty(t.upper)) throw new Exception("ERROR: Incorrectly configured compile flags file, missing ${t.name} property")
     536     def props = project.ext[t.upper];
     537     ["jfxrtJarExcludes", "compileSwing", "compileSWT", "compileFXPackager", "compileDesignTime", "libDest"].each { prop ->
     538         if (!props.containsKey(prop)) throw new Exception("ERROR: Incorrectly configured compile flags file, missing ${prop} property on ${t.name}")
     539     }
     540 }
     541
     542 // Various build flags may be set by the different target files, such as
     543 // whether to build Swing, SWT, FXPackager, etc. We iterate over all
     544 // compile targets and look for these settings in our properties. Note that
     545 // these properties cannot be set from the command line, but are set by