< prev index next >

./build.gradle

Print this page
rev 10863 : 8199071: Fix gradle deprecation warnings
Reviewed-by:


 796     }
 797 
 798     return pma
 799 }
 800 
 801 // Return a list containing the --upgrade-module-path
 802 // used with Javac
 803 List<String> computeModulePathArgs(String  pname, List<String> deps, boolean test) {
 804      List<String> mpa = [ '--upgrade-module-path' ]
 805      String mp = null
 806      deps.each {String projname ->
 807          def proj = project(projname)
 808          // for a non test set of args, we don't want the current module in the list
 809          // for a test test, we do need it to update what we built
 810 
 811          if (proj.hasProperty("moduleName") &&
 812                  proj.buildModule &&
 813                      !(!test && proj.name.equals(pname))) {
 814                  File dir;
 815                  if (test && proj.sourceSets.hasProperty('shims')) {
 816                     dir = new File(proj.sourceSets.shims.output.classesDir, proj.ext.moduleName);
 817                  } else {
 818                     dir = new File(proj.sourceSets.main.output.classesDir, proj.ext.moduleName);
 819                  }
 820                  if (mp == null) {
 821                      mp = dir.path
 822                  } else {
 823                      mp = mp + File.pathSeparator + dir.path
 824                  }
 825              }
 826          }
 827 
 828          // in some cases like base we could end up with an empty
 829          // path... make sure we don't pass one back
 830          if (mp == null) {
 831              return null
 832          }
 833 
 834          mpa += mp
 835          return mpa
 836 }
 837 
 838 


 846         dest <<  "-Djava.library.path=\"\\\n"
 847         libpath.each() { e->
 848             dest << "  "
 849             dest << e
 850             dest << File.pathSeparator
 851             dest << "\\\n"
 852         }
 853         dest <<  "  \"\n"
 854     }
 855 
 856     modpath.each { e ->
 857         dest <<  "--patch-module=\""
 858         dest << e
 859         dest << "\"\n"
 860     }
 861 }
 862 
 863 // perform common project manipulation for modules
 864 void commonModuleSetup(Project p, List<String> moduleChain) {
 865 
 866     // Allow the build to use either gradle 3.x or gradle 4.x
 867     p.sourceSets.main.output.classesDir = new File(p.buildDir, "classes/main")
 868     p.ext.moduleChain = moduleChain
 869 
 870     if (p.hasProperty("moduleName")) {
 871         p.ext.moduleDir = new File (p.sourceSets.main.output.classesDir, "${p.moduleName}")
 872         if (p.sourceSets.hasProperty('shims')) {
 873             p.ext.moduleShimsDir = new File (p.sourceSets.shims.output.classesDir, "${p.moduleName}")
 874         }
 875     }
 876 
 877     def mpa = computeModulePathArgs(p.name, moduleChain, false)
 878     if (mpa != null) {
 879         p.ext.modulePathArgs = mpa
 880     }
 881 
 882     p.ext.testModulePathArgs = computePatchModuleArgs(moduleChain, true, false)
 883     p.ext.patchModuleArgs = computePatchModuleArgs(moduleChain ,false, true)
 884     p.ext.testPatchModuleArgs = computePatchModuleArgs(moduleChain, true, true)
 885 
 886     moduleChain.each() {e ->
 887         if (!e.equals(p.name)) {
 888             p.compileJava.dependsOn(project(e).classes)
 889             p.compileTestJava.dependsOn(project(e).testClasses)
 890         }
 891     }
 892 
 893     // read in any addExports file


1286                 }
1287                 linkTask.dependsOn rcTask;
1288             }
1289         }
1290 
1291         def useLipo = targetProperties.containsKey('useLipo') ? targetProperties.useLipo : false
1292         if (useLipo) {
1293             def lipoTask = project.task("lipo${t.capital}$capitalName", type: LipoTask, group: "Build") {
1294                 description = "Creates native fat library for $name for ${t.name}"
1295                 libDir = file("$libRootDir/${t.name}")
1296                 lib = file("$libRootDir/${t.name}/${library(properties.lib)}")
1297             }
1298             nativeTask.dependsOn(lipoTask)
1299         }
1300     }
1301 }
1302 
1303 void addJSL(Project project, String name, String pkg, List<String> addExports, Closure compile) {
1304     def lowerName = name.toLowerCase()
1305 
1306     def modulePath = "${project.sourceSets.main.output.classesDir}"
1307     modulePath += File.pathSeparator + "${rootProject.projectDir}/modules/javafx.base/build/classes/main"
1308     def compileCompilers = project.task("compile${name}Compilers",
1309             type: JavaCompile,
1310             dependsOn: project.compileJava) {
1311         description = "Compile the $name JSL Compilers"
1312 
1313         classpath =
1314                project.files(project.sourceSets.jslc.output.classesDir) +
1315                project.configurations.antlr
1316         source = [project.file("src/main/jsl-$lowerName")]
1317         destinationDir = project.file("$project.buildDir/classes/jsl-compilers/$lowerName")
1318 
1319         options.compilerArgs.addAll([
1320             "-implicit:none",
1321             "--module-path", modulePath,
1322             "--add-modules=javafx.graphics"
1323             ])
1324         if (addExports != null) {
1325             options.compilerArgs.addAll(addExports)
1326         }
1327     }
1328 
1329     def generateShaders = project.task("generate${name}Shaders",
1330             dependsOn: compileCompilers) {
1331         description = "Generate $name shaders from JSL"
1332         def sourceDir = project.file("src/main/jsl-$lowerName")
1333         def destinationDir = project.file("$project.buildDir/gensrc/jsl-$lowerName")
1334         inputs.dir sourceDir


1771         outputs.dir file("$buildDir/gensrc/antlr")
1772     }
1773     sourceSets.jslc.java.srcDirs += "$buildDir/gensrc/antlr"
1774 
1775     // and compile the JSLC support classes
1776     compileJslcJava.dependsOn(generateGrammarSource)
1777     compileJslcJava.classpath = project.configurations.antlr
1778 
1779     compileJava.dependsOn(compileJslcJava)
1780 
1781     // this task is the "second pass" compile of all of the module classes
1782     project.task("compileFullJava", type: JavaCompile, dependsOn: processShaders) {
1783         description = "Compile all of the graphics java classes - main and shaders"
1784 
1785         classpath = configurations.compile
1786 
1787         source = project.sourceSets.main.java.srcDirs
1788         source += "$buildDir/gensrc/java"
1789         source += project.sourceSets.shaders.output
1790 
1791         destinationDir = project.sourceSets.main.output.classesDir
1792         options.compilerArgs.addAll([
1793             '-h', "$buildDir/gensrc/headers/",  // Note: this creates the native headers
1794             '-implicit:none',
1795             '--module-source-path', defaultModuleSourcePath
1796             ] )
1797         options.compilerArgs.addAll(qualExportsCore)
1798     }
1799     classes.dependsOn(compileFullJava)
1800 
1801     project.sourceSets.shims.java.srcDirs += project.sourceSets.shaders.output
1802     project.sourceSets.shims.java.srcDirs += "$buildDir/gensrc/jsl-prism"
1803     project.sourceSets.shims.java.srcDirs += "$buildDir/gensrc/jsl-decora"
1804 
1805     compileShimsJava.dependsOn(compileFullJava)
1806 
1807     // Create a single "native" task which will depend on all the individual native tasks for graphics
1808     project.ext.nativeAllTask = task("native", group: "Build", description: "Compiles and Builds all native libraries for Graphics");
1809     project.ext.cleanNativeAllTask = task("cleanNative", group: "Build", description: "Clean all native libraries and objects for Graphics");
1810 
1811     // Add tasks for native compilation


1916         }
1917 
1918         ccWinPrismD3D.dependsOn generateD3DHeaders
1919     }
1920 
1921     // The Decora and Prism JSL files have to be generated in a very specific set of steps.
1922     //      1) Compile the *Compile.java classes. These live in src/main/jsl-* and will be
1923     //         output to $buildDir/classes/jsl-compilers/* (where * == decora or prism).
1924     //      2) Generate source files from the JSL files contained in src/main/jsl-*. These
1925     //         will be output to $buildDir/gensrc/jsl-*
1926     //      3) Compile the JSL Java sources in $buildDir/gensrc/jsl-* and put the output
1927     //         into classes/jsl-*
1928     //      4) Compile the native JSL sources in $buildDir/gensrc/jsl-* and put the obj
1929     //         files into native/jsl-* and the resulting library into libs/jsl-*.dll|so|dylib
1930     //      5) Modify the jar step to include classes/jsl-*
1931     // The native library must be copied over during SDK creation time in the "sdk" task. In
1932     // addition to these steps, the clean task is created. Note that I didn't bother to create
1933     // a new task for each of the decora files, preferring instead just to create a rule?? Also
1934     // need "clean" tasks for each compile task.
1935 
1936     def modulePath = "${project.sourceSets.main.output.classesDir}"
1937     modulePath += File.pathSeparator + "${rootProject.projectDir}/modules/javafx.base/build/classes/main"
1938     addJSL(project, "Decora", "com/sun/scenario/effect/impl/hw/d3d/hlsl", decoraAddExports) { sourceDir, destinationDir ->
1939         [[fileName: "ColorAdjust", generator: "CompileJSL", outputs: "-all"],
1940          [fileName: "Brightpass", generator: "CompileJSL", outputs: "-all"],
1941          [fileName: "SepiaTone", generator: "CompileJSL", outputs: "-all"],
1942          [fileName: "PerspectiveTransform", generator: "CompileJSL", outputs: "-all"],
1943          [fileName: "DisplacementMap", generator: "CompileJSL", outputs: "-all"],
1944          [fileName: "InvertMask", generator: "CompileJSL", outputs: "-all"],
1945          [fileName: "Blend", generator: "CompileBlend", outputs: "-all"],
1946          [fileName: "PhongLighting", generator: "CompilePhong", outputs: "-all"],
1947          [fileName: "LinearConvolve", generator: "CompileLinearConvolve", outputs: "-hw"],
1948          [fileName: "LinearConvolveShadow", generator: "CompileLinearConvolve", outputs: "-hw"]].each { settings ->
1949             javaexec {
1950                 executable = JAVA
1951                 workingDir = project.projectDir
1952                 main = settings.generator
1953                 classpath = configurations.compile + configurations.antlr
1954                 classpath += files(project.sourceSets.jslc.output.classesDir)
1955 
1956                 classpath += files("${project.projectDir}/src/jslc/resources")
1957 
1958                 classpath += files("$buildDir/classes/jsl-compilers/decora")
1959                 jvmArgs += "--module-path=$modulePath"
1960                 jvmArgs += "--add-modules=javafx.graphics"
1961                 jvmArgs += decoraAddExports
1962                 args += ["-i", sourceDir, "-o", destinationDir, "-t", "-pkg", "com/sun/scenario/effect", "$settings.outputs", "$settings.fileName"]
1963             }
1964         }
1965     }
1966 
1967 
1968     task nativeDecora(dependsOn: compileDecoraHLSLShaders, group: "Build") {
1969         description = "Generates JNI headers, compiles, and builds native dynamic library for Decora"
1970     }
1971     task cleanNativeDecora(type: Delete, group: "Build") {
1972         description = "Clean native objects for Decora"
1973     }
1974 


2023                     }
2024                     output(ccOutput)
2025                 }
2026                 linkTask.dependsOn rcTask;
2027             }
2028 
2029             nativeDecora.dependsOn(linkTask)
2030         }
2031     }
2032 
2033     // Prism JSL
2034     addJSL(project, "Prism", "com/sun/prism/d3d/hlsl", null) { sourceDir, destinationDir ->
2035         def inputFiles = fileTree(dir: sourceDir)
2036         inputFiles.include "**/*.jsl"
2037         inputFiles.each { file ->
2038             javaexec {
2039                 executable = JAVA
2040                 workingDir = project.projectDir
2041                 main = "CompileJSL"
2042                 classpath = configurations.compile + configurations.antlr
2043                 classpath += files(project.sourceSets.jslc.output.classesDir)
2044                 classpath += files(project.sourceSets.jslc.resources)
2045                 classpath += files("$buildDir/classes/jsl-compilers/prism",
2046                     project.projectDir.path + "/src/main/jsl-prism") // for the .stg
2047                 args = ["-i", sourceDir, "-o", destinationDir, "-t", "-pkg", "com/sun/prism", "-d3d", "-es2", "-name", "$file"]
2048             }
2049         }
2050     }
2051 
2052     nativePrism.dependsOn compilePrismHLSLShaders;
2053 
2054     project.nativeAllTask.dependsOn nativeDecora
2055     project.cleanNativeAllTask.dependsOn cleanNativeDecora
2056     assemble.dependsOn nativeDecora
2057     processResources.dependsOn processDecoraShaders, processPrismShaders
2058 
2059     test {
2060         def cssDir = file("$buildDir/classes/main/javafx")
2061         jvmArgs "-Djavafx.toolkit=test.com.sun.javafx.pgstub.StubToolkit",
2062             "-DCSS_META_DATA_TEST_DIR=$cssDir"
2063         enableAssertions = true
2064         testLogging.exceptionFormat = "full"
2065         scanForTestClasses = false
2066         include "**/*Test.*"
2067         if (BUILD_CLOSED && DO_JCOV) {
2068             addJCov(project, test)
2069         }
2070     }
2071 
2072     // To enable the IDEs to all be happy (no red squiggles) we need to have the libraries
2073     // available in some known location. Maybe in the future the Gradle plugins to each
2074     // of the IDEs will be good enough that we won't need this hack anymore.
2075     classes << {

2076         // Copy all of the download libraries to the libs directory for the sake of the IDEs
2077         File libsDir = rootProject.file("build/libs");
2078 
2079         // In some IDEs (Eclipse for example), touching these libraries
2080         // cauese a full build within the IDE. When gradle is used
2081         // outside of the IDE, for example to build the native code,
2082         // a full rebuild is caused within the IDE. The fix is to check
2083         // for the presence of the target files in the lib directory
2084         // and not copy the files if all are present.
2085 
2086         libsDir.mkdirs();
2087 
2088         def allLibsPresent = true
2089         def libNames = [ "antlr-complete-3.5.2.jar" ]
2090         libNames.each { name ->
2091             File f = new File(libsDir, name)
2092             if (!f.exists()) allLibsPresent = false
2093         }
2094         if (allLibsPresent) return;
2095 
2096         for (File f : [configurations.compile.files, configurations.antlr.files].flatten()) {
2097             copy {
2098                 into libsDir
2099                 from f.getParentFile()
2100                 include "**/antlr-complete-3.5.2.jar"
2101                 includeEmptyDirs = false
2102             }
2103         }
2104     }

2105 
2106     compileJava.options.compilerArgs.addAll(qualExportsCore)
2107 }
2108 
2109 project(":controls") {
2110     project.ext.buildModule = true
2111     project.ext.includeSources = true
2112     project.ext.moduleRuntime = true
2113     project.ext.moduleName = "javafx.controls"
2114 
2115     sourceSets {
2116         main
2117         shims
2118         test
2119     }
2120 
2121     project.ext.moduleSourcePath = defaultModuleSourcePath
2122     project.ext.moduleSourcePathShim = defaultModuleSourcePathShim
2123 
2124     commonModuleSetup(project, [ 'base', 'graphics', 'controls' ])
2125 
2126     dependencies {
2127         testCompile project(":graphics").sourceSets.test.output
2128         testCompile project(":base").sourceSets.test.output
2129     }
2130 
2131     test {
2132         def cssDir = file("$buildDir/classes/main/javafx")
2133         jvmArgs "-Djavafx.toolkit=test.com.sun.javafx.pgstub.StubToolkit",
2134             "-DCSS_META_DATA_TEST_DIR=$cssDir"
2135     }
2136 
2137     List<String> css2BinAddExports = [
2138             '--add-exports=java.base/sun.util.logging=javafx.graphics',
2139             ]
2140     def modulePath = "${project.sourceSets.main.output.classesDir}"
2141     modulePath += File.pathSeparator + "${rootProject.projectDir}/modules/javafx.graphics/build/classes/main"
2142     modulePath += File.pathSeparator + "${rootProject.projectDir}/modules/javafx.base/build/classes/main"
2143     processResources << {

2144         def cssFiles = fileTree(dir: "$moduleDir/com/sun/javafx/scene/control/skin")
2145         cssFiles.include "**/*.css"
2146         cssFiles.each { css ->
2147             logger.info("converting CSS to BSS ${css}");
2148 
2149             javaexec {
2150                 executable = JAVA
2151                 workingDir = project.projectDir
2152                 jvmArgs += patchModuleArgs
2153                 jvmArgs += "--module-path=$modulePath"
2154                 jvmArgs += "--add-modules=javafx.graphics"
2155                 jvmArgs += css2BinAddExports
2156                 main = "com.sun.javafx.css.parser.Css2Bin"
2157                 args css
2158             }
2159         }
2160     }

2161 
2162     processShimsResources.dependsOn(project.task("copyShimBss", type: Copy) {
2163         from project.moduleDir
2164         into project.moduleShimsDir
2165         include "**/*.bss"
2166     })
2167 
2168     compileJava.options.compilerArgs.addAll(qualExportsCore)
2169 }
2170 
2171 project(":swing") {
2172     /* should not be built, but needed in JMX
2173     tasks.all {
2174         if (!COMPILE_SWING) it.enabled = false
2175     }
2176     */
2177     project.ext.buildModule = COMPILE_SWING
2178     project.ext.includeSources = true
2179     project.ext.moduleRuntime = true
2180     project.ext.moduleName = "javafx.swing"


2198     }
2199 
2200     compileJava.options.compilerArgs.addAll(qualExportsCore)
2201     compileJava.options.compilerArgs.addAll(qualExportsSwing)
2202 }
2203 
2204 project(":swt") {
2205     tasks.all {
2206         if (!COMPILE_SWT) it.enabled = false
2207     }
2208 
2209     // javafx.swt is an automatic module
2210     project.ext.buildModule = false
2211 
2212     commonModuleSetup(project, [ 'base', 'graphics' ])
2213 
2214     dependencies {
2215         compile name: SWT_FILE_NAME
2216     }
2217 
2218     classes << {

2219         // Copy all of the download libraries to libs directory for the sake of the IDEs
2220         File libsDir = rootProject.file("build/libs");
2221         File swtLib = new File(libsDir, "swt-debug.jar")
2222         libsDir.mkdirs();
2223 
2224         // Skip copy if file is present.
2225         if (swtLib.exists()) return;
2226 
2227         for (File f : configurations.compile.files) {
2228             // Have to rename the swt jar because it is some platform specific name but
2229             // for the sake of the IDEs we need to have a single stable name that works
2230             // on every platform
2231             copy {
2232                 into libsDir
2233                 from f.getParentFile()
2234                 include "**/*swt*.jar"
2235                 includeEmptyDirs = false
2236                 rename ".*swt.*jar", "swt-debug\\.jar"
2237             }
2238         }
2239     }

2240 
2241     compileJava.options.compilerArgs.addAll([
2242             "--add-exports=javafx.graphics/com.sun.glass.ui=ALL-UNNAMED",
2243             "--add-exports=javafx.graphics/com.sun.javafx.cursor=ALL-UNNAMED",
2244             "--add-exports=javafx.graphics/com.sun.javafx.embed=ALL-UNNAMED",
2245             "--add-exports=javafx.graphics/com.sun.javafx.stage=ALL-UNNAMED",
2246             "--add-exports=javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED",
2247             ])
2248 
2249     test {
2250         //enabled = IS_FULL_TEST && IS_SWT_TEST
2251         enabled = false // FIXME: JIGSAW -- support this with modules
2252         logger.info("JIGSAW Testing disabled for swt")
2253 
2254         if (IS_MAC) {
2255             enabled = false
2256             logger.info("SWT tests are disabled on MAC, because Gradle test runner does not handle -XstartOnFirstThread properly (https://issues.gradle.org/browse/GRADLE-3290).")
2257         }
2258     }
2259 }


2450 
2451         from (sourceSets.main.output.resourcesDir) {
2452             includes = [ "resources/web-files/**" ]
2453         }
2454     }
2455 
2456     assemble.dependsOn(antpluginJar)
2457 
2458     // The "man" task will create a $buildDir/man containing the man
2459     // files for the system being built
2460     task man(type: Copy) {
2461         includeEmptyDirs = false
2462         enabled = (IS_LINUX || IS_MAC) && COMPILE_FXPACKAGER
2463         from "src/main/man"
2464         into "$buildDir/man"
2465         exclude "**/*.html"
2466         if (IS_MAC) exclude "**/ja_JP.UTF-8/**"
2467     }
2468     processResources.dependsOn man
2469 
2470     String buildClassesDir = "${sourceSets.main.output.classesDir}/${moduleName}"
2471 
2472     // Compile the native launchers. These are included in jdk.packager.jmod.
2473     if (IS_WINDOWS && COMPILE_FXPACKAGER) {
2474         task buildWinLauncher(type: CCTask, group: "Build") {
2475             description = "Compiles native sources for the application co-bundle launcher";
2476             matches = "WinLauncher\\.cpp";
2477             params.addAll(WIN.launcher.ccFlags);
2478             output(file("$buildDir/native/WinLauncher"));
2479             source(file("src/main/native/launcher/win"));
2480             compiler = WIN.launcher.compiler
2481             exe = true;
2482             linkerOptions.addAll(WIN.launcher.linkFlags);
2483         }
2484 
2485         task copyWinLauncher(type: Copy, group: "Build", dependsOn: buildWinLauncher) {
2486             from "$buildDir/native/WinLauncher/WinLauncher.exe"
2487             from "$MSVCR"
2488             from "$MSVCP"
2489             into "${buildClassesDir}/com/oracle/tools/packager/windows"
2490         }


2643         task copyJavaPackager(type: Copy, group: "Build", dependsOn: linkJavaPackager) {
2644             from file("$buildDir/native/javapackager/javapackager.exe")
2645             into file("$buildDir/javapackager")
2646         }
2647 
2648         task buildJavaPackager(dependsOn: [copyJavaPackager])
2649     } else {
2650         task buildJavaPackager(type: Copy, group: "Build") {
2651             enabled = COMPILE_FXPACKAGER
2652             from "src/main/native/javapackager/shell"
2653             into "$buildDir/javapackager"
2654             fileMode = 0755
2655         }
2656     }
2657 
2658     if (COMPILE_FXPACKAGER) {
2659         assemble.dependsOn compileLauncher;
2660         assemble.dependsOn buildJavaPackager
2661     }
2662 
2663     classes << {

2664         // Copy all of the download libraries to libs directory for the sake of the IDEs
2665         File libsDir = rootProject.file("build/libs");
2666         File antLib = new File(libsDir, "ant-1.8.2.jar")
2667         libsDir.mkdirs();
2668 
2669         // Skip copy if file is present.
2670         if (antLib.exists()) return;
2671 
2672         for (File f : configurations.compile.files) {
2673             copy {
2674                 into libsDir
2675                 from f.getParentFile()
2676                 include "**/ant-1.8.2.jar"
2677                 includeEmptyDirs = false
2678             }
2679         }
2680     }

2681 
2682     task setupPackagerFakeJar(type: Copy) {
2683         from "$projectDir/src/main/resources/com/oracle/tools/packager/linux/javalogo_white_48.png"
2684         from "$projectDir/src/main/resources/com/oracle/tools/packager/mac/GenericAppHiDPI.icns"
2685         from "$projectDir/src/main/resources/com/oracle/tools/packager/windows/javalogo_white_48.ico"
2686         from "$projectDir/src/test/resources/hello/java-logo2.gif"
2687         from "$projectDir/src/test/resources/hello/small.ico"
2688         from "$projectDir/src/test/resources/hello/test.icns"
2689         from "$projectDir/src/test/resources/hello/LICENSE-RTF.rtf"
2690         from "$projectDir/../../LICENSE"
2691         into project.file("$projectDir/build/tmp/tests/appResources")
2692     }
2693 
2694     task setupPackagerFakeJarLicense(type: Copy) {
2695         from "$projectDir/../../LICENSE"
2696         into project.file("$projectDir/build/tmp/tests/appResources")
2697         rename '(.*)LICENSE', '$1LICENSE2'
2698     }
2699 
2700     task packagerFakeJar(type: Jar, dependsOn: [setupPackagerFakeJar, setupPackagerFakeJarLicense]) {


2764                 '--module-path', JDK_JMODS,
2765                 '-o', "$projectDir/build/dev",
2766                 '-all',
2767                 packagerDevOpts
2768         ].flatten()
2769     }
2770 
2771     task createPackagerServicesModule(type: Jar) {
2772         if (project.hasProperty("DEBUGJDK_HOME")) {
2773             def dir = file("$DEBUGJDK_HOME/newmodules")
2774             dir.mkdirs()
2775 
2776             includeEmptyDirs = false
2777             archiveName = "jdk.packager.services.jar"
2778             destinationDir = dir
2779 
2780             from (project.file("$rootProject.buildDir/modular-sdk/modules/jdk.packager.services")) {
2781                 include "**"
2782             }
2783 
2784             from (project.file("$rootProject.buildDir/../modules/jdk.packager/build/classes/main/jdk.packager.services")) {
2785                 include "module-info.class"
2786             }
2787         }
2788     }
2789 
2790     task createPackagerModule(type: Jar) {
2791         if (project.hasProperty("DEBUGJDK_HOME")) {
2792             def dir = file("$DEBUGJDK_HOME/newmodules")
2793             dir.mkdirs()
2794 
2795             includeEmptyDirs = false
2796             archiveName = "jdk.packager.jar"
2797             destinationDir = dir
2798 
2799             from (project.file("$rootProject.buildDir/modular-sdk/modules/jdk.packager")) {
2800                 include "**"
2801             }
2802 
2803             from (project.file("$rootProject.buildDir/../modules/jdk.packager/build/classes/main/jdk.packager")) {
2804                 include "module-info.class"
2805             }
2806         }
2807     }
2808 
2809     task createRunScript() {
2810         def TEXT = "DEBUG_ARG=\"-J-Xdebug:\"\n" +
2811 "\n" +
2812 "# Argument parsing.\n" +
2813 "ARGS=()\n" +
2814 "for i in \"\$@\"; do\n" +
2815 "    if [[ \"\$i\" == \${DEBUG_ARG}* ]]; then\n" +
2816 "        ADDRESS=\${i:\${#DEBUG_ARG}}\n" +
2817 "        DEBUG=\"-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=\${ADDRESS}\"\n" +
2818 "    else\n" +
2819 "        ARGS+=(\"\$i\")\n" +
2820 "    fi\n" +
2821 "done\n" +
2822 "\n" +
2823 "\${JAVA_HOME}/bin/java.original --upgrade-module-path \${JAVA_HOME}/newmodules \$(IFS=\$\' \'; echo \"\${ARGS[*]}\")\n"


3409                                              "BASE_NAME=avplugin", "VERSION=${version}", "LIBAV_DIR=${libavDir}",
3410                                              "SUFFIX=-ffmpeg", IS_64 ? "ARCH=x64" : "ARCH=x32")
3411                                     }
3412                                 }
3413                             }
3414                         } else {
3415                             // Building fxavcodec plugin (libav plugin)
3416                             exec {
3417                                 commandLine ("make", "${makeJobsFlag}", "-C", "${nativeSrcDir}/gstreamer/projects/linux/avplugin")
3418                                 args("CC=${mediaProperties.compiler}", "LINKER=${mediaProperties.linker}",
3419                                      "OUTPUT_DIR=${nativeOutputDir}", "BUILD_TYPE=${buildType}",
3420                                      "BASE_NAME=avplugin", IS_64 ? "ARCH=x64" : "ARCH=x32")
3421                             }
3422                         }
3423                     }
3424                 }
3425                 buildNative.dependsOn buildAVPlugin
3426             }
3427 
3428             if (t.name == "win") {
3429                 def buildResources = task("buildResources") << {

3430                     def rcOutputDir = "${nativeOutputDir}/${buildType}"
3431                     mkdir rcOutputDir
3432                     exec {
3433                         environment(WINDOWS_NATIVE_COMPILE_ENVIRONMENT)
3434                         commandLine (WIN.media.rcCompiler)
3435                         args(WIN.media.glibRcFlags)
3436                         args("/Fo${rcOutputDir}/${WIN.media.glibRcFile}", WIN.media.rcSource)
3437                     }
3438 
3439                     exec {
3440                         environment(WINDOWS_NATIVE_COMPILE_ENVIRONMENT)
3441                         commandLine (WIN.media.rcCompiler)
3442                         args(WIN.media.gstreamerRcFlags)
3443                         args("/Fo${rcOutputDir}/${WIN.media.gstreamerRcFile}", WIN.media.rcSource)
3444                     }
3445 
3446                     exec {
3447                         environment(WINDOWS_NATIVE_COMPILE_ENVIRONMENT)
3448                         commandLine (WIN.media.rcCompiler)
3449                         args(WIN.media.fxpluginsRcFlags)
3450                         args("/Fo${rcOutputDir}/${WIN.media.fxpluginsRcFile}", WIN.media.rcSource)
3451                     }
3452 
3453                     exec {
3454                         environment(WINDOWS_NATIVE_COMPILE_ENVIRONMENT)
3455                         commandLine (WIN.media.rcCompiler)
3456                         args(WIN.media.jfxmediaRcFlags)
3457                         args("/Fo${rcOutputDir}/${WIN.media.jfxmediaRcFile}", WIN.media.rcSource)
3458                     }
3459                 }

3460 
3461                 def buildGlib = task("build${t.capital}Glib", dependsOn: [buildResources]) {
3462                     enabled = IS_COMPILE_MEDIA
3463                     doLast {
3464                         exec {
3465                             environment(WINDOWS_NATIVE_COMPILE_ENVIRONMENT)
3466                             commandLine ("make", "${makeJobsFlag}", "-C", "${nativeSrcDir}/gstreamer/projects/${projectDir}/glib-lite")
3467                             args("OUTPUT_DIR=${nativeOutputDir}", "BUILD_TYPE=${buildType}", "BASE_NAME=glib-lite",
3468                                  IS_64 ? "ARCH=x64" : "ARCH=x32", "RESOURCE=${nativeOutputDir}/${buildType}/${WIN.media.glibRcFile}",
3469                                  "CC=${mediaProperties.compiler}", "AR=${mediaProperties.ar}", "LINKER=${mediaProperties.linker}")
3470                         }
3471                     }
3472                 }
3473                 buildGStreamer.dependsOn buildGlib
3474 
3475             } else if (t.name == "mac") {
3476                 def buildGlib = task("build${t.capital}Glib") {
3477                     enabled = IS_COMPILE_MEDIA
3478                     doLast {
3479                         exec {


3670             def library = rootProject.ext[t.upper].library
3671             from "$webkitOutputDir/$webkitConfig/lib/${library('jfxwebkit')}"
3672             into "$buildDir/libs/${t.name}"
3673         }
3674 
3675         if (IS_WINDOWS && t.name == "win") {
3676             def webkitProperties = project.rootProject.ext[t.upper].webkit
3677             def rcTask = project.task("rc${t.capital}", type: CompileResourceTask) {
3678                 compiler = webkitProperties.rcCompiler
3679                 source(webkitProperties.rcSource)
3680                 if (webkitProperties.rcFlags) {
3681                     rcParams.addAll(webkitProperties.rcFlags)
3682                 }
3683                 output(file("$webkitOutputDir/$webkitConfig/WebCore/obj"))
3684             }
3685             compileNativeTask.dependsOn rcTask
3686         }
3687 
3688         def compileJavaDOMBindingTask = task("compileJavaDOMBinding${t.capital}", type: JavaCompile,
3689                 dependsOn: [compileJava, compileNativeTask, copyNativeTask]) {
3690             destinationDir = file("$buildDir/classes/main")
3691             classpath = configurations.compile
3692             source = project.sourceSets.main.java.srcDirs
3693             options.compilerArgs.addAll([
3694                 '-implicit:none',
3695                 '--module-source-path', defaultModuleSourcePath
3696                 ])
3697         }
3698 
3699         compileJavaDOMBinding.dependsOn compileJavaDOMBindingTask
3700 
3701         if (!targetProperties.compileWebnodeNative) {
3702             println("Not compiling native Webkit for ${t.name} per configuration request");
3703             compileNativeTask.enabled = false
3704         }
3705     }
3706 
3707     def drtClasses = "**/com/sun/javafx/webkit/drt/**"
3708     task drtJar(type: Jar, dependsOn: compileJava) {
3709         archiveName = "drt.jar"
3710         destinationDir = file("$buildDir/test")
3711         from "$buildDir/classes/main/javafx.web/"
3712         include drtClasses
3713         includeEmptyDirs = false
3714     }
3715 
3716     if (IS_COMPILE_WEBKIT) {
3717         assemble.dependsOn compileJavaDOMBinding, drtJar
3718     }
3719 
3720     compileJava.options.compilerArgs.addAll(qualExportsCore)
3721 }
3722 
3723 // This project is for system tests that need to run with a full SDK.
3724 // Most of them display a stage or do other things that preclude running
3725 // them in a shared JVM or as part of the "smoke test" run (which must
3726 // not pop up any windows or use audio). As such, they are only enabled
3727 // when FULL_TEST is specified, and each test runs in its own JVM
3728 project(":systemTests") {
3729 
3730     sourceSets {
3731         test


3782                 def e = cygpath("${elem}")
3783                 stRunArgsFile <<  "  ${e}${File.pathSeparator}\\\n"
3784             }
3785             stRunArgsFile <<  "\"\n"
3786         }
3787     }
3788 
3789     test.dependsOn(sts)
3790     test.dependsOn(createTestArgfiles);
3791 
3792     // Tasks to create standalone test applications for the launcher tests
3793 
3794     def testapp1JarName = "testapp1.jar"
3795     task createTestapp1Jar1(type: Jar) {
3796         dependsOn compileTestapp1Java
3797         enabled = IS_FULL_TEST
3798 
3799         destinationDir = file("$buildDir/testapp1")
3800         archiveName = testapp1JarName
3801         includeEmptyDirs = false
3802         from project.sourceSets.testapp1.output.classesDir
3803         include("testapp/**")
3804         include("com/javafx/main/**")
3805 
3806         manifest {
3807             attributes(
3808                 "Main-Class" : "com.javafx.main.Main",
3809                 "JavaFX-Version" : "2.2",
3810                 "JavaFX-Application-Class" : "testapp.HelloWorld",
3811                 "JavaFX-Class-Path" : "jar2.jar"
3812             )
3813         }
3814     }
3815 
3816     task createTestapp1Jar2(type: Jar) {
3817         dependsOn compileTestapp1Java
3818         enabled = IS_FULL_TEST
3819 
3820         destinationDir = file("$buildDir/testapp1")
3821         archiveName = "jar2.jar";
3822         includeEmptyDirs = false
3823         from project.sourceSets.testapp1.output.classesDir
3824         include("pkg2/**")
3825     }
3826 
3827     task createTestApps() {
3828         dependsOn(createTestapp1Jar1)
3829         dependsOn(createTestapp1Jar2)
3830     }
3831     test.dependsOn(createTestApps);
3832 
3833     def modtestapps = [ "testapp2", "testapp3", "testapp4", "testapp5", "testapp6"  ]
3834     modtestapps.each { testapp ->
3835         def testappCapital = testapp.capitalize()
3836         def copyTestAppTask = task("copy${testappCapital}", type: Copy) {
3837             from project.sourceSets."${testapp}".output.classesDir
3838             from project.sourceSets."${testapp}".output.resourcesDir
3839             into "${project.buildDir}/modules/${testapp}"
3840         }
3841 
3842         def List<String> testAppSourceDirs = []
3843         project.sourceSets."${testapp}".java.srcDirs.each { dir ->
3844             testAppSourceDirs += dir
3845         }
3846         def testappCompileTasks = project.getTasksByName("compile${testappCapital}Java", true);
3847         def testappResourceTasks = project.getTasksByName("process${testappCapital}Resources", true);
3848         testappCompileTasks.each { appCompileTask ->
3849             appCompileTask.options.compilerArgs.addAll([
3850                 '-implicit:none',
3851                 '--module-source-path', testAppSourceDirs.join(File.pathSeparator)
3852                 ] )
3853 
3854             copyTestAppTask.dependsOn(appCompileTask)
3855         }
3856         testappResourceTasks.each { appResourceTask ->
3857             copyTestAppTask.dependsOn(appResourceTask)


3944         project.processResources.destinationDir = project.moduleDir
3945     }
3946 
3947     if (project.hasProperty('moduleSourcePathShim') &&
3948             project.sourceSets.hasProperty('shims')) {
3949 
3950         // sync up the obvious source directories with the shims
3951         // others (like the shaders in graphics) should be added in there
3952         project.sourceSets.shims.java.srcDirs += project.sourceSets.main.java.srcDirs
3953         project.sourceSets.shims.java.srcDirs += "$buildDir/gensrc/java"
3954 
3955         project.compileShimsJava {
3956             options.compilerArgs.addAll([
3957                 '-implicit:none',
3958                 '--module-source-path', project.moduleSourcePathShim
3959                 ])
3960         }
3961         project.compileShimsJava.dependsOn(project.compileJava)
3962 
3963         def copyGeneratedShimsTask = task("copyGeneratedShims", type: Copy, dependsOn: [compileShimsJava, processShimsResources]) {
3964             from project.sourceSets.shims.output.classesDir
3965             into "${rootProject.buildDir}/shims"
3966             exclude("*/module-info.class")
3967         }
3968 
3969         project.processShimsResources.dependsOn(project.processResources)
3970 
3971         // shims resources should have the main resouces as a base
3972         project.sourceSets.shims.resources.srcDirs += project.sourceSets.main.resources.srcDirs
3973 
3974         // and redirect the resources into the module
3975         project.processShimsResources.destinationDir = project.moduleShimsDir
3976 
3977        compileTestJava.dependsOn(copyGeneratedShimsTask)
3978     }
3979 
3980     if (project.hasProperty('modulePathArgs')) {
3981         project.compileJava.options.compilerArgs.addAll(modulePathArgs)
3982     }
3983 
3984     if (project.hasProperty('testModulePathArgs')) {


4191 subprojects {
4192     if (project.hasProperty("buildModule") && project.ext.buildModule) {
4193         rootProject.ext.moduleProjList += project
4194         println "module: $project (buildModule=YES)"
4195     } else {
4196         println "module: $project (buildModule=NO)"
4197     }
4198 }
4199 
4200 
4201 // Define the sdk task, which also produces the javafx.swt modular jar
4202 
4203 compileTargets { t ->
4204 
4205     def javafxSwtTask = task("javafxSwt$t.capital", type: Jar) {
4206         enabled = COMPILE_SWT
4207         group = "Basic"
4208         description = "Creates the javafx-swt.jar for the $t.name target"
4209         archiveName = "${project(":swt").buildDir}/libs/javafx-swt.jar";
4210         includeEmptyDirs = false
4211         from("${project(":swt").buildDir}/classes/main");
4212         include("**/javafx/embed/swt/**")
4213 
4214         dependsOn(
4215             project(":swt").compileJava,
4216             project(":swt").processResources,
4217             // note: assemble and classes are not enough for DidWork
4218             project(":swt").classes,
4219             // classes is needed for a jar copy
4220             )
4221         onlyIf {
4222             dependsOnTaskDidWork()
4223         }
4224     }
4225 
4226     // FIXME: do we really need the index task for this modular jar?
4227     def javafxSwtIndexTask = task("javafxSwtIndex$t.capital") {
4228         //the following is a workaround for the lack of indexing in gradle 1.4 through 1.7
4229         dependsOn(javafxSwtTask)
4230         onlyIf {
4231             dependsOnTaskDidWork()
4232         }
4233 
4234         doLast() {
4235             ant.jar (update: true, index: true, destfile: javafxSwtTask.archiveName)
4236         }
4237     }
4238 
4239     def sdkTask = task("sdk$t.capital") {
4240         group = "Basic"
4241         dependsOn(javafxSwtIndexTask)
4242     }
4243 
4244     sdk.dependsOn(sdkTask)
4245 }
4246 
4247 project(":apps") {
4248     // The apps build is Ant based, we will exec ant from gradle.
4249 
4250     // Download the Lucene libraries needed for the Ensemble8 app
4251     getConfigurations().create("lucene");
4252     dependencies {


4561             writeRunArgsFile(runArgsFile, computeLibraryPath(true), modpath)
4562             writeRunArgsFile(compileArgsFile, null, modpath)
4563 
4564             if (rootProject.hasProperty("EXTRA_ADDEXPORTS_STRING")) {
4565                 runArgsFile << EXTRA_ADDEXPORTS_STRING
4566                 compileArgsFile << EXTRA_ADDEXPORTS_STRING
4567             }
4568         }
4569     }
4570     buildModules.dependsOn(buildRunArgsTask)
4571 
4572     def isWindows = IS_WINDOWS && t.name == "win";
4573     def isMac = IS_MAC && t.name == "mac";
4574 
4575     // Create layout for modular classes
4576     moduleProjList.each { project ->
4577         def buildModuleClassesTask = project.task("buildModule$t.capital", group: "Build", type: Copy) {
4578             dependsOn(project.assemble)
4579             def buildDir = project.buildDir
4580             def sourceBuildDirs = [
4581                 "${buildDir}/classes/main/${project.moduleName}",
4582             ]
4583 
4584             def moduleClassesDir = "$buildDir/${platformPrefix}module-classes"
4585                 includeEmptyDirs = false
4586                 sourceBuildDirs.each { d ->
4587                     from d
4588                 }
4589                 into moduleClassesDir
4590 
4591                 // Exclude obsolete, experimental, or non-shipping code
4592                 exclude("version.rc")
4593                 exclude("com/sun/glass/ui/swt")
4594                 exclude("com/sun/javafx/tools/ant")
4595                 exclude("com/javafx/main")
4596                 exclude("com/sun/javafx/webkit/drt")
4597                 if (!IS_INCLUDE_NULL3D) {
4598                     exclude ("com/sun/prism/null3d")
4599                 }
4600                 if (!IS_INCLUDE_ES2) {
4601                        exclude("com/sun/prism/es2",


4649                     exclude ("com/sun/glass/ui/android")
4650                 }
4651 
4652                 // Filter out other platform-specific classes
4653                 if (targetProperties.containsKey('jfxrtJarExcludes')) {
4654                     exclude(targetProperties.jfxrtJarExcludes)
4655                 }
4656 
4657                 /* FIXME: JIGSAW -- handle this in the module itself
4658                 String webbld = project(":web").buildDir.path
4659                 String ctrlbld = project(":controls").buildDir.path
4660                 if (t.name == 'android') {
4661                     from ("${webbld}/classes/android",
4662                           "${webbld}/resources/android",
4663                           "${ctrlbld}/classes/android",
4664                           "${ctrlbld}/resources/android")
4665                 } else if (t.name == 'ios') {
4666                     from ("${webbld}/classes/ios",
4667                           "${webbld}/resources/ios")
4668                 } else {
4669                     from ("${webbld}/classes/main",
4670                           "${webbld}resources/main")
4671                 }
4672                 */
4673         }
4674         buildModulesTask.dependsOn(buildModuleClassesTask)
4675     }
4676 
4677     def buildModuleLibsTask = task("buildModuleLibs$t.capital") {
4678         group = "Basic"
4679 
4680         def baseProject = project(":base");
4681 
4682         def graphicsProject = project(":graphics");
4683 
4684         def mediaProject = project(":media");
4685 
4686         def webProject = project(":web");
4687         dependsOn(webProject.assemble)
4688 
4689         def swtProject = project(":swt");
4690 




 796     }
 797 
 798     return pma
 799 }
 800 
 801 // Return a list containing the --upgrade-module-path
 802 // used with Javac
 803 List<String> computeModulePathArgs(String  pname, List<String> deps, boolean test) {
 804      List<String> mpa = [ '--upgrade-module-path' ]
 805      String mp = null
 806      deps.each {String projname ->
 807          def proj = project(projname)
 808          // for a non test set of args, we don't want the current module in the list
 809          // for a test test, we do need it to update what we built
 810 
 811          if (proj.hasProperty("moduleName") &&
 812                  proj.buildModule &&
 813                      !(!test && proj.name.equals(pname))) {
 814                  File dir;
 815                  if (test && proj.sourceSets.hasProperty('shims')) {
 816                     dir = new File(proj.sourceSets.shims.java.outputDir, proj.ext.moduleName);
 817                  } else {
 818                     dir = new File(proj.sourceSets.main.java.outputDir, proj.ext.moduleName);
 819                  }
 820                  if (mp == null) {
 821                      mp = dir.path
 822                  } else {
 823                      mp = mp + File.pathSeparator + dir.path
 824                  }
 825              }
 826          }
 827 
 828          // in some cases like base we could end up with an empty
 829          // path... make sure we don't pass one back
 830          if (mp == null) {
 831              return null
 832          }
 833 
 834          mpa += mp
 835          return mpa
 836 }
 837 
 838 


 846         dest <<  "-Djava.library.path=\"\\\n"
 847         libpath.each() { e->
 848             dest << "  "
 849             dest << e
 850             dest << File.pathSeparator
 851             dest << "\\\n"
 852         }
 853         dest <<  "  \"\n"
 854     }
 855 
 856     modpath.each { e ->
 857         dest <<  "--patch-module=\""
 858         dest << e
 859         dest << "\"\n"
 860     }
 861 }
 862 
 863 // perform common project manipulation for modules
 864 void commonModuleSetup(Project p, List<String> moduleChain) {
 865 


 866     p.ext.moduleChain = moduleChain
 867 
 868     if (p.hasProperty("moduleName")) {
 869         p.ext.moduleDir = new File (p.sourceSets.main.java.outputDir, "${p.moduleName}")
 870         if (p.sourceSets.hasProperty('shims')) {
 871             p.ext.moduleShimsDir = new File (p.sourceSets.shims.java.outputDir, "${p.moduleName}")
 872         }
 873     }
 874 
 875     def mpa = computeModulePathArgs(p.name, moduleChain, false)
 876     if (mpa != null) {
 877         p.ext.modulePathArgs = mpa
 878     }
 879 
 880     p.ext.testModulePathArgs = computePatchModuleArgs(moduleChain, true, false)
 881     p.ext.patchModuleArgs = computePatchModuleArgs(moduleChain ,false, true)
 882     p.ext.testPatchModuleArgs = computePatchModuleArgs(moduleChain, true, true)
 883 
 884     moduleChain.each() {e ->
 885         if (!e.equals(p.name)) {
 886             p.compileJava.dependsOn(project(e).classes)
 887             p.compileTestJava.dependsOn(project(e).testClasses)
 888         }
 889     }
 890 
 891     // read in any addExports file


1284                 }
1285                 linkTask.dependsOn rcTask;
1286             }
1287         }
1288 
1289         def useLipo = targetProperties.containsKey('useLipo') ? targetProperties.useLipo : false
1290         if (useLipo) {
1291             def lipoTask = project.task("lipo${t.capital}$capitalName", type: LipoTask, group: "Build") {
1292                 description = "Creates native fat library for $name for ${t.name}"
1293                 libDir = file("$libRootDir/${t.name}")
1294                 lib = file("$libRootDir/${t.name}/${library(properties.lib)}")
1295             }
1296             nativeTask.dependsOn(lipoTask)
1297         }
1298     }
1299 }
1300 
1301 void addJSL(Project project, String name, String pkg, List<String> addExports, Closure compile) {
1302     def lowerName = name.toLowerCase()
1303 
1304     def modulePath = "${project.sourceSets.main.java.outputDir}"
1305     modulePath += File.pathSeparator + "${rootProject.projectDir}/modules/javafx.base/build/classes/java/main"
1306     def compileCompilers = project.task("compile${name}Compilers",
1307             type: JavaCompile,
1308             dependsOn: project.compileJava) {
1309         description = "Compile the $name JSL Compilers"
1310 
1311         classpath =
1312                project.files(project.sourceSets.jslc.java.outputDir) +
1313                project.configurations.antlr
1314         source = [project.file("src/main/jsl-$lowerName")]
1315         destinationDir = project.file("$project.buildDir/classes/jsl-compilers/$lowerName")
1316 
1317         options.compilerArgs.addAll([
1318             "-implicit:none",
1319             "--module-path", modulePath,
1320             "--add-modules=javafx.graphics"
1321             ])
1322         if (addExports != null) {
1323             options.compilerArgs.addAll(addExports)
1324         }
1325     }
1326 
1327     def generateShaders = project.task("generate${name}Shaders",
1328             dependsOn: compileCompilers) {
1329         description = "Generate $name shaders from JSL"
1330         def sourceDir = project.file("src/main/jsl-$lowerName")
1331         def destinationDir = project.file("$project.buildDir/gensrc/jsl-$lowerName")
1332         inputs.dir sourceDir


1769         outputs.dir file("$buildDir/gensrc/antlr")
1770     }
1771     sourceSets.jslc.java.srcDirs += "$buildDir/gensrc/antlr"
1772 
1773     // and compile the JSLC support classes
1774     compileJslcJava.dependsOn(generateGrammarSource)
1775     compileJslcJava.classpath = project.configurations.antlr
1776 
1777     compileJava.dependsOn(compileJslcJava)
1778 
1779     // this task is the "second pass" compile of all of the module classes
1780     project.task("compileFullJava", type: JavaCompile, dependsOn: processShaders) {
1781         description = "Compile all of the graphics java classes - main and shaders"
1782 
1783         classpath = configurations.compile
1784 
1785         source = project.sourceSets.main.java.srcDirs
1786         source += "$buildDir/gensrc/java"
1787         source += project.sourceSets.shaders.output
1788 
1789         destinationDir = project.sourceSets.main.java.outputDir
1790         options.compilerArgs.addAll([
1791             '-h', "$buildDir/gensrc/headers/",  // Note: this creates the native headers
1792             '-implicit:none',
1793             '--module-source-path', defaultModuleSourcePath
1794             ] )
1795         options.compilerArgs.addAll(qualExportsCore)
1796     }
1797     classes.dependsOn(compileFullJava)
1798 
1799     project.sourceSets.shims.java.srcDirs += project.sourceSets.shaders.output
1800     project.sourceSets.shims.java.srcDirs += "$buildDir/gensrc/jsl-prism"
1801     project.sourceSets.shims.java.srcDirs += "$buildDir/gensrc/jsl-decora"
1802 
1803     compileShimsJava.dependsOn(compileFullJava)
1804 
1805     // Create a single "native" task which will depend on all the individual native tasks for graphics
1806     project.ext.nativeAllTask = task("native", group: "Build", description: "Compiles and Builds all native libraries for Graphics");
1807     project.ext.cleanNativeAllTask = task("cleanNative", group: "Build", description: "Clean all native libraries and objects for Graphics");
1808 
1809     // Add tasks for native compilation


1914         }
1915 
1916         ccWinPrismD3D.dependsOn generateD3DHeaders
1917     }
1918 
1919     // The Decora and Prism JSL files have to be generated in a very specific set of steps.
1920     //      1) Compile the *Compile.java classes. These live in src/main/jsl-* and will be
1921     //         output to $buildDir/classes/jsl-compilers/* (where * == decora or prism).
1922     //      2) Generate source files from the JSL files contained in src/main/jsl-*. These
1923     //         will be output to $buildDir/gensrc/jsl-*
1924     //      3) Compile the JSL Java sources in $buildDir/gensrc/jsl-* and put the output
1925     //         into classes/jsl-*
1926     //      4) Compile the native JSL sources in $buildDir/gensrc/jsl-* and put the obj
1927     //         files into native/jsl-* and the resulting library into libs/jsl-*.dll|so|dylib
1928     //      5) Modify the jar step to include classes/jsl-*
1929     // The native library must be copied over during SDK creation time in the "sdk" task. In
1930     // addition to these steps, the clean task is created. Note that I didn't bother to create
1931     // a new task for each of the decora files, preferring instead just to create a rule?? Also
1932     // need "clean" tasks for each compile task.
1933 
1934     def modulePath = "${project.sourceSets.main.java.outputDir}"
1935     modulePath += File.pathSeparator + "${rootProject.projectDir}/modules/javafx.base/build/classes/java/main"
1936     addJSL(project, "Decora", "com/sun/scenario/effect/impl/hw/d3d/hlsl", decoraAddExports) { sourceDir, destinationDir ->
1937         [[fileName: "ColorAdjust", generator: "CompileJSL", outputs: "-all"],
1938          [fileName: "Brightpass", generator: "CompileJSL", outputs: "-all"],
1939          [fileName: "SepiaTone", generator: "CompileJSL", outputs: "-all"],
1940          [fileName: "PerspectiveTransform", generator: "CompileJSL", outputs: "-all"],
1941          [fileName: "DisplacementMap", generator: "CompileJSL", outputs: "-all"],
1942          [fileName: "InvertMask", generator: "CompileJSL", outputs: "-all"],
1943          [fileName: "Blend", generator: "CompileBlend", outputs: "-all"],
1944          [fileName: "PhongLighting", generator: "CompilePhong", outputs: "-all"],
1945          [fileName: "LinearConvolve", generator: "CompileLinearConvolve", outputs: "-hw"],
1946          [fileName: "LinearConvolveShadow", generator: "CompileLinearConvolve", outputs: "-hw"]].each { settings ->
1947             javaexec {
1948                 executable = JAVA
1949                 workingDir = project.projectDir
1950                 main = settings.generator
1951                 classpath = configurations.compile + configurations.antlr
1952                 classpath += files(project.sourceSets.jslc.java.outputDir)
1953 
1954                 classpath += files("${project.projectDir}/src/jslc/resources")
1955 
1956                 classpath += files("$buildDir/classes/jsl-compilers/decora")
1957                 jvmArgs += "--module-path=$modulePath"
1958                 jvmArgs += "--add-modules=javafx.graphics"
1959                 jvmArgs += decoraAddExports
1960                 args += ["-i", sourceDir, "-o", destinationDir, "-t", "-pkg", "com/sun/scenario/effect", "$settings.outputs", "$settings.fileName"]
1961             }
1962         }
1963     }
1964 
1965 
1966     task nativeDecora(dependsOn: compileDecoraHLSLShaders, group: "Build") {
1967         description = "Generates JNI headers, compiles, and builds native dynamic library for Decora"
1968     }
1969     task cleanNativeDecora(type: Delete, group: "Build") {
1970         description = "Clean native objects for Decora"
1971     }
1972 


2021                     }
2022                     output(ccOutput)
2023                 }
2024                 linkTask.dependsOn rcTask;
2025             }
2026 
2027             nativeDecora.dependsOn(linkTask)
2028         }
2029     }
2030 
2031     // Prism JSL
2032     addJSL(project, "Prism", "com/sun/prism/d3d/hlsl", null) { sourceDir, destinationDir ->
2033         def inputFiles = fileTree(dir: sourceDir)
2034         inputFiles.include "**/*.jsl"
2035         inputFiles.each { file ->
2036             javaexec {
2037                 executable = JAVA
2038                 workingDir = project.projectDir
2039                 main = "CompileJSL"
2040                 classpath = configurations.compile + configurations.antlr
2041                 classpath += files(project.sourceSets.jslc.java.outputDir)
2042                 classpath += files(project.sourceSets.jslc.resources)
2043                 classpath += files("$buildDir/classes/jsl-compilers/prism",
2044                     project.projectDir.path + "/src/main/jsl-prism") // for the .stg
2045                 args = ["-i", sourceDir, "-o", destinationDir, "-t", "-pkg", "com/sun/prism", "-d3d", "-es2", "-name", "$file"]
2046             }
2047         }
2048     }
2049 
2050     nativePrism.dependsOn compilePrismHLSLShaders;
2051 
2052     project.nativeAllTask.dependsOn nativeDecora
2053     project.cleanNativeAllTask.dependsOn cleanNativeDecora
2054     assemble.dependsOn nativeDecora
2055     processResources.dependsOn processDecoraShaders, processPrismShaders
2056 
2057     test {
2058         def cssDir = file("$buildDir/classes/java/main/${moduleName}/javafx")
2059         jvmArgs "-Djavafx.toolkit=test.com.sun.javafx.pgstub.StubToolkit",
2060             "-DCSS_META_DATA_TEST_DIR=$cssDir"
2061         enableAssertions = true
2062         testLogging.exceptionFormat = "full"
2063         scanForTestClasses = false
2064         include "**/*Test.*"
2065         if (BUILD_CLOSED && DO_JCOV) {
2066             addJCov(project, test)
2067         }
2068     }
2069 
2070     // To enable the IDEs to all be happy (no red squiggles) we need to have the libraries
2071     // available in some known location. Maybe in the future the Gradle plugins to each
2072     // of the IDEs will be good enough that we won't need this hack anymore.
2073     classes {
2074         doLast {
2075             // Copy all of the download libraries to the libs directory for the sake of the IDEs
2076             File libsDir = rootProject.file("build/libs");
2077 
2078             // In some IDEs (Eclipse for example), touching these libraries
2079             // cauese a full build within the IDE. When gradle is used
2080             // outside of the IDE, for example to build the native code,
2081             // a full rebuild is caused within the IDE. The fix is to check
2082             // for the presence of the target files in the lib directory
2083             // and not copy the files if all are present.
2084 
2085             libsDir.mkdirs();
2086 
2087             def allLibsPresent = true
2088             def libNames = [ "antlr-complete-3.5.2.jar" ]
2089             libNames.each { name ->
2090                 File f = new File(libsDir, name)
2091                 if (!f.exists()) allLibsPresent = false
2092             }
2093             if (allLibsPresent) return;
2094 
2095             for (File f : [configurations.compile.files, configurations.antlr.files].flatten()) {
2096                 copy {
2097                     into libsDir
2098                     from f.getParentFile()
2099                     include "**/antlr-complete-3.5.2.jar"
2100                     includeEmptyDirs = false
2101                 }
2102             }
2103         }
2104     }
2105 
2106     compileJava.options.compilerArgs.addAll(qualExportsCore)
2107 }
2108 
2109 project(":controls") {
2110     project.ext.buildModule = true
2111     project.ext.includeSources = true
2112     project.ext.moduleRuntime = true
2113     project.ext.moduleName = "javafx.controls"
2114 
2115     sourceSets {
2116         main
2117         shims
2118         test
2119     }
2120 
2121     project.ext.moduleSourcePath = defaultModuleSourcePath
2122     project.ext.moduleSourcePathShim = defaultModuleSourcePathShim
2123 
2124     commonModuleSetup(project, [ 'base', 'graphics', 'controls' ])
2125 
2126     dependencies {
2127         testCompile project(":graphics").sourceSets.test.output
2128         testCompile project(":base").sourceSets.test.output
2129     }
2130 
2131     test {
2132         def cssDir = file("$buildDir/classes/java/main/${moduleName}/javafx")
2133         jvmArgs "-Djavafx.toolkit=test.com.sun.javafx.pgstub.StubToolkit",
2134             "-DCSS_META_DATA_TEST_DIR=$cssDir"
2135     }
2136 
2137     List<String> css2BinAddExports = [
2138             '--add-exports=java.base/sun.util.logging=javafx.graphics',
2139             ]
2140     def modulePath = "${project.sourceSets.main.java.outputDir}"
2141     modulePath += File.pathSeparator + "${rootProject.projectDir}/modules/javafx.graphics/build/classes/java/main"
2142     modulePath += File.pathSeparator + "${rootProject.projectDir}/modules/javafx.base/build/classes/java/main"
2143     processResources {
2144       doLast {
2145         def cssFiles = fileTree(dir: "$moduleDir/com/sun/javafx/scene/control/skin")
2146         cssFiles.include "**/*.css"
2147         cssFiles.each { css ->
2148             logger.info("converting CSS to BSS ${css}");
2149 
2150             javaexec {
2151                 executable = JAVA
2152                 workingDir = project.projectDir
2153                 jvmArgs += patchModuleArgs
2154                 jvmArgs += "--module-path=$modulePath"
2155                 jvmArgs += "--add-modules=javafx.graphics"
2156                 jvmArgs += css2BinAddExports
2157                 main = "com.sun.javafx.css.parser.Css2Bin"
2158                 args css
2159             }
2160         }
2161       }
2162     }
2163 
2164     processShimsResources.dependsOn(project.task("copyShimBss", type: Copy) {
2165         from project.moduleDir
2166         into project.moduleShimsDir
2167         include "**/*.bss"
2168     })
2169 
2170     compileJava.options.compilerArgs.addAll(qualExportsCore)
2171 }
2172 
2173 project(":swing") {
2174     /* should not be built, but needed in JMX
2175     tasks.all {
2176         if (!COMPILE_SWING) it.enabled = false
2177     }
2178     */
2179     project.ext.buildModule = COMPILE_SWING
2180     project.ext.includeSources = true
2181     project.ext.moduleRuntime = true
2182     project.ext.moduleName = "javafx.swing"


2200     }
2201 
2202     compileJava.options.compilerArgs.addAll(qualExportsCore)
2203     compileJava.options.compilerArgs.addAll(qualExportsSwing)
2204 }
2205 
2206 project(":swt") {
2207     tasks.all {
2208         if (!COMPILE_SWT) it.enabled = false
2209     }
2210 
2211     // javafx.swt is an automatic module
2212     project.ext.buildModule = false
2213 
2214     commonModuleSetup(project, [ 'base', 'graphics' ])
2215 
2216     dependencies {
2217         compile name: SWT_FILE_NAME
2218     }
2219 
2220     classes {
2221         doLast {
2222             // Copy all of the download libraries to libs directory for the sake of the IDEs
2223             File libsDir = rootProject.file("build/libs");
2224             File swtLib = new File(libsDir, "swt-debug.jar")
2225             libsDir.mkdirs();
2226 
2227             // Skip copy if file is present.
2228             if (swtLib.exists()) return;
2229 
2230             for (File f : configurations.compile.files) {
2231                 // Have to rename the swt jar because it is some platform specific name but
2232                 // for the sake of the IDEs we need to have a single stable name that works
2233                 // on every platform
2234                 copy {
2235                     into libsDir
2236                     from f.getParentFile()
2237                     include "**/*swt*.jar"
2238                     includeEmptyDirs = false
2239                     rename ".*swt.*jar", "swt-debug\\.jar"
2240                 }
2241             }
2242         }
2243     }
2244 
2245     compileJava.options.compilerArgs.addAll([
2246             "--add-exports=javafx.graphics/com.sun.glass.ui=ALL-UNNAMED",
2247             "--add-exports=javafx.graphics/com.sun.javafx.cursor=ALL-UNNAMED",
2248             "--add-exports=javafx.graphics/com.sun.javafx.embed=ALL-UNNAMED",
2249             "--add-exports=javafx.graphics/com.sun.javafx.stage=ALL-UNNAMED",
2250             "--add-exports=javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED",
2251             ])
2252 
2253     test {
2254         //enabled = IS_FULL_TEST && IS_SWT_TEST
2255         enabled = false // FIXME: JIGSAW -- support this with modules
2256         logger.info("JIGSAW Testing disabled for swt")
2257 
2258         if (IS_MAC) {
2259             enabled = false
2260             logger.info("SWT tests are disabled on MAC, because Gradle test runner does not handle -XstartOnFirstThread properly (https://issues.gradle.org/browse/GRADLE-3290).")
2261         }
2262     }
2263 }


2454 
2455         from (sourceSets.main.output.resourcesDir) {
2456             includes = [ "resources/web-files/**" ]
2457         }
2458     }
2459 
2460     assemble.dependsOn(antpluginJar)
2461 
2462     // The "man" task will create a $buildDir/man containing the man
2463     // files for the system being built
2464     task man(type: Copy) {
2465         includeEmptyDirs = false
2466         enabled = (IS_LINUX || IS_MAC) && COMPILE_FXPACKAGER
2467         from "src/main/man"
2468         into "$buildDir/man"
2469         exclude "**/*.html"
2470         if (IS_MAC) exclude "**/ja_JP.UTF-8/**"
2471     }
2472     processResources.dependsOn man
2473 
2474     String buildClassesDir = "${sourceSets.main.java.outputDir}/${moduleName}"
2475 
2476     // Compile the native launchers. These are included in jdk.packager.jmod.
2477     if (IS_WINDOWS && COMPILE_FXPACKAGER) {
2478         task buildWinLauncher(type: CCTask, group: "Build") {
2479             description = "Compiles native sources for the application co-bundle launcher";
2480             matches = "WinLauncher\\.cpp";
2481             params.addAll(WIN.launcher.ccFlags);
2482             output(file("$buildDir/native/WinLauncher"));
2483             source(file("src/main/native/launcher/win"));
2484             compiler = WIN.launcher.compiler
2485             exe = true;
2486             linkerOptions.addAll(WIN.launcher.linkFlags);
2487         }
2488 
2489         task copyWinLauncher(type: Copy, group: "Build", dependsOn: buildWinLauncher) {
2490             from "$buildDir/native/WinLauncher/WinLauncher.exe"
2491             from "$MSVCR"
2492             from "$MSVCP"
2493             into "${buildClassesDir}/com/oracle/tools/packager/windows"
2494         }


2647         task copyJavaPackager(type: Copy, group: "Build", dependsOn: linkJavaPackager) {
2648             from file("$buildDir/native/javapackager/javapackager.exe")
2649             into file("$buildDir/javapackager")
2650         }
2651 
2652         task buildJavaPackager(dependsOn: [copyJavaPackager])
2653     } else {
2654         task buildJavaPackager(type: Copy, group: "Build") {
2655             enabled = COMPILE_FXPACKAGER
2656             from "src/main/native/javapackager/shell"
2657             into "$buildDir/javapackager"
2658             fileMode = 0755
2659         }
2660     }
2661 
2662     if (COMPILE_FXPACKAGER) {
2663         assemble.dependsOn compileLauncher;
2664         assemble.dependsOn buildJavaPackager
2665     }
2666 
2667     classes {
2668         doLast {
2669             // Copy all of the download libraries to libs directory for the sake of the IDEs
2670             File libsDir = rootProject.file("build/libs");
2671             File antLib = new File(libsDir, "ant-1.8.2.jar")
2672             libsDir.mkdirs();
2673 
2674             // Skip copy if file is present.
2675             if (antLib.exists()) return;
2676 
2677             for (File f : configurations.compile.files) {
2678                 copy {
2679                     into libsDir
2680                     from f.getParentFile()
2681                     include "**/ant-1.8.2.jar"
2682                     includeEmptyDirs = false
2683                 }
2684             }
2685         }
2686     }
2687 
2688     task setupPackagerFakeJar(type: Copy) {
2689         from "$projectDir/src/main/resources/com/oracle/tools/packager/linux/javalogo_white_48.png"
2690         from "$projectDir/src/main/resources/com/oracle/tools/packager/mac/GenericAppHiDPI.icns"
2691         from "$projectDir/src/main/resources/com/oracle/tools/packager/windows/javalogo_white_48.ico"
2692         from "$projectDir/src/test/resources/hello/java-logo2.gif"
2693         from "$projectDir/src/test/resources/hello/small.ico"
2694         from "$projectDir/src/test/resources/hello/test.icns"
2695         from "$projectDir/src/test/resources/hello/LICENSE-RTF.rtf"
2696         from "$projectDir/../../LICENSE"
2697         into project.file("$projectDir/build/tmp/tests/appResources")
2698     }
2699 
2700     task setupPackagerFakeJarLicense(type: Copy) {
2701         from "$projectDir/../../LICENSE"
2702         into project.file("$projectDir/build/tmp/tests/appResources")
2703         rename '(.*)LICENSE', '$1LICENSE2'
2704     }
2705 
2706     task packagerFakeJar(type: Jar, dependsOn: [setupPackagerFakeJar, setupPackagerFakeJarLicense]) {


2770                 '--module-path', JDK_JMODS,
2771                 '-o', "$projectDir/build/dev",
2772                 '-all',
2773                 packagerDevOpts
2774         ].flatten()
2775     }
2776 
2777     task createPackagerServicesModule(type: Jar) {
2778         if (project.hasProperty("DEBUGJDK_HOME")) {
2779             def dir = file("$DEBUGJDK_HOME/newmodules")
2780             dir.mkdirs()
2781 
2782             includeEmptyDirs = false
2783             archiveName = "jdk.packager.services.jar"
2784             destinationDir = dir
2785 
2786             from (project.file("$rootProject.buildDir/modular-sdk/modules/jdk.packager.services")) {
2787                 include "**"
2788             }
2789 
2790             from (project.file("$rootProject.buildDir/../modules/jdk.packager/build/classes/java/main/jdk.packager.services")) {
2791                 include "module-info.class"
2792             }
2793         }
2794     }
2795 
2796     task createPackagerModule(type: Jar) {
2797         if (project.hasProperty("DEBUGJDK_HOME")) {
2798             def dir = file("$DEBUGJDK_HOME/newmodules")
2799             dir.mkdirs()
2800 
2801             includeEmptyDirs = false
2802             archiveName = "jdk.packager.jar"
2803             destinationDir = dir
2804 
2805             from (project.file("$rootProject.buildDir/modular-sdk/modules/jdk.packager")) {
2806                 include "**"
2807             }
2808 
2809             from (project.file("$rootProject.buildDir/../modules/jdk.packager/build/classes/java/main/jdk.packager")) {
2810                 include "module-info.class"
2811             }
2812         }
2813     }
2814 
2815     task createRunScript() {
2816         def TEXT = "DEBUG_ARG=\"-J-Xdebug:\"\n" +
2817 "\n" +
2818 "# Argument parsing.\n" +
2819 "ARGS=()\n" +
2820 "for i in \"\$@\"; do\n" +
2821 "    if [[ \"\$i\" == \${DEBUG_ARG}* ]]; then\n" +
2822 "        ADDRESS=\${i:\${#DEBUG_ARG}}\n" +
2823 "        DEBUG=\"-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=\${ADDRESS}\"\n" +
2824 "    else\n" +
2825 "        ARGS+=(\"\$i\")\n" +
2826 "    fi\n" +
2827 "done\n" +
2828 "\n" +
2829 "\${JAVA_HOME}/bin/java.original --upgrade-module-path \${JAVA_HOME}/newmodules \$(IFS=\$\' \'; echo \"\${ARGS[*]}\")\n"


3415                                              "BASE_NAME=avplugin", "VERSION=${version}", "LIBAV_DIR=${libavDir}",
3416                                              "SUFFIX=-ffmpeg", IS_64 ? "ARCH=x64" : "ARCH=x32")
3417                                     }
3418                                 }
3419                             }
3420                         } else {
3421                             // Building fxavcodec plugin (libav plugin)
3422                             exec {
3423                                 commandLine ("make", "${makeJobsFlag}", "-C", "${nativeSrcDir}/gstreamer/projects/linux/avplugin")
3424                                 args("CC=${mediaProperties.compiler}", "LINKER=${mediaProperties.linker}",
3425                                      "OUTPUT_DIR=${nativeOutputDir}", "BUILD_TYPE=${buildType}",
3426                                      "BASE_NAME=avplugin", IS_64 ? "ARCH=x64" : "ARCH=x32")
3427                             }
3428                         }
3429                     }
3430                 }
3431                 buildNative.dependsOn buildAVPlugin
3432             }
3433 
3434             if (t.name == "win") {
3435                 def buildResources = task("buildResources") {
3436                     doLast {
3437                         def rcOutputDir = "${nativeOutputDir}/${buildType}"
3438                         mkdir rcOutputDir
3439                         exec {
3440                             environment(WINDOWS_NATIVE_COMPILE_ENVIRONMENT)
3441                             commandLine (WIN.media.rcCompiler)
3442                             args(WIN.media.glibRcFlags)
3443                             args("/Fo${rcOutputDir}/${WIN.media.glibRcFile}", WIN.media.rcSource)
3444                         }
3445 
3446                         exec {
3447                             environment(WINDOWS_NATIVE_COMPILE_ENVIRONMENT)
3448                             commandLine (WIN.media.rcCompiler)
3449                             args(WIN.media.gstreamerRcFlags)
3450                             args("/Fo${rcOutputDir}/${WIN.media.gstreamerRcFile}", WIN.media.rcSource)
3451                         }
3452 
3453                         exec {
3454                             environment(WINDOWS_NATIVE_COMPILE_ENVIRONMENT)
3455                             commandLine (WIN.media.rcCompiler)
3456                             args(WIN.media.fxpluginsRcFlags)
3457                             args("/Fo${rcOutputDir}/${WIN.media.fxpluginsRcFile}", WIN.media.rcSource)
3458                         }
3459 
3460                         exec {
3461                             environment(WINDOWS_NATIVE_COMPILE_ENVIRONMENT)
3462                             commandLine (WIN.media.rcCompiler)
3463                             args(WIN.media.jfxmediaRcFlags)
3464                             args("/Fo${rcOutputDir}/${WIN.media.jfxmediaRcFile}", WIN.media.rcSource)
3465                         }
3466                     }
3467                 }
3468 
3469                 def buildGlib = task("build${t.capital}Glib", dependsOn: [buildResources]) {
3470                     enabled = IS_COMPILE_MEDIA
3471                     doLast {
3472                         exec {
3473                             environment(WINDOWS_NATIVE_COMPILE_ENVIRONMENT)
3474                             commandLine ("make", "${makeJobsFlag}", "-C", "${nativeSrcDir}/gstreamer/projects/${projectDir}/glib-lite")
3475                             args("OUTPUT_DIR=${nativeOutputDir}", "BUILD_TYPE=${buildType}", "BASE_NAME=glib-lite",
3476                                  IS_64 ? "ARCH=x64" : "ARCH=x32", "RESOURCE=${nativeOutputDir}/${buildType}/${WIN.media.glibRcFile}",
3477                                  "CC=${mediaProperties.compiler}", "AR=${mediaProperties.ar}", "LINKER=${mediaProperties.linker}")
3478                         }
3479                     }
3480                 }
3481                 buildGStreamer.dependsOn buildGlib
3482 
3483             } else if (t.name == "mac") {
3484                 def buildGlib = task("build${t.capital}Glib") {
3485                     enabled = IS_COMPILE_MEDIA
3486                     doLast {
3487                         exec {


3678             def library = rootProject.ext[t.upper].library
3679             from "$webkitOutputDir/$webkitConfig/lib/${library('jfxwebkit')}"
3680             into "$buildDir/libs/${t.name}"
3681         }
3682 
3683         if (IS_WINDOWS && t.name == "win") {
3684             def webkitProperties = project.rootProject.ext[t.upper].webkit
3685             def rcTask = project.task("rc${t.capital}", type: CompileResourceTask) {
3686                 compiler = webkitProperties.rcCompiler
3687                 source(webkitProperties.rcSource)
3688                 if (webkitProperties.rcFlags) {
3689                     rcParams.addAll(webkitProperties.rcFlags)
3690                 }
3691                 output(file("$webkitOutputDir/$webkitConfig/WebCore/obj"))
3692             }
3693             compileNativeTask.dependsOn rcTask
3694         }
3695 
3696         def compileJavaDOMBindingTask = task("compileJavaDOMBinding${t.capital}", type: JavaCompile,
3697                 dependsOn: [compileJava, compileNativeTask, copyNativeTask]) {
3698             destinationDir = file("$buildDir/classes/java/main")
3699             classpath = configurations.compile
3700             source = project.sourceSets.main.java.srcDirs
3701             options.compilerArgs.addAll([
3702                 '-implicit:none',
3703                 '--module-source-path', defaultModuleSourcePath
3704                 ])
3705         }
3706 
3707         compileJavaDOMBinding.dependsOn compileJavaDOMBindingTask
3708 
3709         if (!targetProperties.compileWebnodeNative) {
3710             println("Not compiling native Webkit for ${t.name} per configuration request");
3711             compileNativeTask.enabled = false
3712         }
3713     }
3714 
3715     def drtClasses = "**/com/sun/javafx/webkit/drt/**"
3716     task drtJar(type: Jar, dependsOn: compileJava) {
3717         archiveName = "drt.jar"
3718         destinationDir = file("$buildDir/test")
3719         from "$buildDir/classes/java/main/javafx.web/"
3720         include drtClasses
3721         includeEmptyDirs = false
3722     }
3723 
3724     if (IS_COMPILE_WEBKIT) {
3725         assemble.dependsOn compileJavaDOMBinding, drtJar
3726     }
3727 
3728     compileJava.options.compilerArgs.addAll(qualExportsCore)
3729 }
3730 
3731 // This project is for system tests that need to run with a full SDK.
3732 // Most of them display a stage or do other things that preclude running
3733 // them in a shared JVM or as part of the "smoke test" run (which must
3734 // not pop up any windows or use audio). As such, they are only enabled
3735 // when FULL_TEST is specified, and each test runs in its own JVM
3736 project(":systemTests") {
3737 
3738     sourceSets {
3739         test


3790                 def e = cygpath("${elem}")
3791                 stRunArgsFile <<  "  ${e}${File.pathSeparator}\\\n"
3792             }
3793             stRunArgsFile <<  "\"\n"
3794         }
3795     }
3796 
3797     test.dependsOn(sts)
3798     test.dependsOn(createTestArgfiles);
3799 
3800     // Tasks to create standalone test applications for the launcher tests
3801 
3802     def testapp1JarName = "testapp1.jar"
3803     task createTestapp1Jar1(type: Jar) {
3804         dependsOn compileTestapp1Java
3805         enabled = IS_FULL_TEST
3806 
3807         destinationDir = file("$buildDir/testapp1")
3808         archiveName = testapp1JarName
3809         includeEmptyDirs = false
3810         from project.sourceSets.testapp1.java.outputDir
3811         include("testapp/**")
3812         include("com/javafx/main/**")
3813 
3814         manifest {
3815             attributes(
3816                 "Main-Class" : "com.javafx.main.Main",
3817                 "JavaFX-Version" : "2.2",
3818                 "JavaFX-Application-Class" : "testapp.HelloWorld",
3819                 "JavaFX-Class-Path" : "jar2.jar"
3820             )
3821         }
3822     }
3823 
3824     task createTestapp1Jar2(type: Jar) {
3825         dependsOn compileTestapp1Java
3826         enabled = IS_FULL_TEST
3827 
3828         destinationDir = file("$buildDir/testapp1")
3829         archiveName = "jar2.jar";
3830         includeEmptyDirs = false
3831         from project.sourceSets.testapp1.java.outputDir
3832         include("pkg2/**")
3833     }
3834 
3835     task createTestApps() {
3836         dependsOn(createTestapp1Jar1)
3837         dependsOn(createTestapp1Jar2)
3838     }
3839     test.dependsOn(createTestApps);
3840 
3841     def modtestapps = [ "testapp2", "testapp3", "testapp4", "testapp5", "testapp6"  ]
3842     modtestapps.each { testapp ->
3843         def testappCapital = testapp.capitalize()
3844         def copyTestAppTask = task("copy${testappCapital}", type: Copy) {
3845             from project.sourceSets."${testapp}".java.outputDir
3846             from project.sourceSets."${testapp}".output.resourcesDir
3847             into "${project.buildDir}/modules/${testapp}"
3848         }
3849 
3850         def List<String> testAppSourceDirs = []
3851         project.sourceSets."${testapp}".java.srcDirs.each { dir ->
3852             testAppSourceDirs += dir
3853         }
3854         def testappCompileTasks = project.getTasksByName("compile${testappCapital}Java", true);
3855         def testappResourceTasks = project.getTasksByName("process${testappCapital}Resources", true);
3856         testappCompileTasks.each { appCompileTask ->
3857             appCompileTask.options.compilerArgs.addAll([
3858                 '-implicit:none',
3859                 '--module-source-path', testAppSourceDirs.join(File.pathSeparator)
3860                 ] )
3861 
3862             copyTestAppTask.dependsOn(appCompileTask)
3863         }
3864         testappResourceTasks.each { appResourceTask ->
3865             copyTestAppTask.dependsOn(appResourceTask)


3952         project.processResources.destinationDir = project.moduleDir
3953     }
3954 
3955     if (project.hasProperty('moduleSourcePathShim') &&
3956             project.sourceSets.hasProperty('shims')) {
3957 
3958         // sync up the obvious source directories with the shims
3959         // others (like the shaders in graphics) should be added in there
3960         project.sourceSets.shims.java.srcDirs += project.sourceSets.main.java.srcDirs
3961         project.sourceSets.shims.java.srcDirs += "$buildDir/gensrc/java"
3962 
3963         project.compileShimsJava {
3964             options.compilerArgs.addAll([
3965                 '-implicit:none',
3966                 '--module-source-path', project.moduleSourcePathShim
3967                 ])
3968         }
3969         project.compileShimsJava.dependsOn(project.compileJava)
3970 
3971         def copyGeneratedShimsTask = task("copyGeneratedShims", type: Copy, dependsOn: [compileShimsJava, processShimsResources]) {
3972             from project.sourceSets.shims.java.outputDir
3973             into "${rootProject.buildDir}/shims"
3974             exclude("*/module-info.class")
3975         }
3976 
3977         project.processShimsResources.dependsOn(project.processResources)
3978 
3979         // shims resources should have the main resouces as a base
3980         project.sourceSets.shims.resources.srcDirs += project.sourceSets.main.resources.srcDirs
3981 
3982         // and redirect the resources into the module
3983         project.processShimsResources.destinationDir = project.moduleShimsDir
3984 
3985        compileTestJava.dependsOn(copyGeneratedShimsTask)
3986     }
3987 
3988     if (project.hasProperty('modulePathArgs')) {
3989         project.compileJava.options.compilerArgs.addAll(modulePathArgs)
3990     }
3991 
3992     if (project.hasProperty('testModulePathArgs')) {


4199 subprojects {
4200     if (project.hasProperty("buildModule") && project.ext.buildModule) {
4201         rootProject.ext.moduleProjList += project
4202         println "module: $project (buildModule=YES)"
4203     } else {
4204         println "module: $project (buildModule=NO)"
4205     }
4206 }
4207 
4208 
4209 // Define the sdk task, which also produces the javafx.swt modular jar
4210 
4211 compileTargets { t ->
4212 
4213     def javafxSwtTask = task("javafxSwt$t.capital", type: Jar) {
4214         enabled = COMPILE_SWT
4215         group = "Basic"
4216         description = "Creates the javafx-swt.jar for the $t.name target"
4217         archiveName = "${project(":swt").buildDir}/libs/javafx-swt.jar";
4218         includeEmptyDirs = false
4219         from("${project(":swt").buildDir}/classes/java/main");
4220         include("**/javafx/embed/swt/**")
4221 
4222         dependsOn(
4223             project(":swt").compileJava,
4224             project(":swt").processResources,
4225             // note: assemble and classes are not enough for DidWork
4226             project(":swt").classes,
4227             // classes is needed for a jar copy
4228             )



4229     }
4230 
4231     // FIXME: do we really need the index task for this modular jar?
4232     def javafxSwtIndexTask = task("javafxSwtIndex$t.capital") {
4233         //the following is a workaround for the lack of indexing in gradle 1.4 through 1.7
4234         dependsOn(javafxSwtTask)



4235 
4236         doLast() {
4237             ant.jar (update: true, index: true, destfile: javafxSwtTask.archiveName)
4238         }
4239     }
4240 
4241     def sdkTask = task("sdk$t.capital") {
4242         group = "Basic"
4243         dependsOn(javafxSwtIndexTask)
4244     }
4245 
4246     sdk.dependsOn(sdkTask)
4247 }
4248 
4249 project(":apps") {
4250     // The apps build is Ant based, we will exec ant from gradle.
4251 
4252     // Download the Lucene libraries needed for the Ensemble8 app
4253     getConfigurations().create("lucene");
4254     dependencies {


4563             writeRunArgsFile(runArgsFile, computeLibraryPath(true), modpath)
4564             writeRunArgsFile(compileArgsFile, null, modpath)
4565 
4566             if (rootProject.hasProperty("EXTRA_ADDEXPORTS_STRING")) {
4567                 runArgsFile << EXTRA_ADDEXPORTS_STRING
4568                 compileArgsFile << EXTRA_ADDEXPORTS_STRING
4569             }
4570         }
4571     }
4572     buildModules.dependsOn(buildRunArgsTask)
4573 
4574     def isWindows = IS_WINDOWS && t.name == "win";
4575     def isMac = IS_MAC && t.name == "mac";
4576 
4577     // Create layout for modular classes
4578     moduleProjList.each { project ->
4579         def buildModuleClassesTask = project.task("buildModule$t.capital", group: "Build", type: Copy) {
4580             dependsOn(project.assemble)
4581             def buildDir = project.buildDir
4582             def sourceBuildDirs = [
4583                 "${buildDir}/classes/java/main/${project.moduleName}",
4584             ]
4585 
4586             def moduleClassesDir = "$buildDir/${platformPrefix}module-classes"
4587                 includeEmptyDirs = false
4588                 sourceBuildDirs.each { d ->
4589                     from d
4590                 }
4591                 into moduleClassesDir
4592 
4593                 // Exclude obsolete, experimental, or non-shipping code
4594                 exclude("version.rc")
4595                 exclude("com/sun/glass/ui/swt")
4596                 exclude("com/sun/javafx/tools/ant")
4597                 exclude("com/javafx/main")
4598                 exclude("com/sun/javafx/webkit/drt")
4599                 if (!IS_INCLUDE_NULL3D) {
4600                     exclude ("com/sun/prism/null3d")
4601                 }
4602                 if (!IS_INCLUDE_ES2) {
4603                        exclude("com/sun/prism/es2",


4651                     exclude ("com/sun/glass/ui/android")
4652                 }
4653 
4654                 // Filter out other platform-specific classes
4655                 if (targetProperties.containsKey('jfxrtJarExcludes')) {
4656                     exclude(targetProperties.jfxrtJarExcludes)
4657                 }
4658 
4659                 /* FIXME: JIGSAW -- handle this in the module itself
4660                 String webbld = project(":web").buildDir.path
4661                 String ctrlbld = project(":controls").buildDir.path
4662                 if (t.name == 'android') {
4663                     from ("${webbld}/classes/android",
4664                           "${webbld}/resources/android",
4665                           "${ctrlbld}/classes/android",
4666                           "${ctrlbld}/resources/android")
4667                 } else if (t.name == 'ios') {
4668                     from ("${webbld}/classes/ios",
4669                           "${webbld}/resources/ios")
4670                 } else {
4671                     from ("${webbld}/classes/java/main")

4672                 }
4673                 */
4674         }
4675         buildModulesTask.dependsOn(buildModuleClassesTask)
4676     }
4677 
4678     def buildModuleLibsTask = task("buildModuleLibs$t.capital") {
4679         group = "Basic"
4680 
4681         def baseProject = project(":base");
4682 
4683         def graphicsProject = project(":graphics");
4684 
4685         def mediaProject = project(":media");
4686 
4687         def webProject = project(":web");
4688         dependsOn(webProject.assemble)
4689 
4690         def swtProject = project(":swt");
4691 


< prev index next >