< prev index next >

./build.gradle

Print this page
rev 9572 : 8146692: Correct Jake test configuration for cross builds
Reviewed-by: kcr


3736 void configureJDK9tests(
3737         Project p,
3738         List<String> moduleDeps,
3739         Set<String> patchInc,
3740         Set<String> testsInc,
3741         String addExportsFile
3742         ) {
3743 
3744     if(!IS_JDK9_TEST) { 
3745         return
3746     }
3747 
3748     p.configurations {
3749         jdk9test
3750     }
3751 
3752     p.dependencies {
3753         jdk9test group: "junit", name: "junit", version: "4.8.2"
3754     }
3755 
3756     String upper = defaultHostTarget.trim().toUpperCase(Locale.ROOT)
3757     def targetProperties = project.rootProject.ext[upper]
3758 
3759     // TBD using host - ?
3760     def platformPrefix = ""
3761    
3762     def modularSdkDirName = "${platformPrefix}modular-sdk"
3763     def modularSdkDir = "${rootProject.buildDir}/${modularSdkDirName}"
3764     def modulesDir = "${modularSdkDir}/modules"
3765 
3766     logger.info("configuring $p.name for test copy");
3767 
3768     def testingDir = "${rootProject.buildDir}/${platformPrefix}testing";
3769     def patchesDir = new File("${testingDir}/modules");
3770     String javaLibraryPath = "${rootProject.buildDir}/sdk/$targetProperties.libDest"
3771 
3772     def jdk9patchesBaseDir = new File("${testingDir}/modules/$p.moduleName");
3773     def jdk9patchesTestDir = new File("${testingDir}/tests/$p.moduleName");
3774 
3775     def srcClassesDir = "${p.buildDir}/${platformPrefix}module-classes"
3776     Task classes =  p.task("jdk9CopyClasses", type: Copy, dependsOn: [p.classes]) {
3777         from srcClassesDir
3778         into jdk9patchesBaseDir
3779     }
3780 
3781     Task shims =  p.task("jdk9CopyShims", type: Copy, dependsOn: [p.testClasses]) {
3782         //from p.sourceSets.test.output.classesDir
3783         from p.sourceSets.test.output
3784         into jdk9patchesBaseDir
3785         if (patchInc != null) {
3786             include patchInc
3787         } else {
3788             include "**/*"
3789         }
3790         if (testsInc != null) {
3791             exclude testsInc
3792         }
3793         includeEmptyDirs = false
3794         doLast() {
3795             logger.info("project $p.name finished jdk9CopyShims to $jdk9patchesBaseDir");
3796         }
3797     }
3798 
3799     Task tests =  p.task("jdk9CopyTests", type: Copy, dependsOn: [p.testClasses]) {
3800         //from p.sourceSets.test.output.classesDir
3801         from p.sourceSets.test.output
3802         into jdk9patchesTestDir
3803         if (patchInc != null) {
3804             exclude patchInc
3805         }
3806         if (testsInc != null) {
3807             include testsInc
3808         } else {
3809             include "**/*"
3810         }
3811         includeEmptyDirs = false
3812         doLast() {
3813             logger.info("project $p.name finished jdk9CopyTests to $jdk9patchesTestDir");
3814         }
3815     }
3816 
3817     Task jdk9testsTask =  p.task("jdk9tests", dependsOn: [classes, shims, tests]) {
3818         doLast() {
3819             logger.info("project $p.name finished jdk9testsTask");
3820         }
3821     }
3822 
3823     // not found ?
3824     //buildModulesTests.dependsOn(jdk9testsTask);
3825 
3826     FileCollection testclasspath = p.files(p.configurations.jdk9test)
3827 
3828     p.test.dependsOn jdk9testsTask
3829 
3830     if (moduleDeps != null) {
3831         moduleDeps.each() {s->
3832         logger.info("adding dep to project $p.name $s");
3833             Project pdep = rootProject.project(s);
3834             jdk9testsTask.dependsOn pdep.jdk9testClasses
3835 
3836             testclasspath += p.files(pdep.ext.jdk9patchesTestDir);
3837         }
3838     }
3839 


3865 
3866             systemProperties 'worker.debug': true //DAVE
3867             systemProperties 'worker.library.path': javaLibraryPath
3868             systemProperties 'worker.xpatch.dir': patchesDir.path
3869             systemProperties 'worker.exports.file': addExportsFile
3870             systemProperties 'worker.classpath.file': p.ext.argclasspathFile
3871             systemProperties 'worker.java9': JAVA9
3872 
3873             //systemProperties 'prism.order': 'sw'
3874             //systemProperties 'glass.platform': 'Monocle'
3875             //systemProperties
'glass.len': 'headless'
3876 
3877             jvmArgs bcp, "workaround.GradleJUnitWorker"
3878 
3879             environment("JDK_HOME", JDK9_HOME);
3880             executable (JAVA9);
3881 
3882           }
3883     }
3884 


3885 }
3886 
3887 
3888 /******************************************************************************
3889  *                                                                            *
3890  *                              BUILD_CLOSED                                  *
3891  *                                                                            *
3892  * This next section should remain at the end of the build script. It allows  *
3893  * for a "supplemental" gradle file to be used to extend the normal build     *
3894  * structure. For example, this is used for passing a supplemental gradle     *
3895  * file for producing official JavaFX builds.                                 *
3896  *                                                                            *
3897  *****************************************************************************/
3898 
3899 if (BUILD_CLOSED) {
3900     apply from: supplementalBuildFile
3901 }
3902 
3903 task showFlags {
3904 }
3905 
3906 compileTargets { t ->
3907     // Every platform must define these variables
3908     def props = project.ext[t.upper];
3909     showFlags.dependsOn(
3910         project.task("showFlags$t.upper") {
3911             doLast() {
3912                 println "Properties set for $t.upper"
3913                 props.each { println it }
3914             }
3915         }
3916     )

3917 }


3736 void configureJDK9tests(
3737         Project p,
3738         List<String> moduleDeps,
3739         Set<String> patchInc,
3740         Set<String> testsInc,
3741         String addExportsFile
3742         ) {
3743 
3744     if(!IS_JDK9_TEST) { 
3745         return
3746     }
3747 
3748     p.configurations {
3749         jdk9test
3750     }
3751 
3752     p.dependencies {
3753         jdk9test group: "junit", name: "junit", version: "4.8.2"
3754     }
3755 
3756     compileTargets { t ->

3757 
3758         def targetProperties = project.rootProject.ext[t.upper]

3759 
3760         def modularSdkDirName = "${targetProperties.platformPrefix}modular-sdk"
3761         def modularSdkDir = "${rootProject.buildDir}/${modularSdkDirName}"
3762         def modulesDir = "${modularSdkDir}/modules"
3763 
3764         logger.info("configuring $p.name for modular test copy");
3765 
3766         def testingDir = "${rootProject.buildDir}/${targetProperties.platformPrefix}testing";
3767         def patchesDir = new File("${testingDir}/modules");
3768         String javaLibraryPath = "${rootProject.buildDir}/sdk/$targetProperties.libDest"
3769 
3770         def jdk9patchesBaseDir = new File("${testingDir}/modules/$p.moduleName");
3771         def jdk9patchesTestDir = new File("${testingDir}/tests/$p.moduleName");
3772 
3773         def srcClassesDir = "${p.buildDir}/${targetProperties.platformPrefix}module-classes"
3774         Task classes =  p.task("jdk9CopyClasses${t.capital}", type: Copy, dependsOn: [p.classes]) {
3775             from srcClassesDir
3776             into jdk9patchesBaseDir
3777         }
3778 
3779         Task shims =  p.task("jdk9CopyShims${t.capital}", type: Copy, dependsOn: [p.testClasses]) {
3780             //from p.sourceSets.test.output.classesDir
3781             from p.sourceSets.test.output
3782             into jdk9patchesBaseDir
3783             if (patchInc != null) {
3784                 include patchInc
3785             } else {
3786                 include "**/*"
3787             }
3788             if (testsInc != null) {
3789                 exclude testsInc
3790             }
3791             includeEmptyDirs = false
3792             doLast() {
3793                 logger.info("project $p.name finished jdk9CopyShims to $jdk9patchesBaseDir");
3794             }
3795         }
3796 
3797         Task tests =  p.task("jdk9CopyTests${t.capital}", type: Copy, dependsOn: [p.testClasses]) {
3798             //from p.sourceSets.test.output.classesDir
3799             from p.sourceSets.test.output
3800             into jdk9patchesTestDir
3801             if (patchInc != null) {
3802                 exclude patchInc
3803             }
3804             if (testsInc != null) {
3805                 include testsInc
3806             } else {
3807                 include "**/*"
3808             }
3809             includeEmptyDirs = false
3810             doLast() {
3811                 logger.info("project $p.name finished jdk9CopyTests to $jdk9patchesTestDir");
3812             }
3813         }
3814 
3815         Task jdk9testsTask =  p.task("jdk9tests${t.capital}", dependsOn: [classes, shims, tests]) {
3816             doLast() {
3817                 logger.info("project $p.name finished jdk9tests${t.capital}");
3818             }
3819         }
3820 
3821         // not found ?
3822         //buildModulesTests.dependsOn(jdk9testsTask);
3823 
3824         FileCollection testclasspath = p.files(p.configurations.jdk9test)
3825 
3826         p.test.dependsOn jdk9testsTask
3827 
3828         if (moduleDeps != null) {
3829             moduleDeps.each() {s->
3830             logger.info("adding dep to project $p.name $s");
3831                 Project pdep = rootProject.project(s);
3832                 jdk9testsTask.dependsOn pdep.jdk9testClasses
3833 
3834                 testclasspath += p.files(pdep.ext.jdk9patchesTestDir);
3835             }
3836         }
3837 


3863 
3864                 systemProperties 'worker.debug': true //DAVE
3865                 systemProperties 'worker.library.path': javaLibraryPath
3866                 systemProperties 'worker.xpatch.dir': patchesDir.path
3867                 systemProperties 'worker.exports.file': addExportsFile
3868                 systemProperties 'worker.classpath.file': p.ext.argclasspathFile
3869                 systemProperties 'worker.java9': JAVA9
3870 
3871                 //systemProperties 'prism.order': 'sw'
3872                 //systemProperties 'glass.platform': 'Monocle'
3873                 //systemProperties
'glass.len': 'headless'
3874 
3875                 jvmArgs bcp, "workaround.GradleJUnitWorker"
3876 
3877                 environment("JDK_HOME", JDK9_HOME);
3878                 executable (JAVA9);
3879 
3880               }
3881         }
3882 
3883     }
3884 
3885 }
3886 
3887 
3888 /******************************************************************************
3889  *                                                                            *
3890  *                              BUILD_CLOSED                                  *
3891  *                                                                            *
3892  * This next section should remain at the end of the build script. It allows  *
3893  * for a "supplemental" gradle file to be used to extend the normal build     *
3894  * structure. For example, this is used for passing a supplemental gradle     *
3895  * file for producing official JavaFX builds.                                 *
3896  *                                                                            *
3897  *****************************************************************************/
3898 
3899 if (BUILD_CLOSED) {
3900     apply from: supplementalBuildFile
3901 }
3902 
3903 task showFlags {
3904 }
3905 
3906 compileTargets { t ->
3907     // Every platform must define these variables
3908     def props = project.ext[t.upper];
3909     showFlags.dependsOn(
3910         project.task("showFlags$t.upper") {
3911             doLast() {
3912                 println "Properties set for $t.upper"
3913                 props.each { println it }
3914             }
3915         }
3916     )
3917 
3918 }
< prev index next >