654 if (!targetProperties.containsKey('compileMediaNative')) { 655 // unless specified otherwise, we will compile native Media if IS_COMPILE_MEDIA 656 targetProperties.compileMediaNative = true 657 } 658 659 if (!targetProperties.containsKey('includeSWT')) targetProperties.includeSWT = true 660 if (!targetProperties.containsKey('includeSwing')) targetProperties.includeSwing = true 661 if (!targetProperties.containsKey('includeNull3d')) targetProperties.includeNull3d = true 662 if (!targetProperties.containsKey('includeLens')) targetProperties.includeLens = false 663 if (!targetProperties.containsKey('includeMonocle')) targetProperties.includeMonocle = false 664 if (!targetProperties.containsKey('includeEGL')) targetProperties.includeEGL = false 665 666 if (!targetProperties.containsKey('includeGTK')) targetProperties.includeGTK = IS_LINUX 667 668 // This value is used to under ./build/${sdkDirName} to allow for 669 // a common name for the hosted build (for use when building apps) 670 // and a unique name for cross builds. 671 if (rootProject.defaultHostTarget.equals(t.name)) { 672 // use a simple common default for the "host" build 673 targetProperties.sdkDirName="sdk" 674 } else { 675 // and a more complex one for cross builds 676 targetProperties.sdkDirName="${t.name}-sdk" 677 } 678 } 679 680 /****************************************************************************** 681 * * 682 * Build Setup Sanity Checks * 683 * * 684 * Here we do a variety of checks so that if the version of Java you are * 685 * building with is misconfigured, or you are using the wrong version of * 686 * gradle, etc you will get some kind of helpful error / warning message * 687 * * 688 *****************************************************************************/ 689 690 // Verify that the architecture & OS are supported configurations. Note that 691 // at present building on PI is not supported, but we would only need to make 692 // some changes on assumptions on what should be built (like SWT / Swing) and 693 // such and we could probably make it work. 694 if (!IS_MAC && !IS_WINDOWS && !IS_LINUX) logger.error("Unsupported build OS ${OS_NAME}") 695 if (IS_WINDOWS && OS_ARCH != "x86" && OS_ARCH != "amd64") { 696 throw new Exception("Unknown and unsupported build architecture: $OS_ARCH") 2790 2791 task findbugs() { 2792 dependsOn(sdk) 2793 2794 doLast { 2795 if (!BUILD_CLOSED) { 2796 println "findbugs task is only run for a closed build" 2797 } 2798 } 2799 } 2800 2801 // The following tasks are for the closed build only. They are a no-op for the open build 2802 2803 task checkCache() { 2804 dependsOn(updateCacheIfNeeded) 2805 } 2806 2807 // TODO: consider moving the "public-sdk" portion of this task here 2808 task publicExports() { 2809 doFirst { 2810 if (!IS_BUILD_JAVADOC) { 2811 fail("publicExports task requires: -PBUILD_JAVADOC=true") 2812 } 2813 } 2814 dependsOn(sdk) 2815 doLast { 2816 if (!BUILD_CLOSED) { 2817 println "publicExports task is only run for a closed build" 2818 } 2819 } 2820 } 2821 2822 task perf() { 2823 dependsOn(sdk,apps) 2824 doLast { 2825 if (!BUILD_CLOSED) { 2826 println "perf task is only run for a closed build" 2827 } 2828 } 2829 } 2830 2831 task zips() { 2832 doFirst { 2833 if (!IS_BUILD_JAVADOC) { 2834 fail("zips task requires: -PBUILD_JAVADOC=true") 2835 } 2836 } 2837 dependsOn(sdk,publicExports,apps,perf) 2838 doLast { 2839 if (!BUILD_CLOSED) { 2840 println "zips task is only run for a closed build" 2841 } 2842 } 2843 } 2844 2845 task copySources(type: Copy) { 2846 enabled = IS_BUILD_SRC_ZIP 2847 def projectsToCopy = [ 2848 project(":base"), project(":graphics"), project(":controls"), 2849 project(":swing"), project(":swt"), project(":fxml"), 2850 project(":builders"), project(":media"), project(":web")] 2851 from(projectsToCopy.collect({ proj -> 2852 files(proj.sourceSets.main.java.srcDirs) 2853 })) 2854 include "**/*.java" 2855 into "${buildDir}/javafx-src" 2856 } 2857 2858 task zipSources(type: Zip) { 2859 enabled = IS_BUILD_SRC_ZIP 2860 dependsOn(copySources) 2861 archiveName = "javafx-src.zip" 2862 destinationDir = file("$buildDir") 3243 } 3244 rootProject.appsjar.dependsOn(appsJar) 3245 3246 def appsClean = project.task("appsClean${t.capital}") { 3247 doLast() { 3248 ant.properties['targetBld'] = "$t.name" 3249 ant.properties['platforms.JDK_1.8.home'] = "${rootProject.ext.JDK_HOME}" 3250 ant.project.executeTarget("sampleAppsClean") 3251 ant.project.executeTarget("scenebuilderSampleAppsClean") 3252 if (!t.name.startsWith("arm")) { 3253 ant.project.executeTarget("scenebuilderAppClean") 3254 } 3255 } 3256 } 3257 rootProject.clean.dependsOn(appsClean) 3258 } 3259 } 3260 3261 /****************************************************************************** 3262 * * 3263 * BUILD_CLOSED * 3264 * * 3265 * This next section should remain at the end of the build script. It allows * 3266 * for a "supplemental" gradle file to be used to extend the normal build * 3267 * structure. For example, this is used for passing a supplemental gradle * 3268 * file for producing official JavaFX builds. * 3269 * * 3270 *****************************************************************************/ 3271 3272 if (BUILD_CLOSED) { 3273 apply from: supplementalBuildFile 3274 } 3275 3276 task showFlags { 3277 } 3278 3279 compileTargets { t -> 3280 // Every platform must define these variables 3281 def props = project.ext[t.upper]; 3282 showFlags.dependsOn( | 654 if (!targetProperties.containsKey('compileMediaNative')) { 655 // unless specified otherwise, we will compile native Media if IS_COMPILE_MEDIA 656 targetProperties.compileMediaNative = true 657 } 658 659 if (!targetProperties.containsKey('includeSWT')) targetProperties.includeSWT = true 660 if (!targetProperties.containsKey('includeSwing')) targetProperties.includeSwing = true 661 if (!targetProperties.containsKey('includeNull3d')) targetProperties.includeNull3d = true 662 if (!targetProperties.containsKey('includeLens')) targetProperties.includeLens = false 663 if (!targetProperties.containsKey('includeMonocle')) targetProperties.includeMonocle = false 664 if (!targetProperties.containsKey('includeEGL')) targetProperties.includeEGL = false 665 666 if (!targetProperties.containsKey('includeGTK')) targetProperties.includeGTK = IS_LINUX 667 668 // This value is used to under ./build/${sdkDirName} to allow for 669 // a common name for the hosted build (for use when building apps) 670 // and a unique name for cross builds. 671 if (rootProject.defaultHostTarget.equals(t.name)) { 672 // use a simple common default for the "host" build 673 targetProperties.sdkDirName="sdk" 674 targetProperties.exportDirName="export" 675 targetProperties.bundleDirName="bundles" 676 } else { 677 // and a more complex one for cross builds 678 targetProperties.sdkDirName="${t.name}-sdk" 679 targetProperties.exportDirName="${t.name}-export" 680 targetProperties.bundleDirName="${t.name}-bundles" 681 } 682 } 683 684 /****************************************************************************** 685 * * 686 * Build Setup Sanity Checks * 687 * * 688 * Here we do a variety of checks so that if the version of Java you are * 689 * building with is misconfigured, or you are using the wrong version of * 690 * gradle, etc you will get some kind of helpful error / warning message * 691 * * 692 *****************************************************************************/ 693 694 // Verify that the architecture & OS are supported configurations. Note that 695 // at present building on PI is not supported, but we would only need to make 696 // some changes on assumptions on what should be built (like SWT / Swing) and 697 // such and we could probably make it work. 698 if (!IS_MAC && !IS_WINDOWS && !IS_LINUX) logger.error("Unsupported build OS ${OS_NAME}") 699 if (IS_WINDOWS && OS_ARCH != "x86" && OS_ARCH != "amd64") { 700 throw new Exception("Unknown and unsupported build architecture: $OS_ARCH") 2794 2795 task findbugs() { 2796 dependsOn(sdk) 2797 2798 doLast { 2799 if (!BUILD_CLOSED) { 2800 println "findbugs task is only run for a closed build" 2801 } 2802 } 2803 } 2804 2805 // The following tasks are for the closed build only. They are a no-op for the open build 2806 2807 task checkCache() { 2808 dependsOn(updateCacheIfNeeded) 2809 } 2810 2811 // TODO: consider moving the "public-sdk" portion of this task here 2812 task publicExports() { 2813 doFirst { 2814 if (BUILD_CLOSED && !IS_BUILD_JAVADOC) { 2815 fail("publicExports task requires: -PBUILD_JAVADOC=true") 2816 } 2817 } 2818 dependsOn(sdk) 2819 } 2820 2821 task perf() { 2822 dependsOn(sdk,apps) 2823 doLast { 2824 if (!BUILD_CLOSED) { 2825 println "perf task is only run for a closed build" 2826 } 2827 } 2828 } 2829 2830 task zips() { 2831 doFirst { 2832 if (BUILD_CLOSED && !IS_BUILD_JAVADOC) { 2833 fail("zips task requires: -PBUILD_JAVADOC=true") 2834 } 2835 } 2836 dependsOn(sdk,publicExports,apps,perf) 2837 } 2838 2839 task copySources(type: Copy) { 2840 enabled = IS_BUILD_SRC_ZIP 2841 def projectsToCopy = [ 2842 project(":base"), project(":graphics"), project(":controls"), 2843 project(":swing"), project(":swt"), project(":fxml"), 2844 project(":builders"), project(":media"), project(":web")] 2845 from(projectsToCopy.collect({ proj -> 2846 files(proj.sourceSets.main.java.srcDirs) 2847 })) 2848 include "**/*.java" 2849 into "${buildDir}/javafx-src" 2850 } 2851 2852 task zipSources(type: Zip) { 2853 enabled = IS_BUILD_SRC_ZIP 2854 dependsOn(copySources) 2855 archiveName = "javafx-src.zip" 2856 destinationDir = file("$buildDir") 3237 } 3238 rootProject.appsjar.dependsOn(appsJar) 3239 3240 def appsClean = project.task("appsClean${t.capital}") { 3241 doLast() { 3242 ant.properties['targetBld'] = "$t.name" 3243 ant.properties['platforms.JDK_1.8.home'] = "${rootProject.ext.JDK_HOME}" 3244 ant.project.executeTarget("sampleAppsClean") 3245 ant.project.executeTarget("scenebuilderSampleAppsClean") 3246 if (!t.name.startsWith("arm")) { 3247 ant.project.executeTarget("scenebuilderAppClean") 3248 } 3249 } 3250 } 3251 rootProject.clean.dependsOn(appsClean) 3252 } 3253 } 3254 3255 /****************************************************************************** 3256 * * 3257 * OpenExport * 3258 * * 3259 *****************************************************************************/ 3260 3261 task openExport() { 3262 if (!BUILD_CLOSED) { 3263 publicExports.dependsOn(openExport) 3264 } 3265 } 3266 3267 task openZip() { 3268 if (!BUILD_CLOSED) { 3269 zips.dependsOn(openZip) 3270 } 3271 } 3272 3273 compileTargets { t -> 3274 def targetProperties = project.ext[t.upper] 3275 3276 def sdkDir = "${project.buildDir}/${targetProperties.sdkDirName}" 3277 def exportDir = "${project.buildDir}/${targetProperties.exportDirName}" 3278 def exportSDKDir = "${exportDir}/sdk" 3279 def bundleDir = "${project.buildDir}/${targetProperties.bundleDirName}" 3280 def jfxrtJar = "$sdkDir/rt/lib/ext/jfxrt.jar" 3281 3282 def isWindows = false 3283 if (IS_WINDOWS && t.name == "win") { 3284 isWindows = true 3285 } 3286 3287 def String compressJar = "false" 3288 if (targetProperties.containsKey('deploy') && 3289 targetProperties.deploy.containsKey('compressBigJar')) { 3290 compressJar = targetProperties.deploy.compressBigJar 3291 } 3292 3293 def exportTask = project.task("openExport$t.capital", group: "Build") { 3294 //dependsOn("sdk$t.capital") 3295 3296 doLast { 3297 def exportTmp = "${exportDir}/tmp/classes" 3298 3299 // delete any old exports dir before rebuilding it 3300 file("${exportDir}").deleteDir() 3301 3302 mkdir "${exportTmp}" 3303 3304 copy { 3305 from "${sdkDir}" 3306 into "${exportSDKDir}" 3307 exclude '**/jfxrt.jar' 3308 3309 if (isWindows) { 3310 exclude '**/prism_es2.dll' 3311 } 3312 3313 eachFile {details -> 3314 if (details.path.startsWith('rt/')) { 3315 details.path = 'jre/' + details.path.substring(3); 3316 } 3317 } 3318 } 3319 3320 copy { 3321 from zipTree("${jfxrtJar}") 3322 into "${exportTmp}" 3323 } 3324 3325 mkdir "${exportSDKDir}/jre/lib/ext" 3326 3327 ant.jar( 3328 destfile: "${exportSDKDir}/jre/lib/ext/jfxrt.jar", 3329 index: true, 3330 compress: compressJar 3331 ) { 3332 delegate.manifest { 3333 attribute(name: 'Implementation-Title', value: 'JavaFX.graphics') 3334 } 3335 3336 fileset(dir: "${exportTmp}") { 3337 exclude(name:'META-INF/*') 3338 exclude(name:'com/sun/javafx/tools/ant/*') 3339 3340 //-- Obsolete or experimental code -- 3341 exclude(name:'com/sun/embeddedswing/**') 3342 exclude(name:'com/sun/javafx/tk/glass/**') 3343 exclude(name:'com/sun/javafx/tk/swing/**') 3344 exclude(name:'com/sun/prism/null3d/**') 3345 exclude(name:'com/sun/scenario/scenegraph/**') 3346 exclude(name:'com/sun/scenario/utils/**') 3347 exclude(name:'com/sun/webpane/sg/swing/**') 3348 exclude(name:'com/sun/webpane/swing/**') 3349 exclude(name:'com/sun/glass/ui/swt/**') 3350 3351 if (isWindows) { 3352 //-- Strip ES2 pipeline on Windows platform only -- 3353 exclude(name:'com/sun/prism/es2/**') 3354 exclude(name:'com/sun/scenario/effect/impl/es2/**') 3355 exclude(name:'com/sun/scenario/effect/impl/hw/ogl/**') 3356 exclude(name:'com/sun/scenario/effect/impl/j2d/jogl/**') 3357 exclude(name:'com/sun/scenario/effect/impl/j2d/rsl/**') 3358 } 3359 3360 if(!targetProperties.includeLens) { 3361 exclude(name:'com/sun/glass/ui/lens/**') 3362 } 3363 3364 if(!targetProperties.includeMonocle) { 3365 exclude(name:'com/sun/glass/ui/monocle/**') 3366 exclude(name:'com/sun/prism/es2/Monocle*') 3367 } 3368 } 3369 } // ant.jar 3370 3371 // remove {exportTmp} 3372 file("${exportTmp}").deleteDir() 3373 } 3374 } 3375 3376 def jfxBundle = 'javafx-sdk-overlay.zip' 3377 3378 def zipTask = project.task("openZip$t.capital", type: Zip, group: "Build") { 3379 3380 doFirst() { 3381 file("${bundleDir}/${jfxBundle}").delete() 3382 } 3383 3384 archiveName = jfxBundle 3385 destinationDir = file("$bundleDir") 3386 includeEmptyDirs = false 3387 from "${exportSDKDir}" 3388 3389 dependsOn(exportTask) 3390 } 3391 3392 if (!BUILD_CLOSED) { 3393 publicExports.dependsOn(exportTask) 3394 zips.dependsOn(zipTask) 3395 } 3396 } 3397 3398 3399 /****************************************************************************** 3400 * * 3401 * BUILD_CLOSED * 3402 * * 3403 * This next section should remain at the end of the build script. It allows * 3404 * for a "supplemental" gradle file to be used to extend the normal build * 3405 * structure. For example, this is used for passing a supplemental gradle * 3406 * file for producing official JavaFX builds. * 3407 * * 3408 *****************************************************************************/ 3409 3410 if (BUILD_CLOSED) { 3411 apply from: supplementalBuildFile 3412 } 3413 3414 task showFlags { 3415 } 3416 3417 compileTargets { t -> 3418 // Every platform must define these variables 3419 def props = project.ext[t.upper]; 3420 showFlags.dependsOn( |