2858 destinationDir = file("$buildDir/test") 2859 from "$buildDir/classes/main" 2860 include drtClasses 2861 } 2862 2863 if (IS_COMPILE_WEBKIT) { 2864 jar.dependsOn compileGenerated, drtJar 2865 } 2866 } 2867 2868 // This project is for system tests that need to run with a full SDK. 2869 // Most of them display a stage or do other things that preclude running 2870 // them in a shared JVM or as part of the "smoke test" run (which must 2871 // not pop up any windows or use audio). As such, they are only enabled 2872 // when FULL_TEST is specified, and each test runs in its own JVM 2873 project(":systemTests") { 2874 2875 dependencies { 2876 testCompile project(":graphics").sourceSets.test.output 2877 testCompile project(":base").sourceSets.test.output 2878 } 2879 2880 test { 2881 enabled = IS_FULL_TEST 2882 if (IS_JDK9_TEST) { 2883 enabled = false //FIXME: support JDK9 2884 logger.info("JDK9 Testing disabled for systemTests") 2885 } 2886 if (!IS_USE_ROBOT) { 2887 // Disable all robot-based visual tests 2888 exclude("test/robot/**"); 2889 } 2890 if (!IS_AWT_TEST) { 2891 // Disable all AWT-based tests 2892 exclude("**/javafx/embed/swing/*.*"); 2893 exclude("**/com/sun/javafx/application/Swing*.*"); 2894 } 2895 2896 forkEvery = 1 2897 } 2898 } 2899 2900 allprojects { 2901 // The following block is a workaround for the fact that presently Gradle 2902 // can't set the -XDignore.symbol.file flag, because it appears that the 2903 // javac API is lacking support for it. So what we'll do is find any Compile 2904 // task and manually provide the options necessary to fire up the 2905 // compiler with the right settings. 3751 into "${packagerProject.buildDir}/${platformPrefix}module-lib" 3752 } 3753 3754 // Copy over the javapackager executable 3755 if (t.name == "win" || t.name == "linux" || t.name == "mac") { 3756 copy { 3757 from "modules/fxpackager/build/javapackager" 3758 into "${packagerProject.buildDir}/${platformPrefix}module-bin" 3759 } 3760 } 3761 3762 } 3763 } 3764 buildModulesTask.dependsOn(buildModuleLibsTask) 3765 3766 def sdkTask = tasks.getByName("sdk${t.capital}"); 3767 sdkTask.dependsOn(buildModulesTask) 3768 } 3769 sdk.dependsOn(buildModules) 3770 3771 task buildModulesTests { 3772 } 3773 3774 void configureJDK9tests( 3775 Project p, 3776 List<String> moduleDeps, 3777 Set<String> patchInc, 3778 Set<String> testsInc, 3779 String addExportsFile 3780 ) { 3781 3782 if(!IS_JDK9_TEST) { 3783 return 3784 } 3785 3786 p.configurations { 3787 jdk9test 3788 } 3789 3790 p.dependencies { 3791 jdk9test group: "junit", name: "junit", version: "4.8.2" 3792 } 3793 3794 compileTargets { t -> 3795 3796 def targetProperties = project.rootProject.ext[t.upper] 3797 3798 def modularSdkDirName = "${targetProperties.platformPrefix}modular-sdk" 3799 def modularSdkDir = "${rootProject.buildDir}/${modularSdkDirName}" 3800 def modulesDir = "${modularSdkDir}/modules" 3801 3802 logger.info("configuring $p.name for modular test copy"); 3803 3804 def testingDir = "${rootProject.buildDir}/${targetProperties.platformPrefix}testing"; 3805 def patchesDir = new File("${testingDir}/modules"); 3806 String javaLibraryPath = "${rootProject.buildDir}/sdk/$targetProperties.libDest" 3807 3808 def jdk9patchesBaseDir = new File("${testingDir}/modules/$p.moduleName"); 3809 def jdk9patchesTestDir = new File("${testingDir}/tests/$p.moduleName"); 3810 3811 def srcClassesDir = "${p.buildDir}/${targetProperties.platformPrefix}module-classes" 3812 Task classes = p.task("jdk9CopyClasses${t.capital}", type: Copy, dependsOn: [p.classes]) { 3813 from srcClassesDir 3814 into jdk9patchesBaseDir 3815 } 3816 3817 Task shims = p.task("jdk9CopyShims${t.capital}", type: Copy, dependsOn: [p.testClasses]) { 3818 //from p.sourceSets.test.output.classesDir 3819 from p.sourceSets.test.output 3820 into jdk9patchesBaseDir 3821 if (patchInc != null) { 3822 include patchInc 3823 } else { 3824 include "**/*" 3825 } 3826 if (testsInc != null) { 3827 exclude testsInc 3828 } 3829 includeEmptyDirs = false 3830 doLast() { 3831 logger.info("project $p.name finished jdk9CopyShims to $jdk9patchesBaseDir"); 3832 } 3833 } 3834 3835 Task tests = p.task("jdk9CopyTests${t.capital}", type: Copy, dependsOn: [p.testClasses]) { 3836 //from p.sourceSets.test.output.classesDir 3837 from p.sourceSets.test.output 3838 into jdk9patchesTestDir 3839 if (patchInc != null) { 3840 exclude patchInc 3841 } 3842 if (testsInc != null) { 3843 include testsInc 3844 } else { 3845 include "**/*" 3846 } 3847 includeEmptyDirs = false 3848 doLast() { 3849 logger.info("project $p.name finished jdk9CopyTests to $jdk9patchesTestDir"); 3850 } 3851 } 3852 3853 Task jdk9testsTask = p.task("jdk9tests${t.capital}", dependsOn: [classes, shims, tests]) { 3854 doLast() { 3855 logger.info("project $p.name finished jdk9tests${t.capital}"); 3856 } 3857 } 3858 3859 // not found ? 3860 //buildModulesTests.dependsOn(jdk9testsTask); 3861 3862 FileCollection testclasspath = p.files(p.configurations.jdk9test) 3863 3864 p.test.dependsOn jdk9testsTask 3865 3866 if (moduleDeps != null) { 3867 moduleDeps.each() {s-> 3868 logger.info("adding dep to project $p.name $s"); 3869 Project pdep = rootProject.project(s); 3870 jdk9testsTask.dependsOn pdep.jdk9testClasses 3871 3872 testclasspath += p.files(pdep.ext.jdk9patchesTestDir); 3873 } 3874 } 3875 3876 testclasspath += p.files(jdk9patchesTestDir); 3877 3878 p.ext.jdk9testClasspath = testclasspath 3879 p.ext.jdk9patchesTestDir = jdk9patchesTestDir 3880 p.ext.jdk9testClasses = jdk9testsTask 3881 3882 p.ext.argclasspathFile = "$testingDir/classpath_"+p.name+".txt" 3883 3884 p.test { 3885 if (IS_FORCE_TESTS) { 3886 dependsOn 'cleanTest' 3887 } 3888 3889 scanForTestClasses = false 3890 include("**/*Test.*") 3891 3892 if (IS_JDK9_TEST) { 3893 dependsOn jdk9testsTask 3894 3895 doFirst { 3896 classpath = testclasspath 3897 p.sourceSets.test.runtimeClasspath = testclasspath 3898 } 3899 3900 String bcp = "-Xbootclasspath/a:" + rootProject.projectDir.path + "/buildSrc/build/libs/buildSrc.jar" 3901 3902 systemProperties 'worker.debug': true //DAVE 3903 systemProperties 'worker.library.path': javaLibraryPath 3904 systemProperties 'worker.xpatch.dir': patchesDir.path 3905 if (addExportsFile != null) { 3906 systemProperties 'worker.exports.file': addExportsFile 3907 } 3908 systemProperties 'worker.classpath.file': p.ext.argclasspathFile 3909 systemProperties 'worker.java9': JAVA9 3910 3911 //systemProperties 'prism.order': 'sw' 3912 //systemProperties 'glass.platform': 'Monocle' 3913 //systemProperties
'glass.len': 'headless' 3914 3915 jvmArgs bcp, "workaround.GradleJUnitWorker" 3916 3917 environment("JDK_HOME", JDK9_HOME); 3918 executable (JAVA9); 3919 3920 } 3921 } 3922 3923 } 3924 3925 } 3926 3927 task checkrepo() { 3928 doLast { 3929 logger.info("checking for whitespace (open)"); | 2858 destinationDir = file("$buildDir/test") 2859 from "$buildDir/classes/main" 2860 include drtClasses 2861 } 2862 2863 if (IS_COMPILE_WEBKIT) { 2864 jar.dependsOn compileGenerated, drtJar 2865 } 2866 } 2867 2868 // This project is for system tests that need to run with a full SDK. 2869 // Most of them display a stage or do other things that preclude running 2870 // them in a shared JVM or as part of the "smoke test" run (which must 2871 // not pop up any windows or use audio). As such, they are only enabled 2872 // when FULL_TEST is specified, and each test runs in its own JVM 2873 project(":systemTests") { 2874 2875 dependencies { 2876 testCompile project(":graphics").sourceSets.test.output 2877 testCompile project(":base").sourceSets.test.output 2878 testCompile project(":controls").sourceSets.test.output 2879 testCompile project(":swing").sourceSets.test.output 2880 } 2881 2882 Set<String> testInclude = [ "test/**" ] 2883 configureJDK9tests(project, [ "base", "graphics", "controls", "swing", "fxml", "web" ], 2884 null, testInclude, 2885 project.projectDir.path + "/src/test/addExports" 2886 ) 2887 2888 test { 2889 enabled = IS_FULL_TEST 2890 if (!IS_USE_ROBOT) { 2891 // Disable all robot-based visual tests 2892 exclude("test/robot/**"); 2893 } 2894 if (!IS_AWT_TEST) { 2895 // Disable all AWT-based tests 2896 exclude("**/javafx/embed/swing/*.*"); 2897 exclude("**/com/sun/javafx/application/Swing*.*"); 2898 } 2899 2900 forkEvery = 1 2901 } 2902 } 2903 2904 allprojects { 2905 // The following block is a workaround for the fact that presently Gradle 2906 // can't set the -XDignore.symbol.file flag, because it appears that the 2907 // javac API is lacking support for it. So what we'll do is find any Compile 2908 // task and manually provide the options necessary to fire up the 2909 // compiler with the right settings. 3755 into "${packagerProject.buildDir}/${platformPrefix}module-lib" 3756 } 3757 3758 // Copy over the javapackager executable 3759 if (t.name == "win" || t.name == "linux" || t.name == "mac") { 3760 copy { 3761 from "modules/fxpackager/build/javapackager" 3762 into "${packagerProject.buildDir}/${platformPrefix}module-bin" 3763 } 3764 } 3765 3766 } 3767 } 3768 buildModulesTask.dependsOn(buildModuleLibsTask) 3769 3770 def sdkTask = tasks.getByName("sdk${t.capital}"); 3771 sdkTask.dependsOn(buildModulesTask) 3772 } 3773 sdk.dependsOn(buildModules) 3774 3775 void configureJDK9tests( 3776 Project p, 3777 List<String> moduleDeps, 3778 Set<String> patchInc, 3779 Set<String> testsInc, 3780 String addExportsFile 3781 ) { 3782 3783 if(!IS_JDK9_TEST) { 3784 return 3785 } 3786 3787 p.configurations { 3788 jdk9test 3789 } 3790 3791 p.dependencies { 3792 jdk9test group: "junit", name: "junit", version: "4.8.2" 3793 } 3794 3795 compileTargets { t -> 3796 3797 def targetProperties = project.rootProject.ext[t.upper] 3798 3799 def modularSdkDirName = "${targetProperties.platformPrefix}modular-sdk" 3800 def modularSdkDir = "${rootProject.buildDir}/${modularSdkDirName}" 3801 def modulesDir = "${modularSdkDir}/modules" 3802 3803 boolean useModule = true 3804 String moduleName 3805 if(!p.hasProperty('moduleName')) { 3806 useModule = false 3807 moduleName = "systemTests" 3808 } else { 3809 moduleName = p.moduleName 3810 } 3811 3812 logger.info("configuring $p.name for modular test copy"); 3813 3814 def testingDir = "${rootProject.buildDir}/${targetProperties.platformPrefix}testing"; 3815 def patchesDir = new File("${testingDir}/modules"); 3816 File patchPolicyFile = new File("${testingDir}/java.patch.policy"); 3817 3818 String javaLibraryPath = "${rootProject.buildDir}/sdk/$targetProperties.libDest" 3819 3820 def jdk9patchesBaseDir = new File("${testingDir}/modules/$moduleName"); 3821 def jdk9patchesTestDir = new File("${testingDir}/tests/$moduleName"); 3822 3823 p.files(patchPolicyFile); 3824 3825 def srcClassesDir = "${p.buildDir}/${targetProperties.platformPrefix}module-classes" 3826 Task classes = p.task("jdk9CopyClasses${t.capital}", type: Copy, dependsOn: [p.classes]) { 3827 3828 enabled = useModule 3829 3830 from srcClassesDir 3831 into jdk9patchesBaseDir 3832 } 3833 3834 Task shims = p.task("jdk9CopyShims${t.capital}", type: Copy, dependsOn: [p.testClasses]) { 3835 //from p.sourceSets.test.output.classesDir 3836 3837 enabled = useModule 3838 3839 from p.sourceSets.test.output 3840 into jdk9patchesBaseDir 3841 if (patchInc != null) { 3842 include patchInc 3843 } else { 3844 include "**/*" 3845 } 3846 if (testsInc != null) { 3847 exclude testsInc 3848 } 3849 includeEmptyDirs = false 3850 doLast() { 3851 logger.info("project $p.name finished jdk9CopyShims to $jdk9patchesBaseDir"); 3852 } 3853 } 3854 3855 Task alltests = p.task("jdk9CopyTests${t.capital}", type: Copy, dependsOn: [p.testClasses]) { 3856 from p.sourceSets.test.output 3857 into jdk9patchesTestDir 3858 if (patchInc != null) { 3859 exclude patchInc 3860 } 3861 if (testsInc != null) { 3862 include testsInc 3863 } else { 3864 include "**/*" 3865 } 3866 includeEmptyDirs = false 3867 doLast() { 3868 logger.info("project $p.name finished jdk9CopyTests to $jdk9patchesTestDir"); 3869 } 3870 } 3871 3872 // create & use just one of these per platform 3873 String nameis = "moduleTestPatchPolicy${t.capital}" 3874 Task patchPerms = null 3875 if (rootProject.hasProperty(nameis)) { 3876 patchPerms = rootProject.tasks[nameis] 3877 } else { 3878 patchPerms = rootProject.task(nameis) { 3879 outputs.file(patchPolicyFile) 3880 doLast() { 3881 logger.info("Creating test patch.policy file ${patchPolicyFile}") 3882 3883 delete(patchPolicyFile) 3884 mkdir(testingDir) 3885 3886 [ "base", "graphics", "controls", "fxml", "swing", "web", ].each { mn -> 3887 String themod = file("${patchesDir}/javafx.${mn}").toURI() 3888 patchPolicyFile << "grant codeBase \"${themod}\" {\n" + 3889 " permission java.security.AllPermission;\n" + 3890 "};\n" 3891 } 3892 } 3893 } 3894 } 3895 3896 Task jdk9testsTask = p.task("jdk9tests${t.capital}", dependsOn: [classes, shims, alltests, patchPerms ]) { 3897 doLast() { 3898 logger.info("project $p.name finished jdk9tests${t.capital}"); 3899 } 3900 } 3901 3902 FileCollection testclasspath = p.files(p.configurations.jdk9test) 3903 3904 p.test.dependsOn jdk9testsTask 3905 3906 if (moduleDeps != null) { 3907 moduleDeps.each() {s-> 3908 logger.info("adding dep to project $p.name $s"); 3909 Project pdep = rootProject.project(s); 3910 def jdk9Task = pdep.tasks.getByName("jdk9tests${t.capital}"); 3911 jdk9testsTask.dependsOn jdk9Task; 3912 3913 testclasspath += p.files(pdep.ext.jdk9patchesTestDir); 3914 } 3915 } 3916 3917 testclasspath += p.files(jdk9patchesTestDir); 3918 3919 p.ext.jdk9testClasspath = testclasspath 3920 p.ext.jdk9patchesTestDir = jdk9patchesTestDir 3921 p.ext.jdk9testClasses = jdk9testsTask 3922 3923 p.ext.argclasspathFile = "$testingDir/classpath_"+p.name+".txt" 3924 3925 p.test { 3926 if (IS_FORCE_TESTS) { 3927 dependsOn 'cleanTest' 3928 } 3929 3930 scanForTestClasses = false 3931 include("**/*Test.*") 3932 3933 if (IS_JDK9_TEST) { 3934 dependsOn jdk9testsTask 3935 3936 doFirst { 3937 classpath = testclasspath 3938 p.sourceSets.test.runtimeClasspath = testclasspath 3939 } 3940 3941 String bcp = "-Xbootclasspath/a:" + rootProject.projectDir.path + "/buildSrc/build/libs/buildSrc.jar" 3942 3943 systemProperties 'worker.debug': false 3944 systemProperties 'worker.library.path': cygpath(javaLibraryPath) 3945 systemProperties 'worker.xpatch.dir': cygpath(patchesDir.path) 3946 if (addExportsFile != null) { 3947 systemProperties 'worker.exports.file': cygpath(addExportsFile) 3948 } 3949 systemProperties 'worker.classpath.file': cygpath(p.ext.argclasspathFile) 3950 systemProperties 'worker.java.cmd': JAVA9 3951 3952 systemProperties 'worker.isJDK9': true 3953 3954 systemProperties 'worker.patch.policy': cygpath(patchPolicyFile.path) 3955 3956 //systemProperties 'prism.order': 'sw' 3957 //systemProperties 'glass.platform': 'Monocle' 3958 //systemProperties
'glass.len': 'headless' 3959 3960 jvmArgs bcp, "workaround.GradleJUnitWorker" 3961 3962 environment("JDK_HOME", JDK9_HOME); 3963 executable (JAVA9); 3964 3965 } 3966 } 3967 3968 } 3969 3970 } 3971 3972 task checkrepo() { 3973 doLast { 3974 logger.info("checking for whitespace (open)"); |