< prev index next >
./build.gradle
Print this page
rev 10911 : 8198329: Support FX build / test using JDK that doesn't include javafx.* modules
Reviewed-by:
*** 344,376 ****
defineProperty("libAVRepositoryURL", "https://libav.org/releases/")
defineProperty("FFmpegRepositoryURL", "https://www.ffmpeg.org/releases/")
loadProperties("$projectDir/build.properties")
- // Look for stub runtime in either JDK or modular-sdk dir layout
-
- def String closedCacheStubRuntime = cygpath("$projectDir") + "/../caches/modular-sdk"
-
- def String jdkStubRuntime = cygpath("$JDK_HOME")
-
- defineProperty("STUB_RUNTIME", BUILD_CLOSED ? closedCacheStubRuntime : jdkStubRuntime)
-
- def cachedStub = STUB_RUNTIME.equals(closedCacheStubRuntime)
-
- if (cachedStub) {
- def stubModulesLib = "$STUB_RUNTIME/modules_libs"
- defineProperty("MEDIA_STUB", "$stubModulesLib/javafx.media")
- defineProperty("WEB_STUB", "$stubModulesLib/javafx.web")
- } else {
- def libraryStub = IS_WINDOWS ? "$STUB_RUNTIME/bin" : "$STUB_RUNTIME/lib"
-
- defineProperty("MEDIA_STUB", libraryStub)
- defineProperty("WEB_STUB", libraryStub)
- }
-
- defineProperty("UPDATE_STUB_CACHE", (cachedStub ? 'true' : 'false'))
-
def supplementalPreBuildFile = file("$closedDir/closed-pre-build.gradle");
def supplementalBuildFile = file("$closedDir/closed-build.gradle");
if (BUILD_CLOSED) {
apply from: supplementalPreBuildFile
--- 344,353 ----
*** 594,603 ****
--- 571,636 ----
// when running with DO_BUILD_SDK_FOR_TEST=false as they're unneeded for running tests
if (!DO_BUILD_SDK_FOR_TEST) {
gradle.taskGraph.useFilter({ task -> !task.name.equals("classes") && !task.name.equals("jar") })
}
+ // Make sure JDK_HOME/bin/java exists
+ if (!file(JAVA).exists()) throw new Exception("Missing or incorrect path to 'java': '$JAVA'. Perhaps bad JDK_HOME? $JDK_HOME")
+ if (!file(JAVAC).exists()) throw new Exception("Missing or incorrect path to 'javac': '$JAVAC'. Perhaps bad JDK_HOME? $JDK_HOME")
+ if (!file(JAVADOC).exists()) throw new Exception("Missing or incorrect path to 'javadoc': '$JAVADOC'. Perhaps bad JDK_HOME? $JDK_HOME")
+
+ // Determine the verion of Java in JDK_HOME. It looks like this:
+ //
+ // $ java -version
+ // java version "1.7.0_45"
+ // Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
+ // Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
+ //
+ // We need to parse the second line
+ def inStream = new java.io.BufferedReader(new java.io.InputStreamReader(new java.lang.ProcessBuilder(JAVA, "-fullversion").start().getErrorStream()));
+ try {
+ String v = inStream.readLine().trim();
+ if (v != null) {
+ int ib = v.indexOf("full version \"");
+ if (ib != -1) {
+ String str = v.substring(ib);
+ String ver = str.substring(str.indexOf("\"") + 1, str.size() - 1);
+
+ defineProperty("jdkRuntimeVersion", ver)
+ def jdkVersionInfo = parseJavaVersion(ver)
+ defineProperty("jdkVersion", jdkVersionInfo[0])
+ defineProperty("jdkBuildNumber", jdkVersionInfo[1])
+ }
+ }
+ } finally {
+ inStream.close();
+ }
+ if (!project.hasProperty("jdkRuntimeVersion")) throw new Exception("Unable to determine the version of Java in JDK_HOME at $JDK_HOME");
+
+
+ // Determine whether the javafx.* modules are present in the JDK. To do this,
+ // we will execute "java --list-modules" and search for javafx.base
+ ext.HAS_JAVAFX_MODULES = false;
+ def inStream2 = new java.io.BufferedReader(new java.io.InputStreamReader(new java.lang.ProcessBuilder(JAVA, "--list-modules").start().getInputStream()));
+ try {
+ String v;
+ while ((v = inStream2.readLine()) != null) {
+ v = v.trim();
+ if (v.startsWith("javafx.base")) ext.HAS_JAVAFX_MODULES = true;
+ }
+ } finally {
+ inStream2.close();
+ }
+
+ // The HAS_JAVAFX_MODULES flag will be used to determine the mode for building
+ // and running the applications and tests.
+ // If HAS_JAVAFX_MODULES is true, then we will build / test javafx modules
+ // for exporting to a JDK build. If HAS_JAVAFX_MODULES is false, then we will
+ // build / test a standalone sdk for running with a JDK that does not include
+ // the javafx modules.
+
+
/**
* Fetch/Check that external tools are present for the build. This method
* will conditionally download the packages from project defined ivy repositories
* and unpack them into the specified destdir
*
*** 755,784 ****
}
}
List<String> computeLibraryPath(boolean working) {
List<String> lp = []
List<String> modsWithNative = [ 'graphics', 'media', 'web' ]
// the build/modular-sdk area
def platformPrefix = ""
! def modularSdkDirName = "${platformPrefix}modular-sdk"
! def modularSdkDir = "${rootProject.buildDir}/${modularSdkDirName}"
! def modulesLibsDir = "${modularSdkDir}/modules_libs"
modsWithNative.each() { m ->
lp << cygpath("${modulesLibsDir}/javafx.${m}")
}
return lp
}
! // Return list with the arguments needed for --patch-module for the provided projects
! // used with Java executables ie. tests
List<String> computePatchModuleArgs(List<String> deps, boolean test, boolean includeJLP) {
List<String> pma = []
! deps.each {String projname ->
def proj = project(projname)
if (proj.hasProperty("moduleName")) {
File dir;
if (test && proj.sourceSets.hasProperty('shims')) {
dir = file("${rootProject.buildDir}/shims")
--- 788,829 ----
}
}
List<String> computeLibraryPath(boolean working) {
List<String> lp = []
+
+ if (HAS_JAVAFX_MODULES) {
List<String> modsWithNative = [ 'graphics', 'media', 'web' ]
// the build/modular-sdk area
def platformPrefix = ""
! def bundledSdkDirName = "${platformPrefix}modular-sdk"
! def bundledSdkDir = "${rootProject.buildDir}/${bundledSdkDirName}"
! def modulesLibsDir = "${bundledSdkDir}/modules_libs"
modsWithNative.each() { m ->
lp << cygpath("${modulesLibsDir}/javafx.${m}")
}
+ } else {
+ def platformPrefix = ""
+ def standaloneSdkDirName = "${platformPrefix}sdk"
+ def standaloneSdkDir = "${rootProject.buildDir}/${standaloneSdkDirName}"
+ def modulesLibName = IS_WINDOWS ? "bin" : "lib"
+ def modulesLibsDir = "${standaloneSdkDir}/${modulesLibName}"
+ lp << cygpath("${modulesLibsDir}")
+ }
+
return lp
}
! // Return list with the arguments needed for --patch-module or --module-path
! // for the provided projects. Used with Java executables ie. tests
List<String> computePatchModuleArgs(List<String> deps, boolean test, boolean includeJLP) {
List<String> pma = []
! if (HAS_JAVAFX_MODULES) {
! deps.each { String projname ->
def proj = project(projname)
if (proj.hasProperty("moduleName")) {
File dir;
if (test && proj.sourceSets.hasProperty('shims')) {
dir = file("${rootProject.buildDir}/shims")
*** 788,818 ****
String moduleName = proj.ext.moduleName
String dirpath = cygpath("${dir}/${moduleName}")
pma += "--patch-module=${moduleName}=${dirpath}"
}
}
if (includeJLP) {
pma += "-Djava.library.path=" + computeLibraryPath(true).join(File.pathSeparator)
}
return pma
}
! // Return a list containing the --upgrade-module-path
// used with Javac
List<String> computeModulePathArgs(String pname, List<String> deps, boolean test) {
! List<String> mpa = [ '--upgrade-module-path' ]
String mp = null
! deps.each {String projname ->
def proj = project(projname)
// for a non test set of args, we don't want the current module in the list
// for a test test, we do need it to update what we built
if (proj.hasProperty("moduleName") &&
proj.buildModule &&
!(!test && proj.name.equals(pname))) {
File dir;
if (test && proj.sourceSets.hasProperty('shims')) {
dir = new File(proj.sourceSets.shims.java.outputDir, proj.ext.moduleName);
} else {
dir = new File(proj.sourceSets.main.java.outputDir, proj.ext.moduleName);
--- 833,908 ----
String moduleName = proj.ext.moduleName
String dirpath = cygpath("${dir}/${moduleName}")
pma += "--patch-module=${moduleName}=${dirpath}"
}
}
+ } else {
+ String mp = null
+ deps.each { String projname ->
+ def proj = project(projname)
+ if (proj.hasProperty("moduleName")) {
+ String moduleName = proj.ext.moduleName
+ File dir;
+ if (test && proj.sourceSets.hasProperty('shims')) {
+ dir = file("${rootProject.buildDir}/shims/${moduleName}")
+ } else {
+ dir = file("${rootProject.buildDir}/sdk/lib/${moduleName}.jar")
+ }
+ if (mp == null) {
+ mp = dir.path
+ } else {
+ mp = mp + File.pathSeparator + dir.path
+ }
+ }
+ }
+
+ // in some cases like base we could end up with an empty
+ // path... make sure we don't pass one back
+ if (mp == null) {
+ return null
+ }
+
+ pma += '--module-path'
+ pma += mp
+
+ String addm = null
+ deps.each {String projname ->
+ def proj = project(projname)
+ if (proj.hasProperty("moduleName") && proj.buildModule) {
+ if (addm == null) {
+ addm = proj.moduleName
+ } else {
+ addm = addm + "," + proj.moduleName
+ }
+ }
+ }
+ if (addm != null) {
+ pma += "--add-modules=${addm}"
+ }
+ }
if (includeJLP) {
pma += "-Djava.library.path=" + computeLibraryPath(true).join(File.pathSeparator)
}
return pma
}
! // Return a list containing the --upgrade-module-path or --module-path
// used with Javac
List<String> computeModulePathArgs(String pname, List<String> deps, boolean test) {
! List<String> mpa = HAS_JAVAFX_MODULES ? [ '--upgrade-module-path' ] : [ '--module-path' ]
String mp = null
! deps.each { String projname ->
def proj = project(projname)
// for a non test set of args, we don't want the current module in the list
// for a test test, we do need it to update what we built
if (proj.hasProperty("moduleName") &&
proj.buildModule &&
!(!test && proj.name.equals(pname))) {
+
File dir;
if (test && proj.sourceSets.hasProperty('shims')) {
dir = new File(proj.sourceSets.shims.java.outputDir, proj.ext.moduleName);
} else {
dir = new File(proj.sourceSets.main.java.outputDir, proj.ext.moduleName);
*** 830,844 ****
if (mp == null) {
return null
}
mpa += mp
return mpa
}
! void writeRunArgsFile(File dest, List<String> libpath, List<String> modpath) {
dest.delete()
logger.info("Creating file ${dest.path}")
--- 920,958 ----
if (mp == null) {
return null
}
mpa += mp
+
+ if (!HAS_JAVAFX_MODULES) {
+ String addm = null
+ deps.each {String projname ->
+ def proj = project(projname)
+ // for a non test set of args, we don't want the current module in the list
+ // for a test test, we do need it to update what we built
+
+ if (proj.hasProperty("moduleName") &&
+ proj.buildModule &&
+ !(!test && proj.name.equals(pname))) {
+
+ if (addm == null) {
+ addm = proj.moduleName
+ } else {
+ addm = addm + "," + proj.moduleName
+ }
+ }
+ }
+ if (addm != null) {
+ mpa += "--add-modules=${addm}"
+ }
+ }
+
return mpa
}
! void writeRunArgsFile(File dest, List<String> libpath, List<String> modpath, List<String> modules) {
dest.delete()
logger.info("Creating file ${dest.path}")
*** 851,870 ****
--- 965,1028 ----
dest << "\\\n"
}
dest << " \"\n"
}
+ if (HAS_JAVAFX_MODULES) {
modpath.each { e ->
dest << "--patch-module=\""
dest << e
dest << "\"\n"
}
+ } else {
+ if (modpath.size() == 1) {
+ dest << "--module-path=\""
+ dest << modpath[0]
+ dest << "\"\n"
+ } else {
+ dest << "--module-path=\"\\\n"
+ modpath.each() { e->
+ dest << " "
+ dest << e
+ dest << File.pathSeparator
+ dest << "\\\n"
+ }
+ dest << " \"\n"
+ }
+ }
+
+ if (modules != null) {
+ dest << "--add-modules="
+ dest << modules.join(",")
+ dest << "\n"
+ }
+ }
+
+ void appendQualExports(File dest, List<String> qualExports) {
+ qualExports.each { exp ->
+ dest << exp
+ dest << "\n"
+ }
+ }
+
+ // TODO KCR: remove this before final webrev
+ void printArgs(String msg, List<String> val) {
+ println ""
+ println msg
+ val.each { s ->
+ println " $s"
+ }
}
// perform common project manipulation for modules
void commonModuleSetup(Project p, List<String> moduleChain) {
+ println ""
+ println "---------------------------------------------------"
+ println "$p"
+ println ""
+
p.ext.moduleChain = moduleChain
if (p.hasProperty("moduleName")) {
p.ext.moduleDir = new File (p.sourceSets.main.java.outputDir, "${p.moduleName}")
if (p.sourceSets.hasProperty('shims')) {
*** 873,888 ****
--- 1031,1053 ----
}
def mpa = computeModulePathArgs(p.name, moduleChain, false)
if (mpa != null) {
p.ext.modulePathArgs = mpa
+ printArgs("modulePathArgs", p.ext.modulePathArgs);
+ } else {
+ println("modulePathArgs = null")
}
p.ext.testModulePathArgs = computePatchModuleArgs(moduleChain, true, false)
p.ext.patchModuleArgs = computePatchModuleArgs(moduleChain ,false, true)
p.ext.testPatchModuleArgs = computePatchModuleArgs(moduleChain, true, true)
+ printArgs("testModulePathArgs", p.ext.testModulePathArgs);
+ printArgs("patchModuleArgs", p.ext.patchModuleArgs);
+ printArgs("testPatchModuleArgs", p.ext.testPatchModuleArgs);
+
moduleChain.each() {e ->
if (!e.equals(p.name)) {
p.compileJava.dependsOn(project(e).classes)
p.compileTestJava.dependsOn(project(e).testClasses)
}
*** 934,950 ****
--- 1099,1117 ----
rootProject.ext.EXTRA_ADDEXPORTS_STRING = fullae
}
rootProject.ext.EXTRA_ADDEXPORTS_ARGS = extraAddExportsList
}
+ if (HAS_JAVAFX_MODULES) {
// use this variable, because it shows we have a non empty addition
if (rootProject.hasProperty("EXTRA_ADDEXPORTS_STRING")) {
p.ext.extraAddExports = EXTRA_ADDEXPORTS_ARGS.flatten()
if (p.hasProperty("testAddExports")) {
p.testAddExports += EXTRA_ADDEXPORTS_ARGS.flatten()
}
}
+ }
}
// Now we need to define the native compilation tasks. The set of parameters to
// native compilation depends on the target platform (and also to some extent what platform
// you are compiling on). These settings are contained in various gradle files
*** 1005,1015 ****
compileTargets { t ->
def targetProperties = project.rootProject.ext[t.upper]
if (targetProperties.compileSwing) COMPILE_SWING = true
if (targetProperties.compileSWT) COMPILE_SWT = true
! if (IS_BUILD_FXPACKAGER && targetProperties.compileFXPackager) COMPILE_FXPACKAGER = true
if (!targetProperties.containsKey('compileWebnodeNative')) {
// unless specified otherwise, we will compile native Webnode if IS_COMPILE_WEBKIT
targetProperties.compileWebnodeNative = true
}
--- 1172,1182 ----
compileTargets { t ->
def targetProperties = project.rootProject.ext[t.upper]
if (targetProperties.compileSwing) COMPILE_SWING = true
if (targetProperties.compileSWT) COMPILE_SWT = true
! if (IS_BUILD_FXPACKAGER && HAS_JAVAFX_MODULES && targetProperties.compileFXPackager) COMPILE_FXPACKAGER = true
if (!targetProperties.containsKey('compileWebnodeNative')) {
// unless specified otherwise, we will compile native Webnode if IS_COMPILE_WEBKIT
targetProperties.compileWebnodeNative = true
}
*** 1054,1111 ****
// Sanity check that we actually have a list of compile targets to execute
if (COMPILE_TARGETS == null || COMPILE_TARGETS == "") {
throw new Exception("Unable to determine compilation platform, must specify valid COMPILE_TARGETS!")
}
- // Make sure JDK_HOME/bin/java exists
- if (!file(JAVA).exists()) throw new Exception("Missing or incorrect path to 'java': '$JAVA'. Perhaps bad JDK_HOME? $JDK_HOME")
- if (!file(JAVAC).exists()) throw new Exception("Missing or incorrect path to 'javac': '$JAVAC'. Perhaps bad JDK_HOME? $JDK_HOME")
- if (!file(JAVADOC).exists()) throw new Exception("Missing or incorrect path to 'javadoc': '$JAVADOC'. Perhaps bad JDK_HOME? $JDK_HOME")
-
- // Determine the verion of Java in JDK_HOME. It looks like this:
- //
- // $ java -version
- // java version "1.7.0_45"
- // Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
- // Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
- //
- // We need to parse the second line
- def inStream = new java.io.BufferedReader(new java.io.InputStreamReader(new java.lang.ProcessBuilder(JAVA, "-fullversion").start().getErrorStream()));
- try {
- String v = inStream.readLine().trim();
- if (v != null) {
- int ib = v.indexOf("full version \"");
- if (ib != -1) {
- String str = v.substring(ib);
- String ver = str.substring(str.indexOf("\"") + 1, str.size() - 1);
-
- defineProperty("jdkRuntimeVersion", ver)
- def jdkVersionInfo = parseJavaVersion(ver)
- defineProperty("jdkVersion", jdkVersionInfo[0])
- defineProperty("jdkBuildNumber", jdkVersionInfo[1])
- }
- }
- } finally {
- inStream.close();
- }
- if (!project.hasProperty("jdkRuntimeVersion")) throw new Exception("Unable to determine the version of Java in JDK_HOME at $JDK_HOME");
-
-
- // Determine whether the javafx.* modules are present in the JDK. To do this,
- // we will execute "java --list-modules" and search for javafx.base
- ext.HAS_JAVAFX_MODULES = false;
- def inStream2 = new java.io.BufferedReader(new java.io.InputStreamReader(new java.lang.ProcessBuilder(JAVA, "--list-modules").start().getInputStream()));
- try {
- String v;
- while ((v = inStream2.readLine()) != null) {
- v = v.trim();
- if (v.startsWith("javafx.base")) ext.HAS_JAVAFX_MODULES = true;
- }
- } finally {
- inStream2.close();
- }
-
// Verify that CONF is something useful
if (CONF != "Release" && CONF != "Debug" && CONF != "DebugNative") {
logger.warn("Unknown configuration CONF='$CONF'. Treating as 'Release'")
}
--- 1221,1230 ----
*** 1135,1144 ****
--- 1254,1296 ----
logger.warn("Only version 4.3 is supported. Use this version at your own risk");
if ( err != "") logger.warn(err);
logger.warn("*****************************************************************");
}
+ // Look for stub runtime in bundled sdk, standalone sdk, or boot JDK
+
+ def String cachedBundledRuntime = cygpath("$projectDir") + "/../caches/modular-sdk"
+ def String cachedStandaloneRuntime = cygpath("$projectDir") + "/../caches/sdk"
+ def String jdkStubRuntime = cygpath("$JDK_HOME")
+
+ def defaultStubRuntime = ""
+ if (file(cachedBundledRuntime).exists()) {
+ defaultStubRuntime = cachedBundledRuntime
+ } else if (file(cachedStandaloneRuntime).exists()) {
+ defaultStubRuntime = cachedStandaloneRuntime
+ } else if (BUILD_CLOSED) {
+ defaultStubRuntime = cachedBundledRuntime
+ } else {
+ defaultStubRuntime = jdkStubRuntime
+ }
+
+ defineProperty("STUB_RUNTIME", defaultStubRuntime)
+
+ if (STUB_RUNTIME.endsWith("/modular-sdk")) {
+ def stubModulesLib = "$STUB_RUNTIME/modules_libs"
+ defineProperty("MEDIA_STUB", "$stubModulesLib/javafx.media")
+ defineProperty("WEB_STUB", "$stubModulesLib/javafx.web")
+ } else {
+ def libraryStub = IS_WINDOWS ? "$STUB_RUNTIME/bin" : "$STUB_RUNTIME/lib"
+
+ defineProperty("MEDIA_STUB", libraryStub)
+ defineProperty("WEB_STUB", libraryStub)
+ }
+
+ ext.UPDATE_STUB_CACHE = (BUILD_CLOSED && STUB_RUNTIME != "" && !file(STUB_RUNTIME).isDirectory())
+
+
/******************************************************************************
* *
* Logging of Properties and Settings *
* *
* Log some of the settings we've determined. We could log more here, it *
*** 1172,1185 ****
logger.quiet("RELEASE_VERSION: $RELEASE_VERSION")
logger.quiet("RELEASE_SUFFIX: $RELEASE_SUFFIX")
logger.quiet("RELEASE_VERSION_SHORT: $RELEASE_VERSION_SHORT")
logger.quiet("RELEASE_VERSION_LONG: $RELEASE_VERSION_LONG")
logger.quiet("RELEASE_VERSION_PADDED: $RELEASE_VERSION_PADDED")
!
! if (UPDATE_STUB_CACHE) {
! logger.quiet("UPDATE_STUB_CACHE: $UPDATE_STUB_CACHE")
! }
/******************************************************************************
* *
* Definition of Native Code Compilation Tasks *
* *
--- 1324,1334 ----
logger.quiet("RELEASE_VERSION: $RELEASE_VERSION")
logger.quiet("RELEASE_SUFFIX: $RELEASE_SUFFIX")
logger.quiet("RELEASE_VERSION_SHORT: $RELEASE_VERSION_SHORT")
logger.quiet("RELEASE_VERSION_LONG: $RELEASE_VERSION_LONG")
logger.quiet("RELEASE_VERSION_PADDED: $RELEASE_VERSION_PADDED")
! logger.quiet("UPDATE_STUB_CACHE: $UPDATE_STUB_CACHE")
/******************************************************************************
* *
* Definition of Native Code Compilation Tasks *
* *
*** 2186,2195 ****
--- 2335,2348 ----
dependencies {
}
test {
enabled = IS_FULL_TEST && IS_AWT_TEST
+
+ if (!HAS_JAVAFX_MODULES) {
+ jvmArgs += qualExportsSwing
+ }
}
compileJava.options.compilerArgs.addAll(qualExportsCore)
compileJava.options.compilerArgs.addAll(qualExportsSwing)
}
*** 2266,2276 ****
}
project.ext.moduleSourcePath = defaultModuleSourcePath
project.ext.moduleSourcePathShim = defaultModuleSourcePathShim
! commonModuleSetup(project, [ 'base', 'graphics', 'swing', 'controls', 'fxml' ])
dependencies {
testCompile project(":graphics").sourceSets.test.output
testCompile project(":base").sourceSets.test.output
--- 2419,2429 ----
}
project.ext.moduleSourcePath = defaultModuleSourcePath
project.ext.moduleSourcePathShim = defaultModuleSourcePathShim
! commonModuleSetup(project, [ 'base', 'graphics', 'controls', 'fxml' ])
dependencies {
testCompile project(":graphics").sourceSets.test.output
testCompile project(":base").sourceSets.test.output
*** 3745,3755 ****
testCompile project(":base").sourceSets.test.output
testCompile project(":controls").sourceSets.test.output
testCompile project(":swing").sourceSets.test.output
}
! commonModuleSetup(project, [ 'base', 'graphics', 'controls', 'media', 'web', 'swing', 'fxml' ])
File testJavaPolicyFile = new File(rootProject.buildDir, TESTJAVAPOLICYFILE);
File testRunArgsFile = new File(rootProject.buildDir,TESTRUNARGSFILE);
File stRunArgsFile = new File(project.buildDir,"st.run.args");
--- 3898,3909 ----
testCompile project(":base").sourceSets.test.output
testCompile project(":controls").sourceSets.test.output
testCompile project(":swing").sourceSets.test.output
}
! def dependentProjects = [ 'base', 'graphics', 'controls', 'media', 'web', 'swing', 'fxml' ]
! commonModuleSetup(project, dependentProjects)
File testJavaPolicyFile = new File(rootProject.buildDir, TESTJAVAPOLICYFILE);
File testRunArgsFile = new File(rootProject.buildDir,TESTRUNARGSFILE);
File stRunArgsFile = new File(project.buildDir,"st.run.args");
*** 3784,3793 ****
--- 3938,3954 ----
test.dependsOn(sts)
test.dependsOn(createTestArgfiles);
// Tasks to create standalone test applications for the launcher tests
+ if (project.hasProperty('testModulePathArgs')) {
+ compileTestapp1Java.options.compilerArgs.addAll(testModulePathArgs)
+ }
+ dependentProjects.each { e ->
+ compileTestapp1Java.dependsOn(rootProject.project(e).testClasses)
+ }
+
def testapp1JarName = "testapp1.jar"
task createTestapp1Jar1(type: Jar) {
dependsOn compileTestapp1Java
enabled = IS_FULL_TEST
*** 3841,3852 ****
def testappCompileTasks = project.getTasksByName("compile${testappCapital}Java", true);
def testappResourceTasks = project.getTasksByName("process${testappCapital}Resources", true);
testappCompileTasks.each { appCompileTask ->
appCompileTask.options.compilerArgs.addAll([
'-implicit:none',
! '--module-source-path', testAppSourceDirs.join(File.pathSeparator)
] )
copyTestAppTask.dependsOn(appCompileTask)
}
testappResourceTasks.each { appResourceTask ->
copyTestAppTask.dependsOn(appResourceTask)
--- 4002,4020 ----
def testappCompileTasks = project.getTasksByName("compile${testappCapital}Java", true);
def testappResourceTasks = project.getTasksByName("process${testappCapital}Resources", true);
testappCompileTasks.each { appCompileTask ->
appCompileTask.options.compilerArgs.addAll([
'-implicit:none',
! '--module-source-path', testAppSourceDirs.join(File.pathSeparator),
] )
+ if (project.hasProperty('testModulePathArgs')) {
+ appCompileTask.options.compilerArgs.addAll(testModulePathArgs)
+ }
+
+ dependentProjects.each { e ->
+ appCompileTask.dependsOn(rootProject.project(e).testClasses)
+ }
copyTestAppTask.dependsOn(appCompileTask)
}
testappResourceTasks.each { appResourceTask ->
copyTestAppTask.dependsOn(appResourceTask)
*** 3856,3875 ****
--- 4024,4058 ----
}
test {
enabled = IS_FULL_TEST
+ // Parse testPatchModuleArgs looking for "--module-path".
+ // Save path if found so we can pass it to the module launcher tests
+ def pendingModulePath = false
+ testPatchModuleArgs.each { str ->
+ if (pendingModulePath) {
+ project.ext.launcherModulePath = str;
+ pendingModulePath = false
+ } else if (str == "--module-path") {
+ pendingModulePath = true
+ }
+ }
+
// Properties passed to launcher tests
systemProperty "launchertest.testapp1.jar", "build/testapp1/$testapp1JarName"
modtestapps.each { testapp ->
systemProperty "launchertest.${testapp}.module.path",
"${project.buildDir}/modules/${testapp}"
}
// Properties passed to test.util.Util
systemProperties 'worker.debug': IS_WORKER_DEBUG
systemProperties 'worker.patchmodule.file': cygpath(stRunArgsFile.path)
+ if (project.hasProperty("launcherModulePath")) {
+ systemProperties 'worker.module.path': launcherModulePath
+ }
systemProperties 'worker.patch.policy': cygpath(testJavaPolicyFile.path)
systemProperties 'worker.java.cmd': JAVA
if (!IS_USE_ROBOT) {
// Disable all robot-based visual tests
*** 3883,3892 ****
--- 4066,4079 ----
// Disable all AWT-based tests
exclude("**/javafx/embed/swing/*.*");
exclude("**/com/sun/javafx/application/Swing*.*");
}
+ if (!HAS_JAVAFX_MODULES) {
+ jvmArgs += qualExportsSwing
+ }
+
forkEvery = 1
}
}
allprojects {
*** 3956,3967 ****
--- 4143,4156 ----
project.compileShimsJava.dependsOn(project.compileJava)
def copyGeneratedShimsTask = task("copyGeneratedShims", type: Copy, dependsOn: [compileShimsJava, processShimsResources]) {
from project.sourceSets.shims.java.outputDir
into "${rootProject.buildDir}/shims"
+ if (HAS_JAVAFX_MODULES) {
exclude("*/module-info.class")
}
+ }
project.processShimsResources.dependsOn(project.processResources)
// shims resources should have the main resouces as a base
project.sourceSets.shims.resources.srcDirs += project.sourceSets.main.resources.srcDirs
*** 4054,4063 ****
--- 4243,4256 ----
doLast {
mspFile.delete()
mspFile << "--module-source-path\n"
mspFile << defaultModuleSourcePath
mspFile << "\n"
+
+ if (!HAS_JAVAFX_MODULES) {
+ appendQualExports(mspFile, qualExportsSwing)
+ }
}
}
task javadoc(type: Javadoc, dependsOn: createMSPfile) {
group = "Basic"
*** 4331,4355 ****
// Combine the classes, lib, and bin for each module
compileTargets { t ->
def targetProperties = project.ext[t.upper]
def platformPrefix = targetProperties.platformPrefix
! def modularSdkDirName = "${platformPrefix}modular-sdk"
! def modularSdkDir = "${rootProject.buildDir}/${modularSdkDirName}"
! def modulesDir = "${modularSdkDir}/modules"
! def modulesCmdsDir = "${modularSdkDir}/modules_cmds"
! def modulesLibsDir = "${modularSdkDir}/modules_libs"
! def modulesSrcDir = "${modularSdkDir}/modules_src"
! def modulesConfDir = "${modularSdkDir}/modules_conf"
! def modulesLegalDir = "${modularSdkDir}/modules_legal"
! def modulesMakeDir = "${modularSdkDir}/make"
final File runArgsFile = file("${rootProject.buildDir}/${RUNARGSFILE}")
final File compileArgsFile = file("${rootProject.buildDir}/${COMPILEARGSFILE}")
project.files(runArgsFile);
def buildModulesTask = task("buildModules$t.capital", group: "Build") {
// Copy dependencies/*/module-info.java.extra
// merging as needed, removing duplicates
// only lines with 'exports' will be copied
def dependencyRoots = moduleDependencies
if (rootProject.hasProperty("closedModuleDepedencies")) {
--- 4524,4551 ----
// Combine the classes, lib, and bin for each module
compileTargets { t ->
def targetProperties = project.ext[t.upper]
def platformPrefix = targetProperties.platformPrefix
! def bundledSdkDirName = "${platformPrefix}modular-sdk"
! def bundledSdkDir = "${rootProject.buildDir}/${bundledSdkDirName}"
! def modulesDir = "${bundledSdkDir}/modules"
! def modulesCmdsDir = "${bundledSdkDir}/modules_cmds"
! def modulesLibsDir = "${bundledSdkDir}/modules_libs"
! def modulesSrcDir = "${bundledSdkDir}/modules_src"
! def modulesConfDir = "${bundledSdkDir}/modules_conf"
! def modulesLegalDir = "${bundledSdkDir}/modules_legal"
! def modulesMakeDir = "${bundledSdkDir}/make"
!
final File runArgsFile = file("${rootProject.buildDir}/${RUNARGSFILE}")
final File compileArgsFile = file("${rootProject.buildDir}/${COMPILEARGSFILE}")
project.files(runArgsFile);
def buildModulesTask = task("buildModules$t.capital", group: "Build") {
+ // BUNDLED SDK
+
// Copy dependencies/*/module-info.java.extra
// merging as needed, removing duplicates
// only lines with 'exports' will be copied
def dependencyRoots = moduleDependencies
if (rootProject.hasProperty("closedModuleDepedencies")) {
*** 4447,4456 ****
--- 4643,4653 ----
}
}
}
buildModules.dependsOn(buildModulesTask)
+ // BUNDLED SDK
moduleProjList.each { project ->
// Copy classes, bin, and lib directories
def moduleName = project.ext.moduleName
def buildDir = project.buildDir
*** 4545,4575 ****
copyDocFiles,
copyBuildPropertiesTask,
copyLegalTask)
}
def buildRunArgsTask = task("buildRunArgs$t.capital",
group: "Build", dependsOn: buildModulesTask) {
outputs.file(runArgsFile);
inputs.file(EXTRAADDEXPORTS);
doLast() {
- List<String>libpath = []
List<String>modpath = []
moduleProjList.each { project ->
def moduleName = project.ext.moduleName
def dstModuleDir = cygpath("${modulesDir}/${moduleName}")
modpath << "${moduleName}=${dstModuleDir}"
}
! writeRunArgsFile(runArgsFile, computeLibraryPath(true), modpath)
! writeRunArgsFile(compileArgsFile, null, modpath)
if (rootProject.hasProperty("EXTRA_ADDEXPORTS_STRING")) {
runArgsFile << EXTRA_ADDEXPORTS_STRING
compileArgsFile << EXTRA_ADDEXPORTS_STRING
}
}
}
buildModules.dependsOn(buildRunArgsTask)
def isWindows = IS_WINDOWS && t.name == "win";
--- 4742,4872 ----
copyDocFiles,
copyBuildPropertiesTask,
copyLegalTask)
}
+ // ============================================================
+
+ def standaloneSdkDirName = "${platformPrefix}sdk"
+ def standaloneSdkDir = "${rootProject.buildDir}/${standaloneSdkDirName}"
+ def standaloneLibDir = "${standaloneSdkDir}/lib"
+ def libDest=targetProperties.libDest
+ def standaloneNativeDir = "${standaloneSdkDir}/${libDest}"
+ def standaloneLegalDir = "${standaloneSdkDir}/legal"
+ def standaloneSrcZipName = "src.zip"
+
+ // STANDALONE SDK
+ moduleProjList.each { project ->
+ // Copy classes, bin, and lib directories
+
+ def moduleName = project.ext.moduleName
+ def buildDir = project.buildDir
+
+ // Create modular jars
+ def srcClassesDir = "${buildDir}/${platformPrefix}module-classes"
+ def dstModularJarDir = "${standaloneLibDir}"
+ def modularJarName = "${moduleName}.jar"
+ def modularJarTask = project.task("modularJarStandalone$t.capital", type: Jar, dependsOn: project.assemble) {
+ destinationDir = file("${dstModularJarDir}")
+ archiveName = modularJarName
+ includeEmptyDirs = false
+ from srcClassesDir
+ }
+
+ // Copy native libraries
+ def srcNativeDir = "${buildDir}/${platformPrefix}module-lib"
+ def dstNativeDir = "${standaloneNativeDir}"
+ def copyNativeFilesTask = project.task("copyNativeFilesStandalone$t.capital", type: Copy, dependsOn: modularJarTask) {
+ from srcNativeDir
+ into dstNativeDir
+ include("*.dll")
+ }
+
+ // Copy other lib files
+ def srcLibsDir = "${buildDir}/${platformPrefix}module-lib"
+ def dstLibsDir = "${standaloneLibDir}"
+ def copyLibFilesTask = project.task("copyLibFilesStandalone$t.capital", type: Copy, dependsOn: copyNativeFilesTask) {
+ from srcLibsDir
+ into dstLibsDir
+ exclude("*.dll")
+ }
+
+ // Copy legal files
+ def licenseFiles = [ "ADDITIONAL_LICENSE_INFO", "ASSEMBLY_EXCEPTION", "LICENSE" ]
+ def srcLegalDir = "${project.projectDir}/src/main/legal"
+ def dstLegalDir = "${standaloneLegalDir}/${moduleName}"
+ def copyLegalTask = project.task("copyLegalStandalone$t.capital", type: Copy, dependsOn: copyLibFilesTask) {
+
+ def rtDir = rootProject.file('.')
+ licenseFiles.each { lFile ->
+ from "${rtDir}/${lFile}"
+ }
+
+ from srcLegalDir
+
+ into dstLegalDir
+
+ // Exclude ANGLE since we (currently) do not use it
+ exclude("angle.md")
+ }
+
+ buildModulesTask.dependsOn(
+ modularJarTask,
+ copyNativeFilesTask,
+ copyLibFilesTask,
+ copyLegalTask)
+ }
+
+ // Zip module sources for standalone SDK
+ //
+ // NOTE: the input is taken from the modular-sdk/modules_src dir
+ // so that we don't have to duplicate the logic and create another
+ // temporary directory. This is somewhat inelegant, since the bundled sdk
+ // and the standalone sdk should be independent of one another, but seems
+ // better than the alternatives.
+ def zipSourceFilesTask = project.task("zipSourceFilesStandalone$t.capital", type: Zip, dependsOn: buildModulesTask) {
+ destinationDir = file("${standaloneLibDir}")
+ archiveName = standaloneSrcZipName
+ includeEmptyDirs = false
+ from modulesSrcDir
+ include "**/*.java"
+ }
+ buildModules.dependsOn(zipSourceFilesTask)
+
+ // ============================================================
+
def buildRunArgsTask = task("buildRunArgs$t.capital",
group: "Build", dependsOn: buildModulesTask) {
outputs.file(runArgsFile);
inputs.file(EXTRAADDEXPORTS);
doLast() {
List<String>modpath = []
+ List<String>modnames = []
moduleProjList.each { project ->
def moduleName = project.ext.moduleName
def dstModuleDir = cygpath("${modulesDir}/${moduleName}")
+ if (HAS_JAVAFX_MODULES) {
modpath << "${moduleName}=${dstModuleDir}"
+ } else {
+ modnames << moduleName
+ }
}
! if (HAS_JAVAFX_MODULES) {
! writeRunArgsFile(runArgsFile, computeLibraryPath(true), modpath, null)
! writeRunArgsFile(compileArgsFile, null, modpath, null)
if (rootProject.hasProperty("EXTRA_ADDEXPORTS_STRING")) {
runArgsFile << EXTRA_ADDEXPORTS_STRING
compileArgsFile << EXTRA_ADDEXPORTS_STRING
}
+ } else {
+ modpath = [ cygpath("${standaloneLibDir}") ]
+ writeRunArgsFile(runArgsFile, null, modpath, modnames)
+ writeRunArgsFile(compileArgsFile, null, modpath, modnames)
+ }
}
}
buildModules.dependsOn(buildRunArgsTask)
def isWindows = IS_WINDOWS && t.name == "win";
*** 4892,4902 ****
}
archiveName = jfxBundle
destinationDir = file("${rootProject.buildDir}")
includeEmptyDirs = false
! from "${modularSdkDir}"
}
jdkZip.dependsOn(zipTask)
Task testArgFiles = task("createTestArgfiles${t.capital}") {
--- 5189,5199 ----
}
archiveName = jfxBundle
destinationDir = file("${rootProject.buildDir}")
includeEmptyDirs = false
! from "${bundledSdkDir}"
}
jdkZip.dependsOn(zipTask)
Task testArgFiles = task("createTestArgfiles${t.capital}") {
*** 4930,4939 ****
--- 5227,5237 ----
testJavaPolicyFile.delete()
runJavaPolicyFile.delete()
List<String> modpath = []
+ if (HAS_JAVAFX_MODULES) {
moduleProjList.each { project ->
if (project.hasProperty("moduleName") && project.buildModule) {
File dir;
if (project.sourceSets.hasProperty('shims')) {
dir = new File(rootProject.buildDir, "shims/${project.ext.moduleName}")
*** 4955,4971 ****
" permission java.security.AllPermission;\n" +
"};\n"
}
}
! writeRunArgsFile(testCompileArgsFile, null, modpath)
! writeRunArgsFile(testRunArgsFile, computeLibraryPath(true), modpath)
if (rootProject.hasProperty("EXTRA_ADDEXPORTS_STRING")) {
testCompileArgsFile << EXTRA_ADDEXPORTS_STRING
testRunArgsFile << EXTRA_ADDEXPORTS_STRING
}
}
}
sdk.dependsOn(testArgFiles)
createTestArgfiles.dependsOn(testArgFiles)
--- 5253,5303 ----
" permission java.security.AllPermission;\n" +
"};\n"
}
}
! writeRunArgsFile(testCompileArgsFile, null, modpath, null)
! writeRunArgsFile(testRunArgsFile, computeLibraryPath(true), modpath, null)
if (rootProject.hasProperty("EXTRA_ADDEXPORTS_STRING")) {
testCompileArgsFile << EXTRA_ADDEXPORTS_STRING
testRunArgsFile << EXTRA_ADDEXPORTS_STRING
}
+ } else {
+ def modnames = []
+ moduleProjList.each { project ->
+ if (project.hasProperty("moduleName") && project.buildModule) {
+ modnames << project.ext.moduleName
+ File dir;
+ if (project.sourceSets.hasProperty('shims')) {
+ dir = new File(rootProject.buildDir, "shims/${project.ext.moduleName}")
+ } else {
+ dir = new File(rootProject.buildDir, "sdk/lib/${project.ext.moduleName}.jar")
+ }
+
+ def dstModuleDir = cygpath(dir.path)
+ modpath << "${dstModuleDir}"
+
+ String themod = dir.toURI()
+ testJavaPolicyFile << "grant codeBase \"${themod}\" {\n" +
+ " permission java.security.AllPermission;\n" +
+ "};\n"
+
+ dir = new File(rootProject.buildDir, "sdk/lib/${project.ext.moduleName}.jar")
+ themod = dir.toURI()
+ runJavaPolicyFile << "grant codeBase \"${themod}\" {\n" +
+ " permission java.security.AllPermission;\n" +
+ "};\n"
+ }
+ }
+
+ writeRunArgsFile(testCompileArgsFile, null, modpath, modnames)
+ writeRunArgsFile(testRunArgsFile, computeLibraryPath(true), modpath, modnames)
+
+ appendQualExports(testCompileArgsFile, qualExportsSwing)
+ appendQualExports(testRunArgsFile, qualExportsSwing)
+ }
}
}
sdk.dependsOn(testArgFiles)
createTestArgfiles.dependsOn(testArgFiles)
< prev index next >