--- old/./build.gradle 2016-11-02 13:31:04.297270644 -0400
+++ new/./build.gradle 2016-11-02 13:31:04.181273279 -0400
@@ -1,3 +1,4 @@
+// FIXME: KCR SDK
/*
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -31,9 +32,6 @@
* - some things worth automatically sanity checking:
* - are there images in the javadocs?
* - are all of the expected dylibs etc there?
- * - is jfxrt.jar there?
- * - does jfxrt.jar contain stuff it shouldn't (doc-files, iml, etc)
- * - does jfxrt.jar contain stuff it should (bss files, etc)
* - Perform sanity checking to make sure a JDK exists with javac, javah, etc
* - Support building with no known JDK location, as long as javac, javah, etc are on the path
* - Check all of the native flags. We're adding weight to some libs that don't need it, and so forth.
@@ -258,6 +256,15 @@
def buildClosed = closedDir.isDirectory()
ext.BUILD_CLOSED = buildClosed
+ext.RUNARGSFILE = "run.args"
+ext.COMPILEARGSFILE = "compile.args"
+
+ext.TESTCOMPILEARGSFILE = "testcompile.args"
+ext.TESTRUNARGSFILE = "testrun.args"
+ext.TESTJAVAPOLICYFILE = 'test.java.policy'
+
+ext.MODULESOURCEPATH = "modulesourcepath.args"
+
// These variables indicate what platform is running the build. Is
// this build running on a Mac, Windows, or Linux machine? 32 or 64 bit?
ext.OS_NAME = System.getProperty("os.name").toLowerCase()
@@ -282,7 +289,7 @@
// Get the JDK_HOME automatically based on the version of Java used to execute gradle. Or, if specified,
-// use a user supplied JDK_HOME, STUB_RUNTIME, JAVAC, and/or JAVAH, all of which may be specified
+// use a user supplied JDK_HOME, STUB_RUNTIME, JAVAC, all of which may be specified
// independently (or we'll try to get the right one based on other supplied info). Sometimes the
// JRE might be the thing that is being used instead of the JRE embedded in the JDK, such as:
// c:\Program Files (x86)\Java\jdk1.8.0\jre
@@ -301,26 +308,12 @@
javaHome) // we have to bail and set it to something and this is as good as any!
ext.JAVA_HOME = JDK_HOME
-// Check whether JIGSAW_HOME is set. If it is, then it points to a JDK9
-// jigsaw build with modularization enabled and can be used for testing
-def envJigsawHome = cygpath(System.getenv("JIGSAW_HOME"))
-defineProperty("JIGSAW_HOME", envJigsawHome);
-
-if (JIGSAW_HOME == null || JIGSAW_HOME == "") {
- logger.warn("JIGSAW_HOME is not set");
- ext.USE_JIGSAW = false
-} else {
- ext.USE_JIGSAW = true
-}
-
defineProperty("JAVA", cygpath("$JDK_HOME/bin/java${IS_WINDOWS ? '.exe' : ''}"))
-defineProperty("JIGSAW_JAVA", cygpath("$JIGSAW_HOME/bin/java${IS_WINDOWS ? '.exe' : ''}"))
defineProperty("JAVAC", cygpath("$JDK_HOME/bin/javac${IS_WINDOWS ? '.exe' : ''}"))
-defineProperty("JIGSAW_JAVAC", cygpath("$JIGSAW_HOME/bin/javac${IS_WINDOWS ? '.exe' : ''}"))
defineProperty("JAVAH", cygpath("$JDK_HOME/bin/javah${IS_WINDOWS ? '.exe' : ''}"))
defineProperty("JAVADOC", cygpath("$JDK_HOME/bin/javadoc${IS_WINDOWS ? '.exe' : ''}"))
defineProperty("JDK_DOCS", "https://docs.oracle.com/javase/8/docs/api/")
-defineProperty("JIGSAW_MODULES", cygpath(System.getenv("JIGSAW_MODULES")) ?: cygpath(System.getenv("JIGSAW_HOME") + "/jmods"))
+defineProperty("JDK_JMODS", cygpath(System.getenv("JDK_JMODS")) ?: cygpath(System.getenv("JDK_HOME") + "/jmods"))
defineProperty("javaRuntimeVersion", System.getProperty("java.runtime.version"))
def javaVersionInfo = parseJavaVersion(javaRuntimeVersion)
@@ -329,22 +322,31 @@
loadProperties("$projectDir/build.properties")
-// Look for stub runtime in either old (JDK 8u) or new (JDK 9) dir layout
+// 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")
-def cachesSdkRtDir = file("../caches/sdk/rt")
-def hasRtDir = cachesSdkRtDir.isDirectory()
-def String closedCacheStubRuntime = cygpath("$projectDir") + "/../caches/sdk" + (hasRtDir ? "/rt" : "")
-
-def jdkHomeJreDir = file("$JDK_HOME/jre")
-def hasJreDir = jdkHomeJreDir.isDirectory()
-def String jreStubRuntime = cygpath("$JDK_HOME") + (hasJreDir ? "/jre" : "")
-
-defineProperty("STUB_RUNTIME", BUILD_CLOSED ? closedCacheStubRuntime : jreStubRuntime)
-
-defineProperty("LIBRARY_STUB", IS_MAC ? "$STUB_RUNTIME/lib" :
- IS_WINDOWS ? "$STUB_RUNTIME/bin" :
- "$STUB_RUNTIME/lib/$OS_ARCH")
-defineProperty("UPDATE_STUB_CACHE", (STUB_RUNTIME.equals(closedCacheStubRuntime) ? 'true' : 'false'))
+defineProperty("STUB_RUNTIME", BUILD_CLOSED ? closedCacheStubRuntime : jdkStubRuntime)
+
+def cachedStub = STUB_RUNTIME.equals(closedCacheStubRuntime)
+
+if (cachedStub) {
+ def stubModulesLib = "$STUB_RUNTIME/modules_libs"
+ def dirSuffix = (IS_MAC || IS_WINDOWS) ? "" : "/$OS_ARCH"
+ defineProperty("MEDIA_STUB", "$stubModulesLib/javafx.media$dirSuffix")
+ defineProperty("WEB_STUB", "$stubModulesLib/javafx.web$dirSuffix")
+} else {
+ def libraryStub = IS_MAC ? "$STUB_RUNTIME/lib" :
+ IS_WINDOWS ? "$STUB_RUNTIME/bin" :
+ "$STUB_RUNTIME/lib/$OS_ARCH"
+
+ 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");
@@ -384,7 +386,7 @@
ext.IS_COMPILE_JFR = Boolean.parseBoolean(COMPILE_JFR)
// BUILD_FXPACKAGER enables building the packager modules and native code
-defineProperty("BUILD_FXPACKAGER", "false")
+defineProperty("BUILD_FXPACKAGER", "true")
ext.IS_BUILD_FXPACKAGER = Boolean.parseBoolean(BUILD_FXPACKAGER)
// RETAIN_PACKAGER_TESTS specifies whether the tests in fxpackager should
@@ -421,9 +423,6 @@
defineProperty("FULL_TEST", "false")
ext.IS_FULL_TEST = Boolean.parseBoolean(FULL_TEST);
-defineProperty("JIGSAW_TEST", "true")
-ext.IS_JIGSAW_TEST = Boolean.parseBoolean(JIGSAW_TEST) && USE_JIGSAW
-
defineProperty("FORCE_TESTS", "false")
ext.IS_FORCE_TESTS = Boolean.parseBoolean(FORCE_TESTS);
@@ -572,24 +571,11 @@
}
ext.CROSS_TOOLS_DIR = file(crossToolsDir)
-// Specifies whether to run tests with the present jfxrt.jar instead of compiling the new one
+// Specifies whether to run tests with the existing javafx.* modules instead of compiling a new one
defineProperty("BUILD_SDK_FOR_TEST", "true")
ext.DO_BUILD_SDK_FOR_TEST = Boolean.parseBoolean(BUILD_SDK_FOR_TEST)
-// Specifies the location to point at SDK build when DO_BUILD_SDK_FOR_TEST set to false
-// Used to get location of jfxrt.jar, ant-javafx.jar and javafx-mx.jar
-defineProperty("TEST_SDK", JDK_HOME)
-ext.TEST_SDK_DIR = file(TEST_SDK)
-
-def rtDir = TEST_SDK_DIR
-ext.jfxrtJarFromSdk = new File(rtDir, "lib/jfxrt.jar").absolutePath
-if (!DO_BUILD_SDK_FOR_TEST && !file(jfxrtJarFromSdk).exists()) {
- fail ("BUILD_SDK_FOR_TEST is set to false, but there\'s no jfxrt.jar at the expected paths in TEST_SDK($TEST_SDK_DIR)\n"
- + "TEST_SDK should point at either JavaFX SDK location or JDK location\n"
- + "Please, set the correct TEST_SDK")
-}
-
-// All "classes" and "jar" tasks and their dependencies would be disabled
+// All "classes" and "jar" tasks and their dependencies would be disabled
// 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") })
@@ -704,6 +690,218 @@
}
}
+// Make an forked ANT call.
+// This needs to be forked so that ant can be used with the right JDK and updated modules
+// for testing obscure things like packaging of apps
+void ant(String conf, // platform configuration
+ String dir, // directory to run from
+ String target, // ant target
+ List params // parameters (usually -Dxxx=yyy)
+ ) {
+ // Try to use ANT_HOME
+ String antHomeEnv = System.getenv("ANT_HOME")
+ String antHome = antHomeEnv != null ? cygpath(antHomeEnv) : null;
+ String ant = (antHome != null && !antHome.equals("")) ? "$antHome/bin/ant" : "ant";
+
+ exec {
+ workingDir = dir
+ environment("JDK_HOME", JDK_HOME)
+ environment("JAVA_HOME", JDK_HOME)
+ if (IS_WINDOWS) {
+ environment([
+ "VCINSTALLDIR" : WINDOWS_VS_VCINSTALLDIR,
+ "VSINSTALLDIR" : WINDOWS_VS_VSINSTALLDIR,
+ "DEVENVDIR" : WINDOWS_VS_DEVENVDIR,
+ "MSVCDIR" : WINDOWS_VS_MSVCDIR,
+ "INCLUDE" : WINDOWS_VS_INCLUDE,
+ "LIB" : WINDOWS_VS_LIB,
+ "LIBPATH" : WINDOWS_VS_LIBPATH,
+ "DXSDK_DIR" : WINDOWS_DXSDK_DIR
+ ]);
+ commandLine "cmd", "/c", ant, "-Dbuild.compiler=javac1.7"
+ } else {
+ commandLine ant, "-Dbuild.compiler=javac1.7"
+ }
+ if ((conf != null) && !rootProject.defaultHostTarget.equals(conf)) {
+ def targetProperties = rootProject.ext[t.trim().toUpperCase()]
+ args("-Dcross.platform=$conf")
+ if (targetProperties.containsKey('arch')) {
+ args("-Dcross.platform.arch=${targetProperties.arch}")
+ }
+ }
+ if (params != null) {
+ params.each() { s->
+ args(s)
+ }
+ }
+ args(target);
+ }
+}
+
+List computeLibraryPath(boolean working) {
+ List lp = []
+ List 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"
+ String suffix = ""
+
+ if (!HOST_MODULES_ARCH.equals("")) {
+ suffix = "/${HOST_MODULES_ARCH}"
+ }
+
+
+ modsWithNative.each() { m ->
+ lp << cygpath("${modulesLibsDir}/javafx.${m}${suffix}")
+ }
+ return lp
+}
+
+// Return list with the arguments needed for --patch-module for the provided projects
+// used with Java executables ie. tests
+List computePatchModuleArgs(List deps, boolean test) {
+ List pma = []
+
+ deps.each {String projname ->
+ def proj = project(projname)
+ if (proj.hasProperty("moduleName")) {
+ File dir = proj.sourceSets.main.output.classesDir
+ if (test && proj.sourceSets.hasProperty('shims')) {
+ dir = proj.sourceSets.shims.output.classesDir
+ }
+ String moduleName = proj.ext.moduleName
+ String dirpath = cygpath("${dir}/${moduleName}")
+ pma += "--patch-module=${moduleName}=${dirpath}"
+ }
+ }
+
+ pma += "-Djava.library.path=" + computeLibraryPath(true).join(File.pathSeparator)
+
+ return pma
+}
+
+// Return a list containing the --upgrade-module-path
+// used with Javac
+List computeModulePathArgs(String pname, List deps, boolean test) {
+ List 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.output.classesDir, proj.ext.moduleName);
+ } else {
+ dir = new File(proj.sourceSets.main.output.classesDir, proj.ext.moduleName);
+ }
+ 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
+ }
+
+ mpa += mp
+ return mpa
+ }
+
+ void writeCompileArgsFile(File dest, Listpath) {
+ dest.delete()
+
+ logger.info("Creating file ${dest.path}")
+ dest << "--upgrade-module-path\n"
+
+ dest << "\"\\\n"
+ path.each() { e->
+ dest << " "
+ dest << cygpath(e)
+ dest << File.pathSeparator
+ dest << "\\\n"
+ }
+ dest << "\"\n"
+ }
+
+void writeRunArgsFile(File dest, List libpath, List modpath) {
+
+ dest.delete()
+
+ logger.info("Creating file ${dest.path}")
+
+ dest << "-Djava.library.path=\"\\\n"
+ libpath.each() { e->
+ dest << " "
+ dest << e
+ dest << File.pathSeparator
+ dest << "\\\n"
+ }
+ dest << " \"\n"
+
+ modpath.each { e ->
+ dest << "--patch-module \""
+ dest << e
+ dest << "\"\n"
+ }
+}
+
+// perform common project manipulation for modules
+void commonModuleSetup(Project p, List moduleChain) {
+
+ p.ext.moduleChain = moduleChain
+
+ if (p.hasProperty("moduleName")) {
+ p.ext.moduleDir = new File (p.sourceSets.main.output.classesDir, "${p.moduleName}")
+ }
+
+ def mpa = computeModulePathArgs(p.name, moduleChain, false)
+ if (mpa != null) {
+ p.ext.modulePathArgs = mpa
+ }
+
+ p.ext.testModulePathArgs = computeModulePathArgs(p.name, moduleChain, true)
+ p.ext.patchModuleArgs = computePatchModuleArgs(moduleChain ,false)
+ p.ext.testPatchModuleArgs = computePatchModuleArgs(moduleChain, true)
+
+ moduleChain.each() {e ->
+ if (!e.equals(p.name)) {
+ p.compileJava.dependsOn(project(e).classes)
+ p.compileTestJava.dependsOn(project(e).testClasses)
+ }
+ }
+
+ // read in any addExports file
+ File addExportsFile = new File(p.projectDir,"src/test/addExports")
+ if (addExportsFile.exists()) {
+ List ae = []
+ addExportsFile.eachLine { line ->
+ line = line.trim()
+ if (!(line.startsWith("#") || line.equals(""))) {
+ // one line arguments are a bit easier to debug
+ //if (line.startsWith('--add-exports ')) {
+ // line = line.replaceFirst('--add-exports ', '--add-exports=')
+ //}
+ line = line.replace('--add-exports *', '--add-exports=')
+ ae += line.split(' ')
+ }
+ }
+ p.ext.addExports = ae.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
@@ -747,6 +945,7 @@
// Every platform must define these variables
if (!project.hasProperty(t.upper)) throw new Exception("ERROR: Incorrectly configured compile flags file, missing ${t.name} property")
def props = project.ext[t.upper];
+ // FIXME: KCR -- remove libDest in favor of modLibDest
["compileSwing", "compileSWT", "compileFXPackager", "libDest"].each { prop ->
if (!props.containsKey(prop)) throw new Exception("ERROR: Incorrectly configured compile flags file, missing ${prop} property on ${t.name}")
}
@@ -765,7 +964,7 @@
if (targetProperties.compileSwing) COMPILE_SWING = true
if (targetProperties.compileSWT) COMPILE_SWT = true
- if (IS_BUILD_FXPACKAGER && JIGSAW_HOME && targetProperties.compileFXPackager) COMPILE_FXPACKAGER = 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
@@ -788,12 +987,15 @@
if (!targetProperties.containsKey('modLibDest')) targetProperties.modLibDest = targetProperties.libDest
+ if (!targetProperties.containsKey('modulesArch')) targetProperties.modulesArch = ""
+
// This value is used as a prefix for various directories under ./build,
// such as sdk, to allow for a common name for the hosted build
// (for use when building apps) and a unique name for cross builds.
if (rootProject.defaultHostTarget.equals(t.name)) {
// use a simple common default for the "host" build
targetProperties.platformPrefix=""
+ rootProject.ext.HOST_MODULES_ARCH = targetProperties.modulesArch
} else {
// and a more complex one for cross builds
targetProperties.platformPrefix="${t.name}-"
@@ -817,9 +1019,7 @@
// 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(JIGSAW_JAVA).exists()) logger.warn("Missing or incorrect path to JIGSAW 'java': '$JIGSAW_JAVA'. Perhaps bad JIGSAW_HOME? $JIGSAW_HOME")
if (!file(JAVAC).exists()) throw new Exception("Missing or incorrect path to 'javac': '$JAVAC'. Perhaps bad JDK_HOME? $JDK_HOME")
-if (!file(JIGSAW_JAVAC).exists()) logger.warn("Missing or incorrect path to JIGSAW 'javac': '$JIGSAW_JAVAC'. Perhaps bad JIGSAW_HOME? $JIGSAW_HOME")
if (!file(JAVAH).exists()) throw new Exception("Missing or incorrect path to 'javah': '$JAVAH'. 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")
@@ -865,14 +1065,14 @@
NUM_COMPILE_THREADS = 1
}
-// Check that Gradle 2.11 is in use, error if < 2.11.
-if (gradle.gradleVersion != "2.11") {
+// Check for Gradle 3.1, error if < 3.0.
+if (gradle.gradleVersion != "3.1") {
def ver = gradle.gradleVersion.split("[\\.]");
def gradleMajor = Integer.parseInt(ver[0]);
def gradleMinor = Integer.parseInt(ver[1]);
def err = "";
- if (gradleMajor == 1 || gradleMajor == 2 && gradleMinor < 11) {
- err = "Gradle version too old: ${gradle.gradleVersion}; must be at least 2.11"
+ if (gradleMajor < 3) {
+ err = "Gradle version too old: ${gradle.gradleVersion}; must be at least 3.0"
}
if (IS_GRADLE_VERSION_CHECK && err != "") {
@@ -881,7 +1081,7 @@
logger.warn("*****************************************************************");
logger.warn("Unsupported gradle version $gradle.gradleVersion in use.");
- logger.warn("Only version 2.11 is supported. Use this version at your own risk");
+ logger.warn("Only version 3.1 is supported. Use this version at your own risk");
if ( err != "") logger.warn(err);
logger.warn("*****************************************************************");
}
@@ -900,7 +1100,6 @@
logger.quiet("OS_ARCH: $OS_ARCH")
logger.quiet("JAVA_HOME: $JAVA_HOME")
logger.quiet("JDK_HOME: $JDK_HOME")
-logger.quiet("JIGSAW_HOME: $JIGSAW_HOME")
logger.quiet("java.runtime.version: ${javaRuntimeVersion}")
logger.quiet("java version: ${javaVersion}")
logger.quiet("java build number: ${javaBuildNumber}")
@@ -974,7 +1173,6 @@
// Each of the different compile targets will be placed in a sub directory
// of these root dirs, with the name of the dir being the name of the target
- def headerRootDir = project.file("$project.buildDir/gensrc/headers/$name")
def nativeRootDir = project.file("$project.buildDir/native/$name")
def libRootDir = project.file("$project.buildDir/libs/$name")
// For each compile target, create a javah / cc / link triplet
@@ -983,7 +1181,7 @@
def library = targetProperties.library
def properties = targetProperties.get(name)
def nativeDir = file("$nativeRootDir/${t.name}")
- def headerDir = file("$headerRootDir/${t.name}")
+ def headerDir = file("${project.buildDir}/gensrc/headers/${project.moduleName}")
// If there is not a library clause in the properties, assume it is not wanted
if (!targetProperties.containsKey(name)) {
@@ -999,30 +1197,12 @@
return
}
- def javahTask = project.task("javah${t.capital}${capitalName}", type: JavaHeaderTask, dependsOn: project.classes, group: "Build") {
- description = "Generates JNI Headers for ${name} for ${t.name}"
- if (properties.javahSource == null) {
- source(project.sourceSets.main.output.classesDir)
- } else {
- source(properties.javahSource)
- }
- if (properties.javahClasspath == null) {
- classpath = project.files(project.sourceSets.main.output.classesDir)
- classpath += project.sourceSets.main.compileClasspath
- } else {
- classpath = project.files(properties.javahClasspath)
- }
- output = headerDir
- include(properties.javahInclude)
- cleanTask.delete headerDir
- }
-
def variants = properties.containsKey("variants") ? properties.variants : [""];
variants.each { variant ->
def variantProperties = variant == "" ? properties : properties.get(variant)
def capitalVariant = variant.capitalize()
def ccOutput = variant == "" ? nativeDir : file("$nativeDir/$variant")
- def ccTask = project.task("cc${t.capital}$capitalName$capitalVariant", type: CCTask, dependsOn: javahTask, group: "Build") {
+ def ccTask = project.task("cc${t.capital}$capitalName$capitalVariant", type: CCTask, group: "Build") {
description = "Compiles native sources for ${name} for ${t.name}${capitalVariant != '' ? ' for variant ' + capitalVariant : ''}"
matches = ".*\\.c|.*\\.cpp|.*\\.m|.*\\.cc"
headers = headerDir
@@ -1042,7 +1222,7 @@
}
nativeTask.dependsOn(linkTask)
if (IS_WINDOWS && t.name == "win") {
- def rcTask = project.task("rc$capitalName$capitalVariant", type: CompileResourceTask, dependsOn: javahTask, group: "Build") {
+ def rcTask = project.task("rc$capitalName$capitalVariant", type: CompileResourceTask, group: "Build") {
description = "Compiles native sources for $name"
matches = ".*\\.rc"
compiler = variantProperties.rcCompiler
@@ -1058,7 +1238,7 @@
def useLipo = targetProperties.containsKey('useLipo') ? targetProperties.useLipo : false
if (useLipo) {
- def lipoTask = project.task("lipo${t.capital}$capitalName", type: LipoTask, dependsOn: javahTask, group: "Build") {
+ def lipoTask = project.task("lipo${t.capital}$capitalName", type: LipoTask, group: "Build") {
description = "Creates native fat library for $name for ${t.name}"
libDir = file("$libRootDir/${t.name}")
lib = file("$libRootDir/${t.name}/${library(properties.lib)}")
@@ -1068,19 +1248,27 @@
}
}
-void addJSL(Project project, String name, String pkg, Closure compile) {
+void addJSL(Project project, String name, String pkg, List addExports, Closure compile) {
def lowerName = name.toLowerCase()
- def compileCompilers = project.task("compile${name}Compilers", type: JavaCompile, dependsOn: project.compileJava) {
+ def compileCompilers = project.task("compile${name}Compilers",
+ type: JavaCompile,
+ dependsOn: project.compileJava) {
description = "Compile the $name JSL Compilers"
+
classpath = project.files(project.sourceSets.main.output.classesDir) +
project.files(project.sourceSets.jslc.output.classesDir) +
project.configurations.antlr
source = [project.file("src/main/jsl-$lowerName")]
destinationDir = project.file("$project.buildDir/classes/jsl-compilers/$lowerName")
+
+ if (addExports != null) {
+ options.compilerArgs.addAll(addExports)
+ }
}
- def generateShaders = project.task("generate${name}Shaders", dependsOn: compileCompilers) {
+ def generateShaders = project.task("generate${name}Shaders",
+ dependsOn: compileCompilers) {
description = "Generate $name shaders from JSL"
def sourceDir = project.file("src/main/jsl-$lowerName")
def destinationDir = project.file("$project.buildDir/gensrc/jsl-$lowerName")
@@ -1091,7 +1279,9 @@
}
}
- def compileHLSLShaders = project.task("compile${name}HLSLShaders", dependsOn: generateShaders, type: CompileHLSLTask) {
+ def compileHLSLShaders = project.task("compile${name}HLSLShaders",
+ dependsOn: generateShaders,
+ type: CompileHLSLTask) {
enabled = IS_WINDOWS
description = "Compile $name HLSL files into .obj files"
matches = ".*\\.hlsl"
@@ -1099,14 +1289,18 @@
source project.file("$project.buildDir/gensrc/jsl-$lowerName/$pkg")
}
- def processShaders = project.task("process${name}Shaders", dependsOn: [generateShaders, compileHLSLShaders], type: Copy, description: "Copy hlsl / frag shaders to build/resources/jsl-$lowerName") {
+ def processShaders = project.task("process${name}Shaders",
+ dependsOn: [generateShaders, compileHLSLShaders],
+ type: Copy,
+ description: "Copy hlsl / frag shaders to build/resources/jsl-$lowerName") {
from("$project.buildDir/hlsl/$name") {
include "**/*.obj"
}
from("$project.buildDir/gensrc/jsl-$lowerName") {
include("**/*.frag")
}
- into project.sourceSets.main.output.resourcesDir
+ //into project.sourceSets.main.output.resourcesDir
+ into project.moduleDir
}
project.processShaders.dependsOn(processShaders)
@@ -1164,26 +1358,15 @@
}
}
-// Task to check whether jfxrt.jar is present in the JDK
-task checkJfxrtJar {
- doLast {
- // The following path is correct when using 8u as boot jdk
- def jfxrtFile = new File("$JDK_HOME/jre/lib/ext/jfxrt.jar");
- if (jfxrtFile.exists()) {
- fail("$jfxrtFile must be removed before building sdk")
- }
- // The following path is correct when using 9 (pre-jigsaw) as boot jdk
- jfxrtFile = new File("$JDK_HOME/lib/jfxrt.jar");
- if (jfxrtFile.exists()) {
- fail("$jfxrtFile must be removed before building sdk")
- }
- }
-}
-
task updateCacheIfNeeded() {
// an empty task we can add to as needed for UPDATE_STUB_CACHE
}
+task createTestArgfiles {
+ // an empty task we can add to as needed
+}
+
+
/*****************************************************************************
* Project definitions (dependencies, etc) *
*****************************************************************************/
@@ -1240,9 +1423,11 @@
// and the ant importer collides with the 'apply plugin:java'
return
}
+
// All of our projects are java projects
+
apply plugin: "java"
- sourceCompatibility = 1.8
+ sourceCompatibility = 1.9
// Setup the repositories that we'll download libraries from. Maven Central is
// just easy for most things. The custom "ivy" repo is for downloading SWT. The way it
@@ -1273,12 +1458,6 @@
}
compileJava.dependsOn verifyJava
- compileJava.dependsOn checkJfxrtJar
-
- // Compile and run tests against the jfxrt.jar in the built sdk of the host machine
- def sdkDir = "${rootProject.buildDir}/sdk"
- def jfxrtJar = "$sdkDir/lib/jfxrt.jar"
- def testJfxrtJar = DO_BUILD_SDK_FOR_TEST ? jfxrtJar : jfxrtJarFromSdk
// At the moment the ASM library shipped with Gradle that is used to
// discover the different test classes fails on Java 8, so in order
@@ -1295,7 +1474,7 @@
if (BUILD_CLOSED && DO_JCOV) {
addJCov(project, test)
}
- classpath = files(testJfxrtJar) + classpath
+
if (IS_HEADLESS_TEST) {
systemProperty 'glass.platform', 'Monocle'
systemProperty 'monocle.platform', 'Headless'
@@ -1306,45 +1485,36 @@
}
systemProperty 'unstable.test', IS_UNSTABLE_TEST
-
- if (project.hasProperty("EXTRA_TEST_ARGS")) {
- jvmArgs EXTRA_TEST_ARGS.split(' ')
- }
}
compileTestJava {
- classpath = files(testJfxrtJar) + classpath
- }
-
- // Exclude any non-public-API classes from having javadoc generated. This block is used
- // when generating JavaDocs for a specific project. When generating the JavaDocs for the
- // entire SDK, a different javadoc command is used (see the javadoc task on the top level)
- javadoc {
- enabled = IS_BUILD_JAVADOC
- exclude("com/**/*", "Compile*", "javafx/builder/**/*", "javafx/scene/accessibility/**/*");
- executable = JAVADOC;
- options.windowTitle("JavaFX Project ${project.name} ${RELEASE_VERSION}")
- if (BUILD_CLOSED) {
- options.linksOffline(JDK_DOCS, JDK_DOCS_CLOSED);
- } else {
- options.links(JDK_DOCS);
- }
- options.addBooleanOption("XDignore.symbol.file").setValue(true);
- options.addBooleanOption("Xdoclint:none").setValue(!IS_DOC_LINT);
- options.addBooleanOption("javafx").setValue(true);
- options.addBooleanOption("use").setValue(true);
- // All doc-files are located in src/main/docs because Gradle's javadoc doesn't copy
- // over the doc-files if they are embedded with the sources. I find this arrangement
- // somewhat cleaner anyway (never was a fan of mixing javadoc files with the sources)
- doLast {
- copy {
- from "src/main/docs"
- into "$buildDir/docs/javadoc"
- }
- }
}
}
+// These strings define the module-source-path to be used in compilation.
+// They need to contain the full paths to the sources and the * will be
+// used to infer the module name that is used.
+project.ext.defaultModuleSourcePath =
+ cygpath(rootProject.projectDir.path + '/modules/*/src/main/java') +
+ File.pathSeparator +
+ cygpath(rootProject.projectDir.path + '/modules/*/build/gensrc/{java,jsl-decora,jsl-prism}')
+
+// graphics pass one
+project.ext.defaultModuleSourcePath_GraphicsOne =
+ cygpath(rootProject.projectDir.path + '/modules/*/src/main/java') +
+ File.pathSeparator +
+ cygpath(rootProject.projectDir.path + '/modules/*/build/gensrc/{java,jsl-decora,jsl-prism}')
+
+// web pass one
+project.ext.defaultModuleSourcePath_WebOne =
+ cygpath(rootProject.projectDir.path + '/modules/*/src/main/java')
+
+// Compiling the test shim files too.
+project.ext.defaultModuleSourcePathShim =
+ cygpath(rootProject.projectDir.path + '/modules/*/src/{main,shims}/java') +
+ File.pathSeparator +
+ cygpath(rootProject.projectDir.path + '/modules/*/build/gensrc/{java,jsl-decora,jsl-prism}')
+
// The "base" project is our first module and the most basic one required for
// all other modules. It is useful even for non-GUI applications.
project(":base") {
@@ -1352,15 +1522,21 @@
project.ext.moduleRuntime = true
project.ext.moduleName = "javafx.base"
- Set testInclude = [ "test/**" ]
- configureJigsawTests(project, null,
- null, testInclude,
- project.projectDir.path + "/src/test/addExports"
- )
+ sourceSets {
+ main
+ shims
+ test
+ }
dependencies {
+ testCompile group: "junit", name: "junit", version: "4.8.2"
}
+ commonModuleSetup(project, [ 'base' ])
+
+ project.ext.moduleSourcePath = defaultModuleSourcePath
+ project.ext.moduleSourcePathShim = defaultModuleSourcePathShim
+
// We need to take the VersionInfo.java file and replace the various
// properties within it
def replacements = [
@@ -1383,9 +1559,9 @@
}
}
- if (IS_COMPILE_JFR) {
- sourceSets.main.java.srcDirs += "src/main/java-jfr"
- }
+// if (IS_COMPILE_JFR) {
+// sourceSets.main.java.srcDirs += "src/main/java-jfr"
+// }
// Make sure to include $buildDir/gensrc/java that we previously created.
// We DO NOT want to include src/main/version-info
@@ -1401,40 +1577,37 @@
// that all need to be compiled.
project(":graphics") {
- apply plugin: 'antlr'
+ project.ext.buildModule = true
+ project.ext.moduleRuntime = true
+ project.ext.moduleName = "javafx.graphics"
+
+ getConfigurations().create("antlr");
sourceSets {
- antlr // antlr sources for JSLC
jslc // JSLC gramar subset
main
+ shims
shaders // generated shaders (prism & decora)
test
stub
}
- project.ext.buildModule = true
- project.ext.moduleRuntime = true
- project.ext.moduleName = "javafx.graphics"
-
- Set testInclude = [ "test/**" ]
- configureJigsawTests(project, [ "base" ],
- null, testInclude,
- project.projectDir.path + "/src/test/addExports"
- )
-
dependencies {
- compile project(":base")
- stubCompile group: "junit", name: "junit", version: "4.8.2",
- project(":base").sourceSets.test.output, sourceSets.main.output
-
- jslcCompile group: "org.antlr", name: "antlr-complete", version: "3.5.2"
+ stubCompile group: "junit", name: "junit", version: "4.8.2"
- antlr group: "org.antlr", name: "antlr-complete", version: "3.5.2"
+ antlr group: "org.antlr", name: "antlr-complete", version: "3.5.2"
}
- compileJslcJava.dependsOn(generateGrammarSource)
- compileJava.dependsOn(compileJslcJava)
+ project.ext.moduleSourcePath = defaultModuleSourcePath_GraphicsOne
+ project.ext.moduleSourcePathShim = defaultModuleSourcePathShim
+ commonModuleSetup(project, [ 'base', 'graphics' ])
+
+ List decoraAddExports = [
+ '--add-exports=javafx.graphics/com.sun.scenario.effect=ALL-UNNAMED',
+ '--add-exports=javafx.graphics/com.sun.scenario.effect.light=ALL-UNNAMED',
+ '--add-exports=javafx.graphics/com.sun.scenario.effect.impl.state=ALL-UNNAMED'
+ ]
/*
Graphics compilation is "complicated" by the generated shaders.
@@ -1454,14 +1627,55 @@
project.task("processShaders") {
// an empty task to hang the prism and decora shaders on
- }
+ }
+
+ // Generate the JSLC support grammar
+ project.task("generateGrammarSource", type: JavaExec) {
+ // use antlr to generate our grammar.
+ // note: the antlr plugin creates some issues with the other compiles
+ // so we will do this by hand
+
+ File wd = file(project.projectDir.path + "/src/jslc/antlr")
+
+ executable = JAVA
+ classpath = project.configurations.antlr
+ workingDir = wd
+ main = "org.antlr.Tool"
+
+ args = [
+ "-o",
+ "$buildDir/gensrc/antlr",
+ "com/sun/scenario/effect/compiler/JSL.g" ]
+ inputs.dir wd
+ outputs.dir file("$buildDir/gensrc/antlr")
+ }
+ sourceSets.jslc.java.srcDirs += "$buildDir/gensrc/antlr"
+
+ // and compile the JSLC support classes
+ compileJslcJava.dependsOn(generateGrammarSource)
+ compileJslcJava.classpath = project.configurations.antlr
+
+ compileJava.dependsOn(compileJslcJava)
+
+ // this task is the "second pass" compile of all of the module classes
project.task("compileFullJava", type: JavaCompile, dependsOn: processShaders) {
description = "Compile all of the graphics java classes - main and shaders"
+
classpath = configurations.compile
+
source = project.sourceSets.main.java.srcDirs
+ source += "$buildDir/gensrc/java"
source += project.sourceSets.shaders.output
+
+ project.sourceSets.shims.java.srcDirs += project.sourceSets.shaders.output
+
destinationDir = project.sourceSets.main.output.classesDir
+ options.compilerArgs.addAll([
+ '-h', "$buildDir/gensrc/headers/", // Note: this creates the native headers
+ '-implicit:none',
+ '--module-source-path', defaultModuleSourcePath
+ ] )
}
classes.dependsOn(compileFullJava)
@@ -1487,7 +1701,6 @@
// TODO need to hook this up to be executed only if PassThroughVS.h is missing or PassThroughVS.hlsl is changed
task generateD3DHeaders(group: "Build") {
enabled = IS_WINDOWS
- dependsOn javahWinPrismD3D
inputs.file "src/main/native-prism-d3d/hlsl/Mtl1PS.hlsl"
inputs.file "src/main/native-prism-d3d/hlsl/Mtl1VS.hlsl"
inputs.file "src/main/native-prism-d3d/PassThroughVS.hlsl"
@@ -1595,7 +1808,7 @@
// a new task for each of the decora files, preferring instead just to create a rule?? Also
// need "clean" tasks for each compile task.
- addJSL(project, "Decora", "com/sun/scenario/effect/impl/hw/d3d/hlsl") { sourceDir, destinationDir ->
+ addJSL(project, "Decora", "com/sun/scenario/effect/impl/hw/d3d/hlsl", decoraAddExports) { sourceDir, destinationDir ->
[[fileName: "ColorAdjust", generator: "CompileJSL", outputs: "-all"],
[fileName: "Brightpass", generator: "CompileJSL", outputs: "-all"],
[fileName: "SepiaTone", generator: "CompileJSL", outputs: "-all"],
@@ -1618,19 +1831,12 @@
classpath += files("$buildDir/classes/main")
classpath += files("$buildDir/classes/jsl-compilers/decora")
- args = ["-i", sourceDir, "-o", destinationDir, "-t", "-pkg", "com/sun/scenario/effect", "$settings.outputs", "$settings.fileName"]
+ jvmArgs += decoraAddExports
+ args += ["-i", sourceDir, "-o", destinationDir, "-t", "-pkg", "com/sun/scenario/effect", "$settings.outputs", "$settings.fileName"]
}
}
}
- task generateDecoraNativeHeaders(type: JavaHeaderTask, dependsOn: compileFullJava) {
- description = "Generates JNI Headers for Decora SSE Natives"
- source file("$buildDir/classes/main")
- include("com/sun/scenario/effect/impl/sw/sse/*");
- classpath = files("$buildDir/classes/main")
- classpath += files(project.sourceSets.jslc.output.classesDir)
- output = file("$buildDir/gensrc/headers/jsl-decora")
- }
task nativeDecora(dependsOn: compileDecoraHLSLShaders, group: "Build") {
description = "Generates JNI headers, compiles, and builds native dynamic library for Decora"
@@ -1639,7 +1845,7 @@
description = "Clean native objects for Decora"
}
- def headerDir = file("$buildDir/gensrc/headers/jsl-decora")
+ def headerDir = file("$buildDir/gensrc/headers/javafx.graphics")
def nativeRootDir = project.file("$project.buildDir/native/jsl-decora")
def libRootDir = project.file("$project.buildDir/libs/jsl-decora")
// For each compile target, create cc and link tasks
@@ -1658,7 +1864,7 @@
def capitalVariant = variant.capitalize()
def ccOutput = variant == "" ? nativeDir : file("$nativeDir/$variant")
- def ccTask = task("compileDecoraNativeShaders$capitalTarget$capitalVariant", type: CCTask, dependsOn: generateDecoraNativeHeaders) {
+ def ccTask = task("compileDecoraNativeShaders$capitalTarget$capitalVariant", type: CCTask ) {
description = "Compiles Decora SSE natives for ${t.name}${capitalVariant != '' ? ' for variant ' + capitalVariant : ''}"
matches = ".*\\.cc"
source file("$buildDir/gensrc/jsl-decora")
@@ -1680,7 +1886,7 @@
}
if (IS_WINDOWS && target == "win") {
- def rcTask = project.task("rcDecoraNativeShaders$capitalTarget$capitalVariant", type: CompileResourceTask, dependsOn: generateDecoraNativeHeaders) {
+ def rcTask = project.task("rcDecoraNativeShaders$capitalTarget$capitalVariant", type: CompileResourceTask) {
description = "Compiles native sources for Decora SSE"
matches = ".*\\.rc"
compiler = variantProperties.rcCompiler
@@ -1698,7 +1904,7 @@
}
// Prism JSL
- addJSL(project, "Prism", "com/sun/prism/d3d/hlsl") { sourceDir, destinationDir ->
+ addJSL(project, "Prism", "com/sun/prism/d3d/hlsl", null) { sourceDir, destinationDir ->
def inputFiles = fileTree(dir: sourceDir)
inputFiles.include "**/*.jsl"
inputFiles.each { file ->
@@ -1776,15 +1982,18 @@
project.ext.moduleRuntime = true
project.ext.moduleName = "javafx.controls"
- Set testInclude = [ "test/**" ]
- configureJigsawTests(project, [ "base", "graphics" ],
- null, testInclude,
- project.projectDir.path + "/src/test/addExports"
- )
+ sourceSets {
+ main
+ shims
+ test
+ }
+
+ project.ext.moduleSourcePath = defaultModuleSourcePath
+ project.ext.moduleSourcePathShim = defaultModuleSourcePathShim
+
+ commonModuleSetup(project, [ 'base', 'graphics', 'controls' ])
dependencies {
- compile project(":base"), project(":graphics")
- // TODO not sure how to specify this? processResources project(":base"), project(":graphics")
testCompile project(":graphics").sourceSets.test.output
testCompile project(":base").sourceSets.test.output
}
@@ -1797,23 +2006,21 @@
// TODO Css2Bin really should be moved out and put into buildSrc if it can be
// TODO could change script to dynamically locate all .css files and create bss for them, probably better
- // TODO also not sure there is any benefit to having css files in the jfxrt.jar at all
+ // TODO also not sure there is any benefit to having css files in the the runtime modules at all
processResources << {
- ["$buildDir/resources/main/com/sun/javafx/scene/control/skin/caspian/caspian.css",
- "$buildDir/resources/main/com/sun/javafx/scene/control/skin/caspian/caspian-no-transparency.css",
- "$buildDir/resources/main/com/sun/javafx/scene/control/skin/caspian/embedded-qvga.css",
- "$buildDir/resources/main/com/sun/javafx/scene/control/skin/caspian/embedded.css",
- "$buildDir/resources/main/com/sun/javafx/scene/control/skin/caspian/fxvk.css",
- "$buildDir/resources/main/com/sun/javafx/scene/control/skin/caspian/highcontrast.css",
- "$buildDir/resources/main/com/sun/javafx/scene/control/skin/modena/modena.css",
- "$buildDir/resources/main/com/sun/javafx/scene/control/skin/modena/modena-no-transparency.css",
- "$buildDir/resources/main/com/sun/javafx/scene/control/skin/modena/touch.css"].each { css ->
+ ["$moduleDir/com/sun/javafx/scene/control/skin/caspian/caspian.css",
+ "$moduleDir/com/sun/javafx/scene/control/skin/caspian/caspian-no-transparency.css",
+ "$moduleDir/com/sun/javafx/scene/control/skin/caspian/embedded-qvga.css",
+ "$moduleDir/com/sun/javafx/scene/control/skin/caspian/embedded.css",
+ "$moduleDir/com/sun/javafx/scene/control/skin/caspian/fxvk.css",
+ "$moduleDir/com/sun/javafx/scene/control/skin/caspian/highcontrast.css",
+ "$moduleDir/com/sun/javafx/scene/control/skin/modena/modena.css",
+ "$moduleDir/com/sun/javafx/scene/control/skin/modena/modena-no-transparency.css",
+ "$moduleDir/com/sun/javafx/scene/control/skin/modena/touch.css"].each { css ->
javaexec {
executable = JAVA
workingDir = project.projectDir
- classpath files("$buildDir/classes/main",
- project(":graphics").sourceSets.main.output,
- project(":base").sourceSets.main.output)
+ jvmArgs += patchModuleArgs
main = "com.sun.javafx.css.parser.Css2Bin"
args css
}
@@ -1831,15 +2038,19 @@
project.ext.moduleRuntime = true
project.ext.moduleName = "javafx.swing"
- dependencies {
- compile project(":base"), project(":graphics")
+ sourceSets {
+ main
+ //shims // no test shims needed
+ test
}
- Set testInclude = [ "test/**" ]
- configureJigsawTests(project, [ "base", "graphics", "controls" ],
- null, testInclude,
- null // no addExports
- )
+ project.ext.moduleSourcePath = defaultModuleSourcePath
+ project.ext.moduleSourcePathShim = defaultModuleSourcePathShim
+
+ commonModuleSetup(project, [ 'base', 'graphics', 'swing' ])
+
+ dependencies {
+ }
test {
enabled = IS_FULL_TEST && IS_AWT_TEST
@@ -1854,10 +2065,12 @@
// javafx.swt is an automatic module
project.ext.buildModule = false
+ commonModuleSetup(project, [ 'base', 'graphics' ])
+
dependencies {
- compile project(":base"), project(":graphics")
compile name: SWT_FILE_NAME
}
+
classes << {
// Copy all of the download libraries to libs directory for the sake of the IDEs
File libsDir = rootProject.file("build/libs");
@@ -1881,16 +2094,23 @@
}
}
+ compileJava.options.compilerArgs.addAll([
+ "--add-exports=javafx.graphics/com.sun.glass.ui=ALL-UNNAMED",
+ "--add-exports=javafx.graphics/com.sun.javafx.cursor=ALL-UNNAMED",
+ "--add-exports=javafx.graphics/com.sun.javafx.embed=ALL-UNNAMED",
+ "--add-exports=javafx.graphics/com.sun.javafx.stage=ALL-UNNAMED",
+ "--add-exports=javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED",
+ ])
+
test {
- if (IS_JIGSAW_TEST) {
- enabled = false // FIXME: JIGSAW -- support this with modules
- logger.info("JIGSAW Testing disabled for swt")
- } else {
- enabled = IS_FULL_TEST && IS_SWT_TEST
- if (IS_MAC) {
- enabled = false
- logger.info("SWT tests are disabled on MAC, because Gradle test runner does not handle -XstartOnFirstThread properly (https://issues.gradle.org/browse/GRADLE-3290).")
- }
+ enabled = IS_FULL_TEST && IS_SWT_TEST
+
+ enabled = false // FIXME: JIGSAW -- support this with modules
+ logger.info("JIGSAW Testing disabled for swt")
+
+ if (IS_MAC) {
+ enabled = false
+ logger.info("SWT tests are disabled on MAC, because Gradle test runner does not handle -XstartOnFirstThread properly (https://issues.gradle.org/browse/GRADLE-3290).")
}
}
}
@@ -1900,18 +2120,23 @@
project.ext.moduleRuntime = true
project.ext.moduleName = "javafx.fxml"
- Set testInclude = [ "test/**" ]
- configureJigsawTests(project, [ "base", "graphics" ],
- null, testInclude,
- project.projectDir.path + "/src/test/addExports"
- )
+ sourceSets {
+ main
+ shims
+ test
+ }
+
+ project.ext.moduleSourcePath = defaultModuleSourcePath
+ project.ext.moduleSourcePathShim = defaultModuleSourcePathShim
+
+ commonModuleSetup(project, [ 'base', 'graphics', 'swing', 'controls', 'fxml' ])
+
dependencies {
- compile project(":base"),
- project(":graphics"),
- project(":controls")
testCompile project(":graphics").sourceSets.test.output
+ testCompile project(":base").sourceSets.test.output
}
+
test {
// StubToolkit is not *really* needed here, but because some code inadvertently invokes performance
// tracker and this attempts to fire up the toolkit and this looks for native libraries and fails,
@@ -1923,40 +2148,56 @@
}
project(":jmx") {
- project.ext.buildModule = false // true
+ project.ext.buildModule = false
project.ext.moduleRuntime = false
project.ext.moduleName = "javafx.jmx"
+
+ commonModuleSetup(project, [ 'base', 'graphics', 'swing', 'controls', 'media', 'jmx' ])
+
dependencies {
- compile project(":base")
- compile project(":graphics")
- compile project(":swing")
- compile project(":media")
}
- // Tests are disabled until RT-33926 can be fixed
+ // Tests are permanently disabled
test.enabled = false
- if (!DO_BUILD_SDK_FOR_TEST) {
- def javafxMxJar = new File(TEST_SDK_DIR, "lib/javafx-mx.jar")
- [test, compileTestJava].each {
- it.classpath = files(javafxMxJar) + it.classpath
- }
- }
+ compileJava.options.compilerArgs.addAll([
+ "--add-exports=javafx.graphics/com.sun.javafx.jmx=ALL-UNNAMED",
+ "--add-exports=javafx.graphics/com.sun.scenario.animation=ALL-UNNAMED",
+ "--add-exports=javafx.graphics/com.sun.scenario.animation.jmx=ALL-UNNAMED",
+ "--add-exports=javafx.graphics/com.sun.javafx.stage=ALL-UNNAMED",
+ "--add-exports=javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED",
+ "--add-exports=javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED",
+ "--add-exports=javafx.media/com.sun.media.jfxmedia=ALL-UNNAMED",
+ "--add-exports=javafx.media/com.sun.media.jfxmedia.events=ALL-UNNAMED",
+ ])
}
project(":fxpackagerservices") {
project.ext.buildModule = COMPILE_FXPACKAGER
project.ext.moduleRuntime = false
project.ext.moduleName = "jdk.packager.services"
+
+ sourceSets {
+ main
+ //shims // no test shims needed
+ test
+ }
+
+ project.ext.moduleSourcePath = defaultModuleSourcePath
+ project.ext.moduleSourcePathShim = defaultModuleSourcePathShim
+
+ commonModuleSetup(project, [ 'base', 'graphics', 'controls' ])
+
tasks.all {
if (!COMPILE_FXPACKAGER) it.enabled = false
}
+
+ compileTestJava.enabled = false // FIXME: JIGSAW -- support this with modules
+
test {
- if (IS_JIGSAW_TEST) {
- enabled = false // FIXME: JIGSAW -- support this with modules
- logger.info("JIGSAW Testing disabled for fxpackagerservices")
- }
+ enabled = false // FIXME: JIGSAW -- support this with modules
+ logger.info("JIGSAW Testing disabled for fxpackagerservices")
}
}
@@ -1964,15 +2205,39 @@
project.ext.buildModule = COMPILE_FXPACKAGER
project.ext.moduleRuntime = false
project.ext.moduleName = "jdk.packager"
+
+ sourceSets {
+ main
+ //shims // no test shims needed
+ test
+ }
+
+ project.ext.moduleSourcePath = defaultModuleSourcePath
+ project.ext.moduleSourcePathShim = defaultModuleSourcePathShim
+
+ commonModuleSetup(project, [ 'base', 'graphics', 'controls', 'fxpackagerservices', 'fxpackager' ])
+
manifest {
attributes(
"Main-Class": "com.sun.javafx.tools.packager.Main"
)
}
+
tasks.all {
if (!COMPILE_FXPACKAGER) it.enabled = false
}
+ sourceSets {
+ main
+ antplugin {
+ java {
+ compileClasspath += main.output
+ runtimeClasspath += main.output
+ }
+ }
+ test
+ }
+
// fxpackager has a dependency on ant in order to build the ant jar,
// and as such needs to point to the apache binary repository
if (!BUILD_CLOSED) {
@@ -1984,25 +2249,65 @@
}
dependencies {
- compile group: "org.apache.ant", name: "ant", version: "1.8.2"
- compile project(":fxpackagerservices")
- testCompile project(":controls")
+ antpluginCompile group: "org.apache.ant", name: "ant", version: "1.8.2"
+
+ testCompile project(":controls"),
+ group: "org.apache.ant", name: "ant", version: "1.8.2",
+ sourceSets.antplugin.output
+ }
+
+ //Note: these should be reflected in the module-info additions passed to the JDK
+ compileJava.options.compilerArgs.addAll([
+ "--add-exports=java.base/sun.security.timestamp=jdk.packager",
+ "--add-exports=java.base/sun.security.x509=jdk.packager",
+ "--add-exports=jdk.jdeps/com.sun.tools.jdeps=jdk.packager",
+ "--add-exports=jdk.jlink/jdk.tools.jlink.internal.packager=jdk.packager",
+
+ // Note: not in extras...
+ "--add-exports=java.base/sun.security.pkcs=jdk.packager",
+ "--add-exports=java.logging/java.util.logging=jdk.packager",
+ ])
+
+ compileAntpluginJava.dependsOn([ compileJava, processResources ])
+ compileAntpluginJava.options.compilerArgs.addAll(
+ computeModulePathArgs("antlib", project.moduleChain, false))
+
+ task buildVersionFile() {
+ File dir = new File("${project.projectDir}/build/resources/antplugin/resources");
+ dir.mkdirs()
+ File versionFile = new File(dir, "/version.properties");
+ if (!versionFile.exists()) {
+ versionFile << "version=$RELEASE_VERSION\n"
+ }
+ outputs.file(versionFile)
}
- // When producing the jar, we need to relocate a few class files
+ // When producing the ant-javafx.jar, we need to relocate a few class files
// from their normal location to a resources/classes or resources/web-files
// location
- jar {
+ task antpluginJar(type: Jar, dependsOn: [ compileJava, jar, compileAntpluginJava, buildVersionFile ]) {
includeEmptyDirs = false
archiveName = "ant-javafx.jar"
- includes = ["com/sun/javafx/tools/ant/**", "com/javafx/main/**", "resources/web-files/**"]
- eachFile { FileCopyDetails details ->
- if (details.path.startsWith("com/javafx/main")) {
- details.path = "resources/classes/$details.path"
+
+ from (sourceSets.antplugin.output) {
+ eachFile { FileCopyDetails details ->
+ if (details.path.startsWith("com/javafx/main")) {
+ details.path = "resources/classes/$details.path"
+ }
}
}
+
+ from (sourceSets.main.resources) {
+ includes = [ "com/sun/javafx/tools/ant/antlib.xml" ]
+ }
+
+ from (sourceSets.main.output.resourcesDir) {
+ includes = [ "resources/web-files/**" ]
+ }
}
+ assemble.dependsOn(antpluginJar)
+
// The "man" task will create a $buildDir/man containing the man
// files for the system being built
task man(type: Copy) {
@@ -2015,6 +2320,8 @@
}
processResources.dependsOn man
+ String buildClassesDir = "${sourceSets.main.output.classesDir}/${moduleName}"
+
// Compile the native launchers. These are included in jdk.packager.jmod.
if (IS_WINDOWS && COMPILE_FXPACKAGER) {
task buildWinLauncher(type: CCTask, group: "Build") {
@@ -2031,7 +2338,7 @@
from "$buildDir/native/WinLauncher/WinLauncher.exe"
from "$MSVCR"
from "$MSVCP"
- into "$buildDir/classes/main/com/oracle/tools/packager/windows"
+ into "${buildClassesDir}/main/com/oracle/tools/packager/windows"
}
}
}
@@ -2052,7 +2359,7 @@
doLast {
copy {
from "$buildDir/native/WinLauncher/packager.dll"
- into "$buildDir/classes/main/com/oracle/tools/packager/windows"
+ into "${buildClassesDir}/com/oracle/tools/packager/windows"
}
}
}
@@ -2068,7 +2375,7 @@
doLast {
copy {
from "$buildDir/native/WinLauncherSvc/WinLauncherSvc.exe"
- into "$buildDir/classes/main/com/oracle/tools/packager/windows"
+ into "${buildClassesDir}/com/oracle/tools/packager/windows"
}
}
}
@@ -2084,7 +2391,7 @@
doLast {
copy {
from "$buildDir/native/IconSwap/IconSwap.exe"
- into "$buildDir/classes/main/com/oracle/tools/packager/windows"
+ into "${buildClassesDir}/com/oracle/tools/packager/windows"
}
}
}
@@ -2105,12 +2412,11 @@
doLast {
copy {
from "$buildDir/native/VersionInfoSwap/VersionInfoSwap.exe"
- into "$buildDir/classes/main/com/oracle/tools/packager/windows"
+ into "${buildClassesDir}/com/oracle/tools/packager/windows"
}
}
}
task compileLauncher(dependsOn: [buildWinLauncher, linkWinLibrary, buildWinLauncherSvc, buildIconSwap, linkVersionInfoSwap])
- jar.dependsOn compileLauncher;
} else if (IS_MAC && COMPILE_FXPACKAGER) {
task buildMacLauncher(type: CCTask, group: "Build") {
description = "Compiles native sources for the application co-bundle launcher"
@@ -2118,8 +2424,8 @@
source file("src/main/native/launcher/mac")
params.addAll(MAC.launcher.ccFlags)
compiler = MAC.launcher.compiler
- output(file("$buildDir/classes/main/com/oracle/tools/packager/mac"))
- outputs.file(file("$buildDir/classes/main/com/oracle/tools/packager/mac/JavaAppLauncher"))
+ output(file("${buildClassesDir}/com/oracle/tools/packager/mac"))
+ outputs.file(file("${buildClassesDir}/main/com/oracle/tools/packager/mac/JavaAppLauncher"))
eachOutputFile = { f ->
return new File(f.getParent(), "JavaAppLauncher")
}
@@ -2137,10 +2443,9 @@
objectDir = file("$buildDir/native/maclauncher/obj")
linkParams.addAll(MAC.launcherlibrary.linkFlags)
linker = MAC.launcherlibrary.linker
- lib = file("$buildDir/classes/main/com/oracle/tools/packager/mac/libpackager.dylib")
+ lib = file("${buildClassesDir}/com/oracle/tools/packager/mac/libpackager.dylib")
}
task compileLauncher(dependsOn: [buildMacLauncher, linkMacLibrary])
- jar.dependsOn compileLauncher;
} else if (IS_LINUX && COMPILE_FXPACKAGER) {
task compileLinuxLauncher(type: CCTask, group: "Build") {
description = "Compiles native sources for the application co-bundle launcher"
@@ -2155,7 +2460,7 @@
objectDir = file("$buildDir/native/linuxlauncher/launcherobj")
linkParams.addAll(LINUX.launcher.linkFlags)
linker = LINUX.launcher.linker
- lib = file("$buildDir/classes/main/com/oracle/tools/packager/linux/JavaAppLauncher")
+ lib = file("${buildClassesDir}/com/oracle/tools/packager/linux/JavaAppLauncher")
}
task compileLinuxLibrary(type: CCTask, group: "Build") {
description = "Compiles native sources for the application co-bundle launcher library"
@@ -2170,10 +2475,9 @@
objectDir = file("$buildDir/native/linuxlauncher/obj")
linkParams.addAll(LINUX.launcherlibrary.linkFlags)
linker = LINUX.launcherlibrary.linker
- lib = file("$buildDir/classes/main/com/oracle/tools/packager/linux/libpackager.so")
+ lib = file("${buildClassesDir}/com/oracle/tools/packager/linux/libpackager.so")
}
task compileLauncher(dependsOn: [linkLinuxLauncher, linkLinuxLibrary])
- jar.dependsOn compileLauncher;
}
// Builds the javapackager executable. For everything other than windows,
@@ -2244,7 +2548,8 @@
}
}
- jar.dependsOn buildJavaPackager
+ assemble.dependsOn compileLauncher;
+ assemble.dependsOn buildJavaPackager
classes << {
// Copy all of the download libraries to libs directory for the sake of the IDEs
@@ -2322,17 +2627,16 @@
}
}
+ compileTestJava.enabled = false // FIXME: JIGSAW -- support this with modules
test {
- if (IS_JIGSAW_TEST) {
- enabled = false // FIXME: JIGSAW -- support this with modules
- logger.info("JIGSAW Testing disabled for fxpackager")
- }
+ enabled = false // FIXME: JIGSAW -- support this with modules
+ logger.info("JIGSAW Testing disabled for fxpackager")
dependsOn packagerFXPackagedJar
systemProperty "RETAIN_PACKAGER_TESTS", RETAIN_PACKAGER_TESTS
systemProperty "TEST_PACKAGER_DMG", TEST_PACKAGER_DMG
systemProperty "FULL_TEST", FULL_TEST
- executable = JIGSAW_JAVA;
+ executable = JAVA;
}
def packagerDevOpts = []
@@ -2344,11 +2648,11 @@
task packagerDev(dependsOn: [jar, testClasses, packagerFakeJar], type:JavaExec) {
workingDir = project.file("build/tmp/tests/appResources/")
- executable = JIGSAW_JAVA
+ executable = JAVA
classpath = project.files("build/libs/ant-javafx.jar", "build/classes/test", "build/resources/test")
main = "hello.SimpleBundle"
args = [
- '--module-path', JIGSAW_MODULES,
+ '--module-path', JDK_JMODS,
'-o', "$projectDir/build/dev",
'-all',
packagerDevOpts
@@ -2362,7 +2666,7 @@
doLast {
exec {
- commandLine(JIGSAW_JAVAC)
+ commandLine(JAVAC)
args("-d")
args("$buildDir")
args("$sourceDir/RedistributableFiles.java")
@@ -2379,7 +2683,7 @@
doLast {
def fxmodules = ""
- if (!file("$JIGSAW_MODULES/jdk.packager.jmod").exists()) {
+ if (!file("$JDK_JMODS/jdk.packager.jmod").exists()) {
moduleProjList.each { project ->
if (fxmodules.isEmpty()) {
fxmodules = project.ext.moduleName
@@ -2391,12 +2695,12 @@
}
exec {
- commandLine(JIGSAW_JAVA)
+ commandLine(JAVA)
args("-classpath")
args("$buildDir")
args("RedistributableFiles")
args("--module-path")
- args("$JIGSAW_MODULES")
+ args("$JDK_JMODS")
args("--exclude-filelist")
args("$sourceDir/exclude_modules.list")
args("--out-file")
@@ -2423,75 +2727,65 @@
project.ext.moduleRuntime = true
project.ext.moduleName = "javafx.media"
+ sourceSets {
+ main
+ //shims // no test shims needed
+ test
+ tools {
+ java.srcDir "src/tools/java"
+ }
+ }
+
+ project.ext.moduleSourcePath = defaultModuleSourcePath
+ project.ext.moduleSourcePathShim = defaultModuleSourcePathShim
+
+ commonModuleSetup(project, [ 'base', 'graphics', 'media' ])
+
dependencies {
- compile project(":base"), project(":graphics")
}
compileJava.dependsOn updateCacheIfNeeded
- sourceSets {
- tools {
- java.srcDir "src/tools/java"
- }
+ compileJava {
+ // generate the native headers during compile
+ options.compilerArgs.addAll([
+ '-h', "${project.buildDir}/gensrc/headers"
+ ])
}
compileToolsJava {
enabled = IS_COMPILE_MEDIA
- classpath = sourceSets.main.output;
+ options.compilerArgs.addAll(project.modulePathArgs)
+ options.compilerArgs.addAll([
+ '--add-exports', 'javafx.media/com.sun.media.jfxmedia=ALL-UNNAMED',
+ ])
}
project.ext.makeJobsFlag = IS_WINDOWS && IS_DEBUG_NATIVE ? "-j1" : "-j5";
project.ext.buildType = IS_DEBUG_NATIVE ? "Debug" : "Release";
def nativeSrcDir = file("${projectDir}/src/main/native")
- def generatedHeadersDir = file("${buildDir}/gensrc/headers")
-
- task generateHeaders(dependsOn: compileJava) {
- enabled = IS_COMPILE_MEDIA
- doLast {
- def classpath = sourceSets.main.output;
- mkdir generatedHeadersDir;
-
- def classesList = ["com.sun.media.jfxmedia.logging.Logger",
- "com.sun.media.jfxmedia.track.AudioTrack",
- "com.sun.media.jfxmedia.control.VideoDataBuffer",
- "com.sun.media.jfxmedia.control.VideoFormat\$FormatTypes",
- "com.sun.media.jfxmediaimpl.NativeAudioClip",
- "com.sun.media.jfxmediaimpl.NativeMediaPlayer",
- "com.sun.media.jfxmediaimpl.NativeVideoBuffer",
- "com.sun.media.jfxmediaimpl.platform.gstreamer.GSTPlatform",
- "com.sun.media.jfxmediaimpl.platform.gstreamer.GSTMedia",
- "com.sun.media.jfxmediaimpl.platform.gstreamer.GSTMediaPlayer",
- "com.sun.media.jfxmediaimpl.NativeAudioEqualizer",
- "com.sun.media.jfxmediaimpl.NativeEqualizerBand",
- "com.sun.media.jfxmediaimpl.NativeAudioSpectrum"]
- if (IS_MAC) {
- classesList.addAll( ["com.sun.media.jfxmediaimpl.platform.osx.OSXPlatform",
- "com.sun.media.jfxmediaimpl.platform.osx.OSXMedia",
- "com.sun.media.jfxmediaimpl.platform.osx.OSXMediaPlayer"] );
- }
- exec {
- commandLine ("${JAVAH}", "-d", "${generatedHeadersDir}", "-classpath", "${classpath.asPath}");
- args classesList;
- }
- }
- }
+ def generatedHeadersDir = file("${buildDir}/gensrc/headers/${project.moduleName}")
task generateMediaErrorHeader(dependsOn: [compileToolsJava, compileJava]) {
enabled = IS_COMPILE_MEDIA
+ def headerpath = file("$generatedHeadersDir/jfxmedia_errors.h");
doLast {
- def classpath = files(sourceSets.main.output, sourceSets.tools.output);
+ def classpath = files(sourceSets.tools.output);
def sourcepath = sourceSets.main.java.srcDirs;
- def headerpath = file("$generatedHeadersDir/jfxmedia_errors.h");
def srcRoot = (sourcepath.toArray())[0];
mkdir generatedHeadersDir;
exec {
- commandLine("$JAVA", "-classpath", "${classpath.asPath}");
- args("headergen.HeaderGen", "$headerpath", "$srcRoot");
+ commandLine("$JAVA");
+ args += patchModuleArgs
+ args += [ '--add-exports=javafx.media/com.sun.media.jfxmedia=ALL-UNNAMED' ]
+ args += [ '-classpath', "${classpath.asPath}" ]
+ args += [ "headergen.HeaderGen", "$headerpath", "$srcRoot" ]
}
}
+ outputs.file(project.file("$headerpath"))
}
task buildNativeTargets {
@@ -2506,7 +2800,7 @@
// Makefile for OSX needs to know if we're building for parfait
def compileParfait = IS_COMPILE_PARFAIT ? "true" : "false"
- def buildNative = task("build${t.capital}Native", dependsOn: [generateHeaders, generateMediaErrorHeader]) {
+ def buildNative = task("build${t.capital}Native", dependsOn: [generateMediaErrorHeader]) {
enabled = targetProperties.compileMediaNative
if (!targetProperties.compileMediaNative) {
println("Not compiling native Media for ${t.name} per configuration request");
@@ -2729,14 +3023,18 @@
project.ext.moduleRuntime = true
project.ext.moduleName = "javafx.web"
- Set testInclude = [ "test/**" ]
- configureJigsawTests(project, [ "base", "graphics" ],
- null, testInclude,
- project.projectDir.path + "/src/test/addExports"
- )
+ sourceSets {
+ main
+ shims
+ test
+ }
+
+ project.ext.moduleSourcePath = defaultModuleSourcePath
+ project.ext.moduleSourcePathShim = defaultModuleSourcePathShim
+
+ commonModuleSetup(project, [ 'base', 'graphics', 'controls', 'media', 'web' ])
dependencies {
- compile project(":base"), project(":graphics"), project(":controls"), project(":media")
}
compileJava.dependsOn updateCacheIfNeeded
@@ -2749,7 +3047,35 @@
destinationDir = file("$buildDir/testing/resources")
}
+ def gensrcDir = "${buildDir}/gensrc/java"
+
+ // add in the wrappers to the compile
+ sourceSets.main.java.srcDirs += "${gensrcDir}"
+
+ if (IS_COMPILE_WEBKIT) {
+ compileJava {
+ // generate the native headers during compile
+ // only needed if we are doing the native compile
+ options.compilerArgs.addAll([
+ '-h', "${project.buildDir}/gensrc/headers"
+ ])
+ }
+ } else {
+ // Instead of compiling native wrappers, use a pre-generated version
+
+ // Copy these to a common location in the moduleSourcePath
+ def copyWrappers = project.task("copyPreGeneratedWrappers", type: Copy) {
+ enabled = (!IS_COMPILE_WEBKIT)
+
+ from "src/main/java-wrappers"
+ into "${gensrcDir}"
+ }
+
+ compileJava.dependsOn(copyWrappers);
+ }
+
test {
+ /*
if (!IS_JIGSAW_TEST) {
//TODO: support this in Jake
// Run web tests in headless mode
@@ -2757,58 +3083,22 @@
systemProperty 'monocle.platform', 'Headless'
systemProperty 'prism.order', 'sw'
}
+ */
dependsOn webArchiveJar
def testResourceDir = file("$buildDir/testing/resources")
jvmArgs "-DWEB_ARCHIVE_JAR_TEST_DIR=$testResourceDir"
}
- if (!IS_COMPILE_WEBKIT) {
- // Include wrapper classes that are otherwise generated by native build
- sourceSets.main.java.srcDirs += "src/main/java-wrappers"
- }
-
+ // generate some headers that are not part of our build
task generateHeaders(dependsOn: compileJava) {
doLast {
- def classpath = files("$buildDir/classes/main",
- project(":graphics").sourceSets.main.output.classesDir)
- def dest = file("$buildDir/gensrc/headers");
+ def dest = file("$buildDir/gensrc/headers/${project.moduleName}");
mkdir dest;
exec {
- commandLine("$JAVAH", "-d", "$dest",
- "-classpath", "${classpath.asPath}");
+ commandLine("$JAVAH", "-d", "$dest",);
args("java.lang.Character",
"java.net.IDN",
- "com.sun.webkit.ContextMenu",
- "com.sun.webkit.ContextMenuItem",
- "com.sun.webkit.CursorManager",
- "com.sun.webkit.PageCache",
- "com.sun.webkit.PopupMenu",
- "com.sun.webkit.SharedBuffer",
- "com.sun.webkit.WatchdogTimer",
- "com.sun.webkit.WebPage",
- "com.sun.webkit.LoadListenerClient",
- "com.sun.webkit.event.WCFocusEvent",
- "com.sun.webkit.event.WCKeyEvent",
- "com.sun.webkit.event.WCMouseEvent",
- "com.sun.webkit.event.WCMouseWheelEvent",
- "com.sun.webkit.graphics.GraphicsDecoder",
- "com.sun.webkit.graphics.RenderMediaControls",
- "com.sun.webkit.graphics.RenderTheme",
- "com.sun.webkit.graphics.ScrollBarTheme",
- "com.sun.webkit.graphics.WCMediaPlayer",
- "com.sun.webkit.graphics.WCGraphicsManager",
- "com.sun.webkit.graphics.WCRenderQueue",
- "com.sun.webkit.graphics.WCPath",
- "com.sun.webkit.graphics.WCPathIterator",
- "com.sun.webkit.Timer",
- "com.sun.webkit.WCFrameView",
- "com.sun.webkit.WCPasteboard",
- "com.sun.webkit.WCPluginWidget",
- "com.sun.webkit.dom.JSObject",
- "com.sun.webkit.network.SocketStreamHandle",
- "com.sun.webkit.network.URLLoader",
- "com.sun.webkit.text.TextBreakIterator",
- "com.sun.webkit.text.TextNormalizer");
+ );
}
}
}
@@ -2827,79 +3117,85 @@
def webkitOutputDir = cygpath("$buildDir/${t.name}")
def webkitConfig = IS_DEBUG_NATIVE ? "Debug" : "Release"
- def compileNativeTask = task("compileNative${t.capital}", dependsOn: generateHeaders) << {
+ def compileNativeTask = task("compileNative${t.capital}", dependsOn: [generateHeaders, compileJava]) {
println "Building Webkit configuration /$webkitConfig/ into $webkitOutputDir"
+ enabled = (IS_COMPILE_WEBKIT)
- def dependencyFile = configurations.webkit.filter(
- { File f -> f.getName().contains(classifier) }
- ).getSingleFile()
- ant.unzip(src: dependencyFile,
- dest: webkitOutputDir)
+ outputs.dir("$webkitOutputDir/$webkitConfig/DerivedSources/WebCore/nativeJava/java")
- exec {
- workingDir("$projectDir/src/main/native")
- commandLine("perl", "Tools/Scripts/set-webkit-configuration", "--$webkitConfig")
- environment(["WEBKIT_OUTPUTDIR" : webkitOutputDir])
- }
+ doLast {
+ def dependencyFile = configurations.webkit.filter(
+ { File f -> f.getName().contains(classifier) }
+ ).getSingleFile()
+ ant.unzip(src: dependencyFile,
+ dest: webkitOutputDir)
- exec {
- workingDir("$projectDir/src/main/native")
- def cmakeArgs = "-DENABLE_TOOLS=1"
- if (t.name == "win") {
- String parfaitPath = IS_COMPILE_PARFAIT ? System.getenv().get("PARFAIT_PATH") + ";" : "";
- Map environmentSettings = new HashMap(WINDOWS_NATIVE_COMPILE_ENVIRONMENT)
- environmentSettings["PATH"] = parfaitPath + "$WINDOWS_VS_PATH"
- /* To build with ICU:
- 1. Download http://javaweb.us.oracle.com/jcg/fx-webrevs/RT-17164/WebKitLibrariesICU.zip
- and unzip it to WebKitLibraries folder.
- 2. Copy DLLs from
- WebKitLibrariesICU.zip\WebKitLibraries\import\runtime
- to %windir%\system32
- 3. Uncomment the line below
- */
- // args("--icu-unicode")
- } else if (t.name == "mac") {
- // Add any osx specific flags.
- } else if (t.name == "linux") {
- if (!IS_64) {
- cmakeArgs = "-DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32"
- }
- } else if (t.name.startsWith("arm")) {
- fail("ARM target is not supported as of now.")
+ exec {
+ workingDir("$projectDir/src/main/native")
+ commandLine("perl", "Tools/Scripts/set-webkit-configuration", "--$webkitConfig")
+ environment(["WEBKIT_OUTPUTDIR" : webkitOutputDir])
}
- if (IS_COMPILE_PARFAIT) {
+ exec {
+ workingDir("$projectDir/src/main/native")
+ def cmakeArgs = "-DENABLE_TOOLS=1"
+ if (t.name == "win") {
+ String parfaitPath = IS_COMPILE_PARFAIT ? System.getenv().get("PARFAIT_PATH") + ";" : "";
+ Map environmentSettings = new HashMap(WINDOWS_NATIVE_COMPILE_ENVIRONMENT)
+ environmentSettings["PATH"] = parfaitPath + "$WINDOWS_VS_PATH"
+ /* To build with ICU:
+ 1. Download http://javaweb.us.oracle.com/jcg/fx-webrevs/RT-17164/WebKitLibrariesICU.zip
+ and unzip it to WebKitLibraries folder.
+ 2. Copy DLLs from
+ WebKitLibrariesICU.zip\WebKitLibraries\import\runtime
+ to %windir%\system32
+ 3. Uncomment the line below
+ */
+ // args("--icu-unicode")
+ } else if (t.name == "mac") {
+ // Add any osx specific flags.
+ } else if (t.name == "linux") {
+ if (!IS_64) {
+ cmakeArgs = "-DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32"
+ }
+ } else if (t.name.startsWith("arm")) {
+ fail("ARM target is not supported as of now.")
+ }
+
+ if (IS_COMPILE_PARFAIT) {
+ environment([
+ "COMPILE_PARFAIT" : "true"
+ ])
+ cmakeArgs = "-DCMAKE_C_COMPILER=parfait-gcc -DCMAKE_CXX_COMPILER=parfait-g++"
+ }
+
environment([
- "COMPILE_PARFAIT" : "true"
+ "JAVA_HOME" : JDK_HOME,
+ "WEBKIT_OUTPUTDIR" : webkitOutputDir,
])
- cmakeArgs = "-DCMAKE_C_COMPILER=parfait-gcc -DCMAKE_CXX_COMPILER=parfait-g++"
- }
- environment([
- "JAVA_HOME" : JDK_HOME,
- "WEBKIT_OUTPUTDIR" : webkitOutputDir,
- ])
+ def targetCpuBitDepthSwitch = ""
+ if (IS_64) {
+ targetCpuBitDepthSwitch = "--64-bit"
+ } else {
+ targetCpuBitDepthSwitch = "--32-bit"
+ }
- def targetCpuBitDepthSwitch = ""
- if (IS_64) {
- targetCpuBitDepthSwitch = "--64-bit"
- } else {
- targetCpuBitDepthSwitch = "--32-bit"
+ commandLine("perl", "Tools/Scripts/build-webkit",
+ "--java", "--icu-unicode", targetCpuBitDepthSwitch,
+ "--cmakeargs=${cmakeArgs}")
}
- commandLine("perl", "Tools/Scripts/build-webkit",
- "--java", "--icu-unicode", targetCpuBitDepthSwitch,
- "--cmakeargs=${cmakeArgs}")
- }
+ def library = rootProject.ext[t.upper].library
+ copy {
+ from "$webkitOutputDir/$webkitConfig/lib/${library('jfxwebkit')}"
+ into "$buildDir/libs/${t.name}"
+ }
+ copy {
+ from "$webkitOutputDir/$webkitConfig/lib/${library('DumpRenderTreeJava')}"
+ into "$buildDir/test/${t.name}"
+ }
- def library = rootProject.ext[t.upper].library
- copy {
- from "$webkitOutputDir/$webkitConfig/lib/${library('jfxwebkit')}"
- into "$buildDir/libs/${t.name}"
- }
- copy {
- from "$webkitOutputDir/$webkitConfig/lib/${library('DumpRenderTreeJava')}"
- into "$buildDir/test/${t.name}"
}
}
@@ -2916,17 +3212,31 @@
compileNativeTask.dependsOn rcTask
}
- def compileGeneratedTask = task("compileGenerated${t.capital}", type: JavaCompile, dependsOn: compileNativeTask) {
- def gensrcDir = "$webkitOutputDir/$webkitConfig/DerivedSources/WebCore/nativeJava/java"
- doFirst {
+ def copyGeneratedTask = task("copyGenerated${t.capital}", dependsOn: [compileJava, compileNativeTask]) {
+ enabled = (IS_COMPILE_WEBKIT)
+
+ outputs.dir "${gensrcDir}"
+
+ doLast{
copy {
from "$projectDir/src/main/java-wrappers/com/sun/webkit/dom/EventListenerImpl.java"
- into "$gensrcDir/com/sun/webkit/dom"
+ into "${gensrcDir}/com/sun/webkit/dom"
+ }
+ copy {
+ from "$webkitOutputDir/$webkitConfig/DerivedSources/WebCore/nativeJava/java"
+ into "${gensrcDir}"
}
}
- classpath = files(project.sourceSets.main.output.classesDir)
- source gensrcDir
+ }
+
+ def compileGeneratedTask = task("compileGenerated${t.capital}", type: JavaCompile, dependsOn: copyGeneratedTask) {
destinationDir = file("$buildDir/classes/main")
+ classpath = configurations.compile
+ source = project.sourceSets.main.java.srcDirs
+ options.compilerArgs.addAll([
+ '-implicit:none',
+ '--module-source-path', defaultModuleSourcePath
+ ])
}
compileGenerated.dependsOn compileGeneratedTask
@@ -2947,7 +3257,7 @@
}
if (IS_COMPILE_WEBKIT) {
- jar.dependsOn compileGenerated, drtJar
+ assemble.dependsOn compileGenerated, drtJar
}
}
@@ -2958,6 +3268,10 @@
// when FULL_TEST is specified, and each test runs in its own JVM
project(":systemTests") {
+ project.ext.buildModule = false
+ project.ext.moduleRuntime = false
+ project.ext.moduleName = "systemTests"
+
dependencies {
testCompile project(":graphics").sourceSets.test.output
testCompile project(":base").sourceSets.test.output
@@ -2965,14 +3279,70 @@
testCompile project(":swing").sourceSets.test.output
}
- Set testInclude = [ "test/**" ]
- configureJigsawTests(project, [ "base", "graphics", "controls", "swing", "fxml", "web" ],
- null, testInclude,
- project.projectDir.path + "/src/test/addExports"
- )
+ commonModuleSetup(project, [ 'base', 'graphics', 'controls', 'media', 'web', 'swing', 'fxml' ])
+
+ File patchPolicyFile = new File(project.buildDir, TESTJAVAPOLICYFILE);
+ File runArgsFile = new File(project.buildDir,RUNARGSFILE);
+
+ def sts = task("systemTestSetup") {
+ outputs.file(patchPolicyFile)
+ outputs.file(runArgsFile)
+
+ doLast() {
+ runArgsFile.delete()
+ patchPolicyFile.delete()
+
+ logger.info("Creating patchmodule.args file ${runArgsFile}")
+
+ // Create an argfile with the information needed to launch
+ // the stand alone system unit tests.
+
+ //First add in all of the patch-module args we use for the
+ //normal unit tests
+ testPatchModuleArgs.each { str ->
+ runArgsFile << "${str}\n"
+ }
+
+ // Now add in the working classpath elements (junit, test classes...)
+ runArgsFile << "-cp \"\\\n"
+ test.classpath.each() { elem ->
+ def e = cygpath("${elem}")
+ runArgsFile << " ${e}${File.pathSeparator}\\\n"
+ }
+ runArgsFile << "\"\n"
+
+ // Now create a policy file with full paths matching the patched modules
+ // we have provided. This needs to be in sync with testPatchModuleArgs
+ moduleProjList.each { project ->
+ if (project.hasProperty("moduleName") && project.buildModule) {
+ File dir;
+ if (test && project.sourceSets.hasProperty('shims')) {
+ dir = new File(project.sourceSets.shims.output.classesDir, project.ext.moduleName);
+ } else {
+ dir = new File(project.sourceSets.main.output.classesDir, project.ext.moduleName);
+ }
+
+ String themod = dir.toURI()
+ patchPolicyFile << "grant codeBase \"${themod}\" {\n" +
+ " permission java.security.AllPermission;\n" +
+ "};\n"
+ }
+ }
+ }
+ }
+
+ test.dependsOn(sts)
+ test.dependsOn(createTestArgfiles);
test {
enabled = IS_FULL_TEST
+
+ // Properties passed to test.util.Util
+ systemProperties 'worker.debug': IS_WORKER_DEBUG
+ systemProperties 'worker.patchmodule.file': cygpath(runArgsFile.path)
+ systemProperties 'worker.patch.policy': cygpath(patchPolicyFile.path)
+ systemProperties 'worker.java.cmd': JAVA
+
if (!IS_USE_ROBOT) {
// Disable all robot-based visual tests
exclude("test/robot/**");
@@ -2993,8 +3363,6 @@
// javac API is lacking support for it. So what we'll do is find any Compile
// task and manually provide the options necessary to fire up the
// compiler with the right settings.
- //
- // Also, we need to remove jfxrt.jar from the ext classpath (if it is there)
tasks.withType(JavaCompile) { compile ->
if (compile.options.hasProperty("useAnt")) {
compile.options.useAnt = true
@@ -3005,11 +3373,27 @@
compile.options.debug = true // we always generate debugging info in the class files
compile.options.debugOptions.debugLevel = IS_DEBUG_JAVA ? "source,lines,vars" : "source,lines"
compile.options.fork = true
+
compile.options.forkOptions.executable = JAVAC
+
compile.options.warnings = IS_LINT
- compile.options.compilerArgs = ["-XDignore.symbol.file", "-encoding", "UTF-8"]
- if (!DO_BUILD_SDK_FOR_TEST) {
- compile.classpath = files(jfxrtJarFromSdk) + compile.classpath
+
+ compile.options.compilerArgs += ["-XDignore.symbol.file", "-encoding", "UTF-8"]
+
+ // If I am a module....
+ if (project.hasProperty('moduleSourcePath') &&
+ (project.hasProperty('buildModule') && project.buildModule)) {
+ project.compileJava {
+ options.compilerArgs.addAll([
+ '-implicit:none',
+ '--module-source-path', project.moduleSourcePath
+ ])
+ }
+ // no jars needed for modules
+ project.jar.enabled = false
+
+ // and redirect the resources into the module
+ project.processResources.destinationDir = project.moduleDir
}
// Add in the -Xlint options
@@ -3018,28 +3402,57 @@
compile.options.compilerArgs += "-Xlint:$s"
}
}
+ } // tasks with javaCompile
+
+ if (project.hasProperty('moduleSourcePathShim') &&
+ project.sourceSets.hasProperty('shims')) {
+
+ // sync up the obvious source directories with the shims
+ // others (like the shaders in graphics) should be added in there
+ project.sourceSets.shims.java.srcDirs += project.sourceSets.main.java.srcDirs
+ project.sourceSets.shims.java.srcDirs += "$buildDir/gensrc/java"
+
+ project.compileShimsJava {
+ options.compilerArgs.addAll([
+ '-implicit:none',
+ '--module-source-path', project.moduleSourcePathShim
+ ])
+ }
+
+ compileTestJava.dependsOn(compileShimsJava)
}
-}
-// fxpackager requires JDK 9 to compile
-project(":fxpackager") {
- tasks.withType(JavaCompile) { compile ->
- compile.options.forkOptions.executable = JIGSAW_JAVAC
- compile.options.compilerArgs = [
- "--add-exports", "java.base/sun.security.pkcs=ALL-UNNAMED",
- "--add-exports", "java.base/sun.security.timestamp=ALL-UNNAMED",
- "--add-exports", "java.base/sun.security.x509=ALL-UNNAMED",
- "-encoding", "UTF-8"]
+ if (project.hasProperty('modulePathArgs')) {
+ project.compileJava.options.compilerArgs.addAll(modulePathArgs)
}
-}
-// fxpackagerservices requires JDK 9 to compile
-project(":fxpackagerservices") {
- tasks.withType(JavaCompile) { compile ->
- compile.options.forkOptions.executable = JIGSAW_JAVAC
- compile.options.compilerArgs = [
- "-encoding", "UTF-8"]
+ if (project.hasProperty('testModulePathArgs')) {
+ project.compileTestJava.options.compilerArgs.addAll(testModulePathArgs)
+ }
+
+ if (project.hasProperty('testPatchModuleArgs')) {
+ project.test.jvmArgs += testPatchModuleArgs
+ }
+
+ if (project.hasProperty('addExports')) {
+ project.compileTestJava.options.compilerArgs.addAll(addExports);
+ project.test.jvmArgs += addExports
+ }
+
+ if (rootProject.hasProperty("EXTRA_TEST_ARGS") && project.hasProperty('test')) {
+ EXTRA_TEST_ARGS.split(' ').each() { e ->
+ project.test.jvmArgs += e
+ }
+ }
+
+ if (rootProject.hasProperty("EXTRA_COMPILE_ARGS") && project.hasProperty('compileJava')) {
+ project.compileJava.options.compilerArgs.addAll(EXTRA_COMPILE_ARGS.split(' '))
}
+
+ if (rootProject.hasProperty("EXTRA_COMPILE_ARGS") && project.hasProperty('compileTestJava')) {
+ project.compileTestJava.options.compilerArgs.addAll(EXTRA_COMPILE_ARGS.split(' '))
+ }
+
}
/******************************************************************************
@@ -3073,7 +3486,20 @@
}
}
-task javadoc(type: Javadoc) {
+task createMSPfile() {
+ group = "Build"
+ File mspFile = new File(rootProject.buildDir,MODULESOURCEPATH)
+ outputs.file(mspFile)
+
+ doLast {
+ mspFile.delete()
+ mspFile << "--module-source-path\n"
+ mspFile << defaultModuleSourcePath
+ mspFile << "\n"
+ }
+}
+
+task javadoc(type: Javadoc, dependsOn: createMSPfile) {
enabled = IS_BUILD_JAVADOC
group = "Basic"
description = "Generates the JavaDoc for all the public API"
@@ -3085,20 +3511,7 @@
[it.sourceSets.main.java]
}));
setDestinationDir(new File(buildDir, 'javadoc'));
- // FIXME: The following is a workaround for JDK-8151191; it should be
- // reverted once that bug is fixed
- classpath += files(projectsToDocument.collect { project ->
- project.sourceSets.main.java.srcDirs
- });
- /*
- // Might need a classpath
- classpath = files(projectsToDocument.collect { project ->
- project.sourceSets.main.compileClasspath
- });
- classpath += files(projectsToDocument.collect { project ->
- project.sourceSets.main.output
- });
- */
+
exclude("com/**/*", "Compile*", "javafx/builder/**/*", "javafx/scene/accessibility/**/*");
options.windowTitle("${javadocTitle}")
options.header("${javadocHeader}")
@@ -3112,6 +3525,12 @@
options.addBooleanOption("Xdoclint:none").setValue(!IS_DOC_LINT);
options.addBooleanOption("javafx").setValue(true);
options.addBooleanOption("use").setValue(true);
+
+ options.setOptionFiles([
+ new File("${rootProject.buildDir}/${COMPILEARGSFILE}"),
+ new File(rootProject.buildDir,MODULESOURCEPATH)
+ ]);
+
doLast {
projectsToDocument.each { p ->
copy {
@@ -3124,14 +3543,6 @@
dependsOn(projectsToDocument.collect { project -> project.getTasksByName("classes", true)});
}
-task jfxrt() {
- if (DO_BUILD_SDK_FOR_TEST) {
- rootProject.getTasksByName("compileTestJava", true).each { t ->
- if (t.enabled) t.dependsOn(jfxrt)
- }
- }
-}
-
task sdk() {
if (DO_BUILD_SDK_FOR_TEST) {
rootProject.getTasksByName("test", true).each { t ->
@@ -3249,50 +3660,17 @@
// Create the legacy sdk from the modular-sdk
compileTargets { t ->
- def targetProperties = project.ext[t.upper]
- def platformPrefix = targetProperties.platformPrefix
- def sdkDirName = "${platformPrefix}sdk"
- def modularSdkDirName = "${platformPrefix}modular-sdk"
- def modularSdkDir = "${rootProject.buildDir}/${modularSdkDirName}"
- def modulesDir = "${modularSdkDir}/modules"
- def modulesCmdsDir = "${modularSdkDir}/modules_cmds"
- def modulesLibsDir = "${modularSdkDir}/modules_libs"
-
- // The jfxrt task is responsible for creating the legacy jfxrt.jar. A developer may
- // have multiple SDK's on their system at any one time, depending on which
- // cross compiles they have done. For example, I might have:
- // build/ios-sdk/lib/jfxrt.jar
- // build/armhf-sdk/lib/jfxrt.jar
- // and so forth. The default host build will always install into 'sdk'
- // allowing for uses where a known sdk path is needed (like IDEs)
- // build/sdk/lib/jfxrt.jar
- // This arrangement allows for multiple independent SDKs to
- // exist on a developer's system.
- def jfxrtTask = task("jfxrt$t.capital", type: Jar) {
- group = "Basic"
- description = "Creates the jfxrt.jar for the $t.name target"
- archiveName = "build/${sdkDirName}/lib/jfxrt.jar";
- includeEmptyDirs = false
-
- moduleProjList.each { project ->
- if (project.ext.moduleRuntime) {
- from("${modulesDir}/${project.ext.moduleName}");
- }
- }
-
- dependsOn(subprojects.collect { project -> project.getTasksByName("assemble", true)});
- }
-
- def jfxrtIndexTask = task("jfxrtIndex$t.capital") {
- //the following is a workaround for the lack of indexing in gradle 1.4 through 1.7
- dependsOn(jfxrtTask)
-
- doLast() {
- ant.jar (update: true, index: true, destfile: jfxrtTask.archiveName)
- }
- }
- jfxrt.dependsOn(jfxrtIndexTask)
+ //def targetProperties = project.ext[t.upper]
+ //def platformPrefix = targetProperties.platformPrefix
+ //def sdkDirName = "${platformPrefix}sdk"
+ //def modularSdkDirName = "${platformPrefix}modular-sdk"
+ //def modularSdkDir = "${rootProject.buildDir}/${modularSdkDirName}"
+ //def modulesDir = "${modularSdkDir}/modules"
+ //def modulesCmdsDir = "${modularSdkDir}/modules_cmds"
+ //def modulesLibsDir = "${modularSdkDir}/modules_libs"
+ // FIXME: This is not the right place to do this, but it is
+ // basically what we need to do to build this
def javafxSwtTask = task("javafxSwt$t.capital", type: Jar) {
enabled = COMPILE_SWT
group = "Basic"
@@ -3313,158 +3691,49 @@
ant.jar (update: true, index: true, destfile: javafxSwtTask.archiveName)
}
}
- jfxrt.dependsOn(javafxSwtIndexTask)
-
- def jmxTask = task ("jmx${t.capital}", type: Jar) {
- group = "Basic"
- description = "Creates the javafx-mx.jar"
- archiveName = "build/${sdkDirName}/lib/javafx-mx.jar";
- includeEmptyDirs = false
- from project(":jmx").buildDir.path + "/classes/main"
- from project(":jmx").buildDir.path + "/resources/main"
- dependsOn project(":jmx").assemble
- }
- // The 'sdk' task will build the rest of the legacy SDK, and depends
- // on the 'jfxrtTask' task. After executing this task the sdk bundle for
- // the current COMPILE_TARGETS will be fully created.
def sdkTask = task("sdk$t.capital") {
group = "Basic"
- description = "Creates the SDK for $t.name"
- doLast {
- copy {
- moduleProjList.each { project ->
- from "${modulesLibsDir}/${project.ext.moduleName}"
- }
- into "build/${sdkDirName}/lib"
- exclude("*.dll")
- }
- copy {
- moduleProjList.each { project ->
- from "${modulesLibsDir}/${project.ext.moduleName}"
- }
- into "build/${sdkDirName}/bin"
- include("*.dll")
- }
-
- copy {
- moduleProjList.each { project ->
- from "${modulesCmdsDir}/${project.ext.moduleName}"
- }
- into "build/${sdkDirName}/bin"
- }
-
- // FIXME: JIGSAW -- update this for modules
- // Copy over the javadocs that were generated. This is done rather than just generating
- // the docs into the "right place" because for a cross-compile you only need one set of
- // docs but need to have a copy in each created sdk
- if (IS_BUILD_JAVADOC) {
- copy {
- from "build/javadoc"
- into "build/${sdkDirName}/docs/api"
- }
- }
-
- // FIXME: JIGSAW -- update this for modules
- // Copy over the javafx-src bundle
- if (IS_BUILD_SRC_ZIP) {
- copy {
- from "build/javafx-src.zip"
- into "build/${sdkDirName}"
- }
- }
-
- // FIXME: JIGSAW -- update this for modules
- // Copy over the javapackager man files
- copy {
- from "${project(":fxpackager").buildDir}/man"
- into "build/${sdkDirName}/man"
- }
- }
- dependsOn(jmxTask);
- dependsOn(jfxrtIndexTask)
dependsOn(javafxSwtIndexTask)
dependsOn(javadoc)
- dependsOn(src)
- }
-
- def generateSymbols = targetProperties.containsKey('generateSymbols') ? targetProperties.generateSymbols : false
- if (generateSymbols) {
- def exportedSymbolsTask = project.task("exportedSymbols${t.capital}", type: ExportedSymbolsTask, dependsOn: sdkTask, group: "Build") {
- description = "Generates exported symbols file for iOS build (from .a libraries)"
- def libDirName = "build/${sdkDirName}/$targetProperties.libDest"
- libDir = file("$libDirName")
- outputFile = file("$libDirName/exported.symbols")
- excludes = targetProperties.generateSymbolsExcludes
- }
- sdk.dependsOn(exportedSymbolsTask)
}
sdk.dependsOn(sdkTask)
}
-/*
- * This clause changes the way we handle a build.gradle within ./apps
- * It does a few things:
- * modifies the classpath used to include the built runttime classes
- * provides for copying the build applications to the artifacts tree
- *
- * The applications to be built will be under ./apps, but also must
- * be listed in the applications listed in the setting variable: JFXApplications
- */
-ext.JFXRT_CP =
- files(
- project(":base").sourceSets.main.output.classesDir,
- project(":graphics").sourceSets.main.output.classesDir,
- project(":controls").sourceSets.main.output.classesDir,
- project(":fxml").sourceSets.main.output.classesDir,
- project(":swing").sourceSets.main.output.classesDir, //NOTE - used by 3Dviewer
- "${project(":media").buildDir}/classes/main",
- "${project(":web").buildDir}/classes/main",
- )
-
project(":apps") {
// The apps build is Ant based, and gradle lets us "import" ant build.xml
// into our configuration.
- ant.importBuild 'build.xml'
-
compileTargets { t ->
- // The apps build is Ant based, and gradle lets us "import" ant apps/build.xml
- // into our configuration.
+ List params = []
+
+ params << "-DtargetBld=$t.name"
- // override the apps build.xml with an explicit pointer to our jar.
- def platformPrefix = rootProject.ext[t.upper].platformPrefix
- def sdkDirName = "${platformPrefix}sdk"
- def jfxrtJar = "${rootProject.buildDir}/${sdkDirName}/lib/jfxrt.jar"
+ if (!rootProject.ext[t.upper].compileSwing) {
+ params << "-DJFX_CORE_ONLY=true"
+ }
+ params << "-Dplatforms.JDK_1.9.home=${rootProject.ext.JDK_HOME}"
+ params << "-Dcompile.patch=@${rootProject.buildDir}/${COMPILEARGSFILE}"
+ params << "-Drun.patch=@${rootProject.buildDir}/${RUNARGSFILE}"
def appsJar = project.task("appsJar${t.capital}") {
dependsOn(sdk)
doLast() {
- ant.properties['targetBld'] = "$t.name"
- if (!rootProject.ext[t.upper].compileSwing) {
- ant.properties['JFX_CORE_ONLY'] = 'true'
- }
- ant.properties['jfxbuild.jfxrt.jar'] = jfxrtJar
- ant.properties['platforms.JDK_1.8.home'] = "${rootProject.ext.JDK_HOME}"
- ant.project.executeTarget("sampleAppsJar")
- ant.project.executeTarget("scenebuilderSampleAppsJar")
- if (!t.name.startsWith("arm")) {
- ant.project.executeTarget("scenebuilderAppJar")
- }
+ ant(t.name,
+ projectDir.path,
+ "appsJar",
+ params);
}
}
rootProject.appsjar.dependsOn(appsJar)
- def appsClean = project.task("appsClean${t.capital}") {
+ def appsClean = project.task("clean${t.capital}") {
doLast() {
- ant.properties['targetBld'] = "$t.name"
- ant.properties['platforms.JDK_1.8.home'] = "${rootProject.ext.JDK_HOME}"
- ant.project.executeTarget("sampleAppsClean")
- ant.project.executeTarget("scenebuilderSampleAppsClean")
- if (!t.name.startsWith("arm")) {
- ant.project.executeTarget("scenebuilderAppClean")
- }
+ ant(t.name,
+ project.projectDir.path,
+ "clean",
+ params);
}
}
rootProject.clean.dependsOn(appsClean)
@@ -3496,9 +3765,10 @@
def modulesSrcDir = "${modularSdkDir}/modules_src"
def modulesConfDir = "${modularSdkDir}/modules_conf"
def modulesMakeDir = "${modularSdkDir}/make"
- final File patchmoduleFile = file("${rootProject.buildDir}/patchmodule.args")
+ final File runArgsFile = file("${rootProject.buildDir}/${RUNARGSFILE}")
+ final File compileArgsFile = file("${rootProject.buildDir}/${COMPILEARGSFILE}")
- project.files(patchmoduleFile);
+ project.files(runArgsFile);
def zipTask = project.task("buildModuleZip$t.capital", type: Zip, group: "Build") {
enabled = IS_BUILD_MODULE_ZIP
@@ -3531,6 +3801,7 @@
copy {
from srcClassesDir
into dstClassesDir
+ exclude("module-info.class")
}
def srcCmdsDir = "${buildDir}/${platformPrefix}module-bin"
@@ -3548,10 +3819,10 @@
}
// Copy module-info.java
- def srcModuleInfoDir = "${project.projectDir}/src/main/module-info"
+ def srcModuleInfoFile = "${project.projectDir}/src/main/java/module-info.java"
def dstModuleInfoDir = "${modulesSrcDir}/${moduleName}"
copy {
- from srcModuleInfoDir
+ from srcModuleInfoFile
into dstModuleInfoDir
if (!IS_COMPILE_JFR && project.name.equals("base")) {
filter { line-> line.contains("requires jdk.jfr;") ? "" : line }
@@ -3568,15 +3839,53 @@
}
// 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")) {
dependencyRoots = [dependencyRoots, closedModuleDepedencies].flatten()
}
- copy {
- dependencyRoots.each { root ->
- from root
+
+ Map extras = [:]
+
+ dependencyRoots.each { root ->
+ FileTree ft = fileTree(root).include('**/*.extra')
+ ft.each() { e->
+ String usename = e.path
+ String filePath = e.getAbsolutePath()
+ String folderPath = root.getAbsolutePath()
+ if (filePath.startsWith(folderPath)) {
+ usename = filePath.substring(folderPath.length() + 1);
+ }
+ if (extras.containsKey(usename)) {
+ List lines = extras.get(usename)
+ e.eachLine { line ->
+ line = line.trim()
+ if (line.contains("exports")) {
+ lines << line
+ }
+ }
+
+ } else {
+ List lines = []
+ e.eachLine { line ->
+ if (line.contains("exports")) {
+ lines << line.trim()
+ }
+ }
+ extras.put(usename,lines)
+ }
+ }
+ }
+ extras.keySet().each() { e->
+ File f = new File(modulesSrcDir, e)
+ f.getParentFile().mkdirs()
+ f.delete()
+
+ extras.get(e).unique().each() { l->
+ f << l
+ f << "\n"
}
- into modulesSrcDir
}
// concatecate java.policy files into a single file
@@ -3595,24 +3904,38 @@
zipTask.dependsOn(buildModulesTask);
buildModules.dependsOn(buildModulesTask)
- def buildModulesPatchTask = task("buildModulesPatch$t.capital", group: "Build") {
+ def buildRunArgsTask = task("buildRunArgs$t.capital",
+ group: "Build", dependsOn: buildModulesTask) {
+ outputs.file(runArgsFile);
doLast() {
- patchmoduleFile.delete()
+ Listlibpath = []
+ Listmodpath = []
- logger.info("Creating patchmodule.args file ${patchmoduleFile}")
- String thepath=cygpath("${rootProject.buildDir}/sdk/${targetProperties.libDest}")
-
- patchmoduleFile << "-Djava.library.path=${thepath}\n"
moduleProjList.each { project ->
def moduleName = project.ext.moduleName
def dstModuleDir = cygpath("${modulesDir}/${moduleName}")
- patchmoduleFile << "--patch-module ${moduleName}=\"${dstModuleDir}\"\n"
+ modpath << "${moduleName}=${dstModuleDir}"
}
+
+ writeRunArgsFile(runArgsFile, computeLibraryPath(true), modpath)
}
}
+ buildModules.dependsOn(buildRunArgsTask)
- buildModulesPatchTask.dependsOn(buildModulesTask)
- buildModules.dependsOn(buildModulesPatchTask)
+ def buildCompileArgsTask = task("buildCompileArgs$t.capital",
+ group: "Build", dependsOn: buildModulesTask) {
+ outputs.file(compileArgsFile);
+ doLast() {
+ List modlist = []
+ moduleProjList.each { project ->
+ def moduleName = project.ext.moduleName
+ def dstModuleDir = "${modulesDir}/${moduleName}"
+ modlist << dstModuleDir
+ }
+ writeCompileArgsFile(compileArgsFile, modlist);
+ }
+ }
+ buildModules.dependsOn(buildCompileArgsTask)
def isWindows = IS_WINDOWS && t.name == "win";
def isMac = IS_MAC && t.name == "mac";
@@ -3623,8 +3946,7 @@
dependsOn(project.assemble)
def buildDir = project.buildDir
def sourceBuildDirs = [
- "${buildDir}/classes/main",
- "${buildDir}/resources/main"
+ "${buildDir}/classes/main/${project.moduleName}",
]
doLast {
def moduleClassesDir = "$buildDir/${platformPrefix}module-classes"
@@ -3837,18 +4159,18 @@
} else {
if (t.name != "android" && t.name != "dalvik" ) {
[ "fxplugins", "gstreamer-lite", "jfxmedia" ].each { name ->
- from ("$LIBRARY_STUB/${library(name)}") }
+ from ("$MEDIA_STUB/${library(name)}") }
}
if (t.name == "mac") {
// copy libjfxmedia_{avf,qtkit}.dylib if they exist
[ "jfxmedia_qtkit", "jfxmedia_avf", "glib-lite" ].each { name ->
- from ("$LIBRARY_STUB/${library(name)}") }
+ from ("$MEDIA_STUB/${library(name)}") }
} else if (t.name == "linux") {
- from(LIBRARY_STUB) { include "libavplugin*.so" }
+ from(MEDIA_STUB) { include "libavplugin*.so" }
}
else if (t.name != "android" && t.name != "dalvik" ) {
- from ("$LIBRARY_STUB/${library("glib-lite")}")
+ from ("$MEDIA_STUB/${library("glib-lite")}")
}
}
}
@@ -3863,7 +4185,7 @@
from ("${webProject.buildDir}/libs/${t.name}/${library('jfxwebkit')}")
} else {
if (t.name != "android" && t.name != "ios" && t.name != "dalvik") {
- from ("$LIBRARY_STUB/${library('jfxwebkit')}")
+ from ("$WEB_STUB/${library('jfxwebkit')}")
}
}
}
@@ -3899,216 +4221,69 @@
}
buildModulesTask.dependsOn(buildModuleLibsTask)
- def sdkTask = tasks.getByName("sdk${t.capital}");
- sdkTask.dependsOn(buildModulesTask)
-}
-sdk.dependsOn(buildModules)
+ Task testArgFiles = task("createTestArgfiles${t.capital}") {
-void configureJigsawTests(
- Project p,
- List moduleDeps,
- Set patchInc,
- Set testsInc,
- String addExportsFile
- ) {
+ File testRunArgsFile = new File(rootProject.buildDir, TESTRUNARGSFILE)
+ //test (shimed) version
+ File testCompileArgsFile = new File(rootProject.buildDir, TESTCOMPILEARGSFILE)
+ // And a test java.policy file
+ File testJavaPolicyFile = new File(rootProject.buildDir, TESTJAVAPOLICYFILE)
+
+ outputs.file(testRunArgsFile)
+ outputs.file(testCompileArgsFile)
+ outputs.file(testJavaPolicyFile)
- if(!IS_JIGSAW_TEST) {
- return
- }
-
- p.configurations {
- jigsawTest
- }
-
- p.dependencies {
- jigsawTest group: "junit", name: "junit", version: "4.8.2"
- }
-
- compileTargets { t ->
-
- def targetProperties = project.rootProject.ext[t.upper]
-
- def modularSdkDirName = "${targetProperties.platformPrefix}modular-sdk"
- def modularSdkDir = "${rootProject.buildDir}/${modularSdkDirName}"
- def modulesDir = "${modularSdkDir}/modules"
-
- boolean useModule = true
- String moduleName
- if(!p.hasProperty('moduleName')) {
- useModule = false
- moduleName = "systemTests"
- } else {
- moduleName = p.moduleName
- }
-
- logger.info("configuring $p.name for modular test copy");
-
- def testingDir = "${rootProject.buildDir}/${targetProperties.platformPrefix}testing";
- def patchesDir = new File("${testingDir}/modules");
- File patchPolicyFile = new File("${testingDir}/java.patch.policy");
- File patchmoduleFile = new File("${testingDir}/patchmodule.args");
-
- String javaLibraryPath = "${rootProject.buildDir}/sdk/$targetProperties.libDest"
-
- def jigsawPatchesBaseDir = new File("${testingDir}/modules/$moduleName");
- def jigsawPatchesTestDir = new File("${testingDir}/tests/$moduleName");
-
- p.files(patchPolicyFile);
- p.files(patchmoduleFile);
-
- def srcClassesDir = "${p.buildDir}/${targetProperties.platformPrefix}module-classes"
- Task classes = p.task("jigsawCopyClasses${t.capital}", type: Copy, dependsOn: [p.classes]) {
-
- enabled = useModule
-
- from srcClassesDir
- into jigsawPatchesBaseDir
- }
-
- Task shims = p.task("jigsawCopyShims${t.capital}", type: Copy, dependsOn: [p.testClasses]) {
- //from p.sourceSets.test.output.classesDir
-
- enabled = useModule
-
- from p.sourceSets.test.output
- into jigsawPatchesBaseDir
- if (patchInc != null) {
- include patchInc
- } else {
- include "**/*"
- }
- if (testsInc != null) {
- exclude testsInc
- }
- includeEmptyDirs = false
- doLast() {
- logger.info("project $p.name finished jigsawCopyShims to $jigsawPatchesBaseDir");
- }
- }
-
- Task alltests = p.task("jigsawCopyTests${t.capital}", type: Copy, dependsOn: [p.testClasses]) {
- from p.sourceSets.test.output
- into jigsawPatchesTestDir
- if (patchInc != null) {
- exclude patchInc
- }
- if (testsInc != null) {
- include testsInc
- } else {
- include "**/*"
- }
- includeEmptyDirs = false
- doLast() {
- logger.info("project $p.name finished jigsawCopyTests to $jigsawPatchesTestDir");
- }
- }
-
- // create & use just one of these per platform
- String nameis = "moduleTestPatchPolicy${t.capital}"
- Task patchPerms = null
- if (rootProject.hasProperty(nameis)) {
- patchPerms = rootProject.tasks[nameis]
- } else {
- patchPerms = rootProject.task(nameis) {
- outputs.file(patchPolicyFile)
- outputs.file(patchmoduleFile)
- doLast() {
- logger.info("Creating test patch.policy file ${patchPolicyFile}")
- logger.info("Creating test patch.policy file ${patchmoduleFile}")
-
- delete(patchPolicyFile)
- delete(patchmoduleFile)
- mkdir(testingDir)
- String thepath=cygpath("${rootProject.buildDir}/sdk/${targetProperties.libDest}")
-
- patchmoduleFile << "-Djava.library.path=${thepath}\n"
- moduleProjList.each { project ->
- String themod = file("${patchesDir}/${project.ext.moduleName}").toURI()
- patchPolicyFile << "grant codeBase \"${themod}\" {\n" +
- " permission java.security.AllPermission;\n" +
- "};\n"
-
- def dstModuleDir = cygpath("${patchesDir}/${project.ext.moduleName}")
- patchmoduleFile << "--patch-module ${project.ext.moduleName}=\"${dstModuleDir}\"\n"
- }
- }
- }
- }
-
- Task jigsawTestsTask = p.task("jigsawTests${t.capital}", dependsOn: [classes, shims, alltests, patchPerms ]) {
- doLast() {
- logger.info("project $p.name finished jigsawTests${t.capital}");
- }
- }
-
- FileCollection testclasspath = p.files(p.configurations.jigsawTest)
-
- p.test.dependsOn jigsawTestsTask
-
- if (moduleDeps != null) {
- moduleDeps.each() {s->
- logger.info("adding dep to project $p.name $s");
- Project pdep = rootProject.project(s);
- def jigsawTask = pdep.tasks.getByName("jigsawTests${t.capital}");
- jigsawTestsTask.dependsOn jigsawTask;
+ doLast() {
+ rootProject.buildDir.mkdir()
- testclasspath += p.files(pdep.ext.jigsawPatchesTestDir);
+ List projNames = []
+ moduleProjList.each { project ->
+ projNames << project.name
}
- }
- testclasspath += p.files(jigsawPatchesTestDir);
+ // And the test (shimed) variation...
- p.ext.jigsawTestClasspath = testclasspath
- p.ext.jigsawPatchesTestDir = jigsawPatchesTestDir
- p.ext.jigsawTestClasses = jigsawTestsTask
+ testRunArgsFile.delete()
- p.ext.argclasspathFile = "$testingDir/classpath_"+p.name+".txt"
+ logger.info("Creating argfile ${testRunArgsFile.path}")
- p.test {
- if (IS_FORCE_TESTS) {
- dependsOn 'cleanTest'
+ computePatchModuleArgs(projNames, true).each() { a->
+ testRunArgsFile << a
+ testRunArgsFile << "\n"
}
- scanForTestClasses = false
- include("**/*Test.*")
+ testJavaPolicyFile.delete()
- if (IS_JIGSAW_TEST) {
- dependsOn jigsawTestsTask
+ List modpath = []
- doFirst {
- classpath = testclasspath
- p.sourceSets.test.runtimeClasspath = testclasspath
- }
+ moduleProjList.each { project ->
+ if (project.hasProperty("moduleName") && project.buildModule) {
+ File dir;
+ if (project.sourceSets.hasProperty('shims')) {
+ dir = new File(project.sourceSets.shims.output.classesDir, project.ext.moduleName);
+ } else {
+ dir = new File(project.sourceSets.main.output.classesDir, project.ext.moduleName);
+ }
- String bcp = "-Xbootclasspath/a:" + rootProject.projectDir.path + "/buildSrc/build/libs/buildSrc.jar"
+ modpath << dir.path
- systemProperties 'worker.debug': IS_WORKER_DEBUG
- systemProperties 'worker.patchmodule.file': cygpath(patchmoduleFile.path)
- if (addExportsFile != null) {
- systemProperties 'worker.exports.file': cygpath(addExportsFile)
+ String themod = dir.toURI()
+ testJavaPolicyFile << "grant codeBase \"${themod}\" {\n" +
+ " permission java.security.AllPermission;\n" +
+ "};\n"
}
- systemProperties 'worker.classpath.file': cygpath(p.ext.argclasspathFile)
- systemProperties 'worker.java.cmd': JIGSAW_JAVA
-
- systemProperties 'worker.isJigsaw': true
-
- systemProperties 'worker.patch.policy': cygpath(patchPolicyFile.path)
-
- //systemProperties 'prism.order': 'sw'
- //systemProperties 'glass.platform': 'Monocle'
- //systemProperties
'glass.len': 'headless'
-
- jvmArgs bcp, "workaround.GradleJUnitWorker"
-
- environment("JDK_HOME", JIGSAW_HOME);
- executable (JIGSAW_JAVA);
+ }
- }
+ writeCompileArgsFile(testCompileArgsFile, modpath)
}
-
}
+ sdk.dependsOn(testArgFiles)
+ createTestArgfiles.dependsOn(testArgFiles)
+ def sdkTask = tasks.getByName("sdk${t.capital}");
+ sdkTask.dependsOn(buildModulesTask)
}
+sdk.dependsOn(buildModules)
task checkrepo() {
doLast {
@@ -4167,4 +4342,3 @@
)
}
-
--- old/./build.properties 2016-11-02 13:31:04.753260284 -0400
+++ new/./build.properties 2016-11-02 13:31:04.645262738 -0400
@@ -67,6 +67,6 @@
##############################################################################
jfx.build.jdk.version.min=9
-jfx.build.jdk.buildnum.min=109
+jfx.build.jdk.buildnum.min=140
jfx.build.jdk.version=9
-jfx.build.jdk.buildnum=109
+jfx.build.jdk.buildnum=142
--- old/buildSrc/linux.gradle 2016-11-02 13:31:05.133251651 -0400
+++ new/buildSrc/linux.gradle 2016-11-02 13:31:05.025254104 -0400
@@ -34,8 +34,9 @@
LINUX.compileSWT = true;
LINUX.compileFXPackager = true;
-// Libraries end up in the sdk/lib/$OS_ARCH directory for Linux
+// Libraries end up in the lib/$OS_ARCH directory for Linux
LINUX.libDest = "lib/$OS_ARCH"
+LINUX.modulesArch = "$OS_ARCH"
// Lambda for naming the generated libs
LINUX.library = { name -> return "lib${name}.so" as String }
--- old/./gradle.properties.template 2016-11-02 13:31:05.513243017 -0400
+++ new/./gradle.properties.template 2016-11-02 13:31:05.405245470 -0400
@@ -80,21 +80,13 @@
#INCLUDE_ES2 = true
# Specifies whether to build SDK for running unit tests
-# By default, it is set to true and the tests are running of the fresh-built SDK
-# If set to false, this flag removes main sources complication tasks and building
-# the whole SDK and jfxrt.jar and jars from TEST_SDK are used
-# Setting TEST_SDK is recommended
+# By default, it is set to true and the tests are running of the
+# fresh-built SDK. If set to false, this flag removes main sources
+# compilation tasks and building the whole SDK. The existing SDK is used
+# instead, and must have been previously built
#BUILD_SDK_FOR_TEST = false
-# Specifies SDK for running tests with when BUILD_SDK_FOR_TEST is set to false
-# By default, it is set to JDK_HOME
-# Developer builds are preferred, in other case systemTests would fail to compile and run
-# jfxrt.jar should be located at $TEST_SDK/lib/jfxrt.jar
-# ant-javafx.jar and javafx-mx.jar should be located at $TEST_SDK/lib/
-
-#TEST_SDK = /path/to/sdk
-
# Specifies whether to do a full test run or a "smoke test" run. By default we
# do a smoke test run which excludes all tests that show a window or play media.
# Certain long running tests might also be excluded when this is not set.
--- old/buildSrc/src/main/java/jarjar/org/gradle/process/internal/child/BootstrapSecurityManager.java 2016-11-02 13:31:05.905234111 -0400
+++ /dev/null 2016-10-31 09:37:02.128008072 -0400
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jarjar.org.gradle.process.internal.child;
-
-import java.security.Permission;
-
-/**
- * override Gradle bootstrap loader hack for JDK 9
- */
-public class BootstrapSecurityManager extends SecurityManager {
-
- private boolean initialised;
- private final ClassLoader target;
-
- public BootstrapSecurityManager() {
- this(null);
- }
-
- BootstrapSecurityManager(ClassLoader target) {
- //System.err.println("STARTING OVERRIDE BootstrapSecurityManager");
- this.target = target;
- }
-
- @Override
- public void checkPermission(Permission permission) {
- synchronized (this) {
- if (initialised) {
- return;
- }
- if (System.in == null) {
- // Still starting up
- return;
- }
-
- initialised = true;
- }
-
- try {
- System.clearProperty("java.security.manager");
- System.setSecurityManager(null);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
--- old/buildSrc/src/main/java/workaround/GradleJUnitWorker.java 2016-11-02 13:31:06.157228386 -0400
+++ /dev/null 2016-10-31 09:37:02.128008072 -0400
@@ -1,510 +0,0 @@
-/*
- * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package workaround;
-
-import java.io.BufferedWriter;
-import java.io.DataInputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.lang.reflect.Constructor;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Properties;
-
-/*
- * This wrapper is designed to workaround a class loader issue
- * when working with JDK9 and Gradle in the JFX builds
- * NOTE: this worker assumes the @argfile support found in JDK9
- *
- * Due to the nature of the command line and where the this class is
- * specified, certain command line properties may either be :
- * an argument - because it came after this file
- * a property - because it was before this file and was processed as a property
- * Because of this, everything is checked as both.
- *
- * The worker specific properties are found below as worker.*. These
- * properties also need to be forwarded as system properties just in case
- * we have something like MainLauncherTest that needs some of these to
- * construct a new java command.
- *
- */
-public class GradleJUnitWorker {
-
- public static boolean debug = false;
-
- private static final String ENCODERCLASS
- = "jarjar.org.gradle.process.internal.child.EncodedStream$EncodedInput";
- private static final String ENCODERCLASS_2
- = "worker.org.gradle.process.internal.streams.EncodedStream$EncodedInput";
-
- private static URL fileToURL(File file) throws IOException {
- return file.getCanonicalFile().toURI().toURL();
- }
-
- // all of the "standard" System Properties that we will not forward
- // to the worker.
- private final static String[] defSysProps = {
- "awt.toolkit",
- "file.encoding.pkg",
- "file.encoding",
- "file.separator",
- "ftp.nonProxyHosts",
- "gopherProxySet",
- "http.nonProxyHosts",
- "java.awt.graphicsenv",
- "java.awt.printerjob",
- "java.class.path",
- "java.class.version",
- "java.endorsed.dirs",
- "java.ext.dirs",
- "java.home",
- "java.io.tmpdir",
- "java.library.path",
- "java.runtime.name",
- "java.runtime.version",
- "java.specification.name",
- "java.specification.vendor",
- "java.specification.version",
- "java.vendor.url.bug",
- "java.vendor.url",
- "java.vendor",
- "java.version",
- "java.vm.info",
- "java.vm.name",
- "java.vm.specification.name",
- "java.vm.specification.vendor",
- "java.vm.specification.version",
- "java.vm.vendor",
- "java.vm.version",
- "line.separator",
- "os.arch",
- "os.name",
- "os.version",
- "path.separator",
- "socksNonProxyHosts",
- "sun.arch.data.model",
- "sun.boot.class.path",
- "sun.boot.library.path",
- "sun.cpu.endian",
- "sun.cpu.isalist",
- "sun.io.unicode.encoding",
- "sun.java.command",
- "sun.java.launcher",
- "sun.jnu.encoding",
- "sun.management.compiler",
- "sun.os.patch.level",
- "user.country",
- "user.dir",
- "user.home",
- "user.language",
- "user.name",
- "user.timezone",
- // windows
- "user.script",
- "user.variant",
- "sun.desktop",
- // Jake
- "java.vm.compressedOopsMode",
- "jdk.boot.class.path.append",};
-
- static HashSet ignoreSysProps = new HashSet(defSysProps.length + 10);
-
- public static void main(String args[]) {
-
- try {
- final ArrayList cmd = new ArrayList<>(30);
- String gradleWorkerJar = null;
- String patchmoduleFile = null;
- String exportsFile = null;
- String classpathFile = null;
- String jigsawJavapath = null;
-
- final String exportsFileProperty = "worker.exports.file";
- final String workerDebugProperty = "worker.debug";
- final String patchmoduleFileProperty = "worker.patchmodule.file";
- final String classpathFileProperty = "worker.classpath.file";
- final String javaCmdProperty = "worker.java.cmd";
-
- Collections.addAll(ignoreSysProps, defSysProps);
- ignoreSysProps.add(exportsFileProperty);
- ignoreSysProps.add(workerDebugProperty);
- ignoreSysProps.add(patchmoduleFileProperty);
- ignoreSysProps.add(classpathFileProperty);
- ignoreSysProps.add(javaCmdProperty);
-
- debug = Boolean.parseBoolean(System.getProperty(workerDebugProperty, "false"));
-
- ArrayList newArgs = new ArrayList<>(50);
- for (int i = 0; i < args.length; i++) {
- if (args[i].startsWith("-cp")) {
- gradleWorkerJar = args[i + 1];
- i++; // skip the path argument
- if (debug) System.err.println("XWORKER gradleWorkerJar="+exportsFile);
- } else if (args[i].contains(exportsFileProperty)) {
- int equals = args[i].indexOf("=");
- exportsFile = args[i].substring(equals+1);
- if (debug) System.err.println("XWORKER "+exportsFileProperty+"="+exportsFile);
- } else if (args[i].contains(patchmoduleFileProperty)) {
- int equals = args[i].indexOf("=");
- patchmoduleFile = args[i].substring(equals+1);
- if (debug) System.err.println("XWORKER "+patchmoduleFileProperty+"="+patchmoduleFile);
- } else if (args[i].contains(javaCmdProperty)) {
- int equals = args[i].indexOf("=");
- jigsawJavapath = args[i].substring(equals+1);
- if (debug) System.err.println("XWORKER "+javaCmdProperty+"="+jigsawJavapath);
- } else if (args[i].contains(classpathFileProperty)) {
- int equals = args[i].indexOf("=");
- classpathFile = args[i].substring(equals+1);
- if (debug) System.err.println("XWORKER "+classpathFileProperty+"="+classpathFile);
- } else {
- if (debug) System.err.println("XWORKER forwarding cmd "+args[i]);
- newArgs.add(args[i]);
- }
- }
-
- // Debug routine to capture a worker stream for replaying
- if (false) {
- File dumper = new File("datadump.txt");
- FileOutputStream out
- = new FileOutputStream(dumper);
-
- byte[] buf = new byte[1024];
- int cnt;
-
- while ((cnt = System.in.read(buf)) > 0) {
- out.write(buf, 0, cnt);
- }
- out.close();
- System.exit(-1);
- }
-
- //Next we need to get the gradle encoder class from
- // the gradle-worker.jar, which usually is on the classpath
- // but as it is an arg in our case we need to load the jar
- // into a classloader
- ArrayList urlList = new ArrayList();
- urlList.add(fileToURL(new File(gradleWorkerJar)));
-
- URL[] urls = (URL[]) urlList.toArray(new URL[0]);
- ClassLoader cloader = new URLClassLoader(urls);
-
- if (debug) {
- System.err.println("AND WE HAVE " + urls[0]);
- }
-
- // try to find the Gradle class that decodes the input
- // stream. In newer versions (> 2. ?) they prefix with jarjar.
- Class encoderClass = null;
- if (encoderClass == null) {
- try {
- encoderClass = Class.forName(ENCODERCLASS, true, cloader);
- } catch (ClassNotFoundException e) {
- if (debug) {
- System.err.println("did not find " + ENCODERCLASS);
- }
- }
- }
- if (encoderClass == null) {
- try {
- encoderClass = Class.forName(ENCODERCLASS_2, true, cloader);
- } catch (ClassNotFoundException e) {
- if (debug) {
- System.err.println("did not find " + ENCODERCLASS_2);
- }
- }
- }
-
- if (encoderClass != null) {
- if (debug) {
- System.err.println("Found EncoderClass " + encoderClass.getName());
- }
- } else {
- throw new RuntimeException("Gradle Encoder Class not found");
- }
-
- Constructor constructor
- = encoderClass.getConstructor(new Class[]{InputStream.class});
-
- InputStream encodedStream
- = (InputStream) constructor.newInstance(System.in);
-
- DataInputStream inputStream
- = new DataInputStream(encodedStream);
-
- int count = inputStream.readInt();
-
- //And now lets build a command line.
- ArrayList cpelement = new ArrayList<>(50);
-
- // start with the gradle-worker.jar
- cpelement.add(gradleWorkerJar);
-
- // read from the data stream sent by gradle to classpath setter
- for (int dex = 0; dex < count; dex++) {
- String entry = inputStream.readUTF();
- // skipping any mention of jfxrt.jar....
- if (!entry.contains("jfxrt.jar")) {
- File file = new File(entry);
- cpelement.add(file.toString());
- }
- }
-
- if (debug) {
- for (int i = 0; i < cpelement.size(); i++) {
- System.err.println(" " + i + " " + cpelement.get(i));
- }
- }
-
- String securityManagerType = inputStream.readUTF();
- if (debug) {
- System.out.println("XWORKER security manager is " + securityManagerType);
- }
-
- /*
- End read from the data stream send by gradle to classpath setter
- Now we need to write this into our @argfile
- */
- File classPathArgFile;
-
- if (classpathFile == null) {
- classpathFile = System.getProperty(classpathFileProperty);
- }
-
- if (classpathFile != null) {
- classPathArgFile = new File(classpathFile);
- } else if (debug) {
- classPathArgFile = new File("classpath.txt");
- } else {
- classPathArgFile = File.createTempFile("xworker-classpath", ".tmp");
- }
- try {
- BufferedWriter br = new BufferedWriter(new OutputStreamWriter(
- new FileOutputStream(classPathArgFile)));
-
- br.write("-classpath");
- br.newLine();
- for (int i = 0; i < cpelement.size(); i++) {
- if (i == 0) {
- br.write(" \"");
- } else {
- br.write(" ");
- }
-
- br.write(cpelement.get(i).replace('\\', '/'));
- if (i < cpelement.size() - 1) {
- br.write(File.pathSeparator);
- br.write("\\");
- br.newLine();
- }
-
- }
- br.write("\"");
- br.newLine();
- br.close();
- } catch (IOException e) {
- throw new RuntimeException("Could not write @classpath.txt");
- }
-
- String jdk_home_env = System.getenv("JIGSAW_HOME");
- if (debug) System.err.println("XWORKER JIGSAW_HOME (env) is set to " + jdk_home_env);
-
- if (jdk_home_env == null) {
- jdk_home_env = System.getenv("JDK_HOME");
- if (debug) System.err.println("XWORKER JDK_HOME (env) is set to " + jdk_home_env);
- }
-
- String jdk_home = System.getProperty("JDK_HOME");
- if (debug) System.err.println("XWORKER JDK_HOME is set to " + jdk_home);
-
- if (jigsawJavapath == null) {
- jigsawJavapath = System.getProperty(javaCmdProperty);
- }
-
- String java_cmd = "java";
- if (jigsawJavapath != null) {
- // good we have it - probably the safest way on windows
- java_cmd = jigsawJavapath;
- if (debug) System.err.println("XWORKER JIGSAW_JAVA is set to " + java_cmd);
- } else if (jdk_home_env != null) {
- jigsawJavapath = jdk_home_env
- + File.separatorChar + "bin"
- + File.separatorChar + "java";
- } else if (jdk_home != null) {
- java_cmd = jdk_home
- + File.separatorChar + "bin"
- + File.separatorChar + "java";
- }
-
- if (debug) {
- System.err.println("XWORKER using java " + java_cmd);
- }
-
- cmd.add(java_cmd);
-
- cmd.add("-D"+javaCmdProperty+"="+java_cmd);
-
- if (patchmoduleFile == null) {
- patchmoduleFile = System.getProperty(patchmoduleFileProperty);
- }
-
- if (patchmoduleFile != null) {
- cmd.add("@" + patchmoduleFile);
- cmd.add("-D" + patchmoduleFileProperty + "=" + patchmoduleFile);
- }
-
- if (exportsFile == null) {
- exportsFile = System.getProperty(exportsFileProperty);
- }
-
- if (exportsFile != null) {
- cmd.add("@" + exportsFile);
- cmd.add("-D"+exportsFileProperty+"="+exportsFile);
- }
-
- final String cleanpath =
- classPathArgFile.getAbsolutePath().replaceAll("\\\\", "/");
- cmd.add("@" + cleanpath);
- cmd.add("-D"+classpathFileProperty+"="+cleanpath);
-
- if (debug) {
- cmd.add("-D"+workerDebugProperty+"="+debug);
- }
-
- //forward any old system properties, other than the stock ones
- Properties p = System.getProperties();
- Enumeration keys = p.keys();
- while (keys.hasMoreElements()) {
- String key = (String) keys.nextElement();
- if (!ignoreSysProps.contains(key)) {
- String value = (String) p.get(key);
- String newprop = "-D"+key+"="+value;
- cmd.add(newprop);
- if (debug) System.out.println("XWORKER adding "+newprop);
-
- }
- }
-
- newArgs.forEach(s-> {
- cmd.add(s);
- });
-
- if (debug) {
- System.err.println("XWORKER: cmd is");
- cmd.stream().forEach((s) -> {
- System.err.println(" " + s);
- });
- System.err.println("XWORKER: end cmd");
- }
-
- // Now we have a full command line, start the new worker process
- ProcessBuilder pb = new ProcessBuilder(cmd);
- Process proc = pb.start();
-
- // And now setup and forward the input to the worker thread
- // and the output from the worker thread.
-
- new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- OutputStream os = proc.getOutputStream();
-
- byte[] input = new byte[512];
- int cnt;
-
- while ((cnt = System.in.read(input)) > 0) {
- os.write(input, 0, cnt);
- }
-
- os.close();
-
- } catch (IOException io) {
- io.printStackTrace();
- }
- }
- }).start();
-
- new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- InputStream is = proc.getInputStream();
-
- byte[] input = new byte[1024];
- int cnt;
-
- while ((cnt = is.read(input)) > 0) {
- System.out.write(input, 0, cnt);
- }
-
- is.close();
-
- } catch (IOException io) {
- io.printStackTrace();
- }
- }
- }).start();
-
- new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- InputStream es = proc.getErrorStream();
-
- byte[] input = new byte[1024];
- int cnt;
-
- while ((cnt = es.read(input)) > 0) {
- System.err.write(input, 0, cnt);
- }
-
- es.close();
-
- } catch (IOException io) {
- io.printStackTrace();
- }
- }
- }).start();
-
- // And lastly - forward the exit code from the worker
- System.exit(proc.waitFor());
-
- } catch (Exception e) {
- throw new RuntimeException("Could not initialise system classpath.", e);
- }
- }
-}
--- old/buildSrc/src/main/java/worker/org/gradle/process/internal/worker/child/BootstrapSecurityManager.java 2016-11-02 13:31:06.413222570 -0400
+++ /dev/null 2016-10-31 09:37:02.128008072 -0400
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package worker.org.gradle.process.internal.worker.child;
-
-import java.security.Permission;
-
-/**
- * override Gradle bootstrap loader hack for JDK 9
- */
-public class BootstrapSecurityManager extends SecurityManager {
-
- private boolean initialised;
- private final ClassLoader target;
-
- public BootstrapSecurityManager() {
- this(null);
- }
-
- BootstrapSecurityManager(ClassLoader target) {
- //System.err.println("STARTING OVERRIDE BootstrapSecurityManager");
- this.target = target;
- }
-
- @Override
- public void checkPermission(Permission permission) {
- synchronized (this) {
- if (initialised) {
- return;
- }
- if (System.in == null) {
- // Still starting up
- return;
- }
-
- initialised = true;
- }
-
- try {
- System.clearProperty("java.security.manager");
- System.setSecurityManager(null);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
--- old/modules/jdk.packager/src/main/java/com/javafx/main/Main.java 2016-11-02 13:31:06.669216753 -0400
+++ /dev/null 2016-10-31 09:37:02.128008072 -0400
@@ -1,1021 +0,0 @@
-/*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.javafx.main;
-
-import com.oracle.tools.packager.Platform;
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.net.URI;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.net.URLDecoder;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Base64;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.jar.Attributes;
-import java.util.jar.JarFile;
-import java.util.jar.Manifest;
-import javax.swing.JApplet;
-import javax.swing.JFrame;
-import javax.swing.SwingUtilities;
-
-/**
- * This class loads com.sun.javafx.application.LauncherImpl and calls the
- * launchApplication method.
- *
- * It is used by packager to include it as part of the application jar file
- * so that we can run and locate the JavaFX runtime. Note that we cannot
- * assume that JavaFX is on the classpath so we must use reflection and not
- * have any direct reference to any JavaFX runtime class.
- *
- * We will do the following:
- *
- * 1. Verify the version of Java and produce error message if not JDK6+
- *
- * 2. Locate the jar file from which the Main class was launched. Read the
- * jar manifest and extract
- * the application class using the JavaFX-Application-Class manifest entry.
- * Alternatively, we will read the application class from a system property.
- *
- * 3. Try to locate the JavaFX runtime by loading the
- * com.sun.javafx.application.LauncherImpl class using the following mechanisms
- * in order:
- *
- * A. Try loading it directly in case it is on the classpath.
- * B. If the javafx.runtime.path System Property is set, try
- * loading it from ${javafx.runtime.path}/lib/ext/jfxrt.jar
- * (or lib/jfxrt.jar)
- * C. Look for a cobundled JavaFX in the current jre
- * D. If on Windows, read the registry key associated with the JavaFX
- * runtime (if running in a 64-bit JVM, use the 64-bit path)
- *
- * 4. Create a custom URLClassLoader from the appropriate jar files, and then
- * call the launchApplication method. If the application class is not a
- * subclass of javafx.application.Application then we will call the main
- * method in the application class instead.
- *
- * 5. If the LauncherImpl class cannot be found, then show a Swing dialog
- * (again, using reflection).
- */
-
-public class Main {
- private static boolean verbose = false;
- private static final String fxApplicationClassName = "javafx.application.Application";
- private static final String fxLaunchClassName = "com.sun.javafx.application.LauncherImpl";
- private static final String manifestAppClass = "JavaFX-Application-Class";
- private static final String manifestPreloaderClass = "JavaFX-Preloader-Class";
- private static final String manifestFallbackClass = "JavaFX-Fallback-Class";
- private static final String manifestClassPath = "JavaFX-Class-Path";
-
- //Manifest entry to explicitly disable autoproxy config
- // Unless it has "Auto" value it will disable proxy
- private static final String manifestAutoProxy = "JavaFX-Feature-Proxy";
-
- //Experimental hook to simplify adding "au" logic to native bundles
- private static final String manifestUpdateHook = "X-JavaFX-Update-Hook";
-
- // JavaFX family version that this Launcher is compatible with
- private static final String JAVAFX_FAMILY_VERSION = "2.";
-
- // Minimum JavaFX version required to run the app
- // (keep separate from JAVAFX_FAMILY_VERSION check as
- // we want 2.2.1 SDK to be ok to run app that needs 2.1.0
- // and prefix based match is not enough)
- // NOTE: This should be refactored so that the version gets supplied
- // from the build environment, but we do NOT want another class or
- // property file in the app bundle! Are there any other options
- // besides java source code preprocessing?)
- private static final String JAVAFX_REQUIRED_VERSION = "2.1.0";
-
- private static final String ZERO_VERSION = "0.0.0";
-
- //application jar attributes
- private static Attributes attrs = null;
-
- private static URL fileToURL(File file) throws IOException {
- return file.getCanonicalFile().toURI().toURL();
- }
-
- private static Method findLaunchMethod(File jfxRtPath, String fxClassPath) {
- final Class[] argTypes =
- new Class[] { Class.class, Class.class, (new String[0]).getClass() };
-
- try {
- ArrayList urlList = new ArrayList();
-
- // Add in the elements of the classpath
- String cp = System.getProperty("java.class.path");
- if (cp != null) {
- while (cp.length() > 0) {
- int pathSepIdx = cp.indexOf(File.pathSeparatorChar);
- if (pathSepIdx < 0) {
- String pathElem = cp;
- urlList.add(fileToURL(new File(pathElem)));
- break;
- } else if (pathSepIdx > 0) {
- String pathElem = cp.substring(0, pathSepIdx);
- urlList.add(fileToURL(new File(pathElem)));
- }
- cp = cp.substring(pathSepIdx + 1);
- }
- }
-
- // Add in the jars from the JavaFX-Class-Path entry
- cp = fxClassPath;
- if (cp != null) {
- //these are relative paths. if app is not in the current dir
- // we may resolve them incorrectly ...
- // try to find main jar and build absolute paths
- File baseDir = null;
- try {
- String path = Main.class.getProtectionDomain().getCodeSource().getLocation().getPath();
- //path will have encoded spaces, etc. => need to restore
- String decodedPath = URLDecoder.decode(path, "UTF-8");
- baseDir = new File(decodedPath).getParentFile();
- if (!baseDir.exists()) {
- baseDir = null;
- }
- } catch (Exception e) {}
- while (cp.length() > 0) {
- int pathSepIdx = cp.indexOf(" ");
- if (pathSepIdx < 0) {
- String pathElem = cp;
- File f = (baseDir == null) ?
- new File(pathElem) : new File(baseDir, pathElem);
- urlList.add(fileToURL(f));
- break;
- } else if (pathSepIdx > 0) {
- String pathElem = cp.substring(0, pathSepIdx);
- File f = (baseDir == null) ?
- new File(pathElem) : new File(baseDir, pathElem);
- urlList.add(fileToURL(f));
- }
- cp = cp.substring(pathSepIdx + 1);
- }
- }
-
- // Add JavaFX runtime jar and deployment jars
- if (jfxRtPath != null) {
- File jfxRtLibPath = new File(jfxRtPath, "lib");
- File jfxRtLibExtPath = new File(jfxRtLibPath, "ext");
- File jfxRtJar = new File(jfxRtLibExtPath, "jfxrt.jar");
- if (!jfxRtJar.canRead()) {
- // Legacy support for old file location
- jfxRtJar = new File(jfxRtLibPath, "jfxrt.jar");
- }
- urlList.add(fileToURL(jfxRtJar));
- File deployJar = new File(jfxRtLibPath, "deploy.jar");
- //in the dev environment deploy.jars will not be part of
- // built SDK unless it is windows
- //However, hopefully java is used from relatively new java
- // and we can add deploy jars from there?
- //If no deploy jars are found we will treat it as runtime error
- if (!deployJar.exists()) {
- deployJar = getDeployJarFromJRE();
- }
- if (deployJar != null) {
- URL deployJarURL = fileToURL(deployJar);
- urlList.add(deployJarURL);
- urlList.add(new URL(deployJarURL, "plugin.jar"));
- urlList.add(new URL(deployJarURL, "javaws.jar"));
- } else {
- if (verbose) {
- System.err.println("Skip JavaFX Runtime at "
- + jfxRtPath + " as no deploy jars found.");
- }
- return null;
- }
- }
-
- URL[] urls = (URL[])urlList.toArray(new URL[0]);
- if (verbose) {
- System.err.println("===== URL list");
- for (int i = 0; i < urls.length; i++) {
- System.err.println("" + urls[i]);
- }
- System.err.println("=====");
- }
-
- ClassLoader urlClassLoader = new URLClassLoader(urls, null);
- Class launchClass = Class.forName(fxLaunchClassName, true,
- urlClassLoader);
- Method m = launchClass.getMethod("launchApplication", argTypes);
- if (m != null) {
- Thread.currentThread().setContextClassLoader(urlClassLoader);
- return m;
- }
- } catch (Exception ex) {
- if (jfxRtPath != null) {
- ex.printStackTrace();
- }
- }
-
- return null;
- }
-
- private static Method findLaunchMethodInClasspath(String fxClassPath) {
- return findLaunchMethod(null, fxClassPath);
- }
-
- private static Method findLaunchMethodInJar(String jfxRtPathName, String fxClassPath) {
- File jfxRtPath = new File(jfxRtPathName);
-
- // Verify that we can read /lib/ext/jfxrt.jar
- File jfxRtLibPath = new File(jfxRtPath, "lib");
- File jfxRtLibExtPath = new File(jfxRtLibPath, "ext");
- File jfxRtJar = new File(jfxRtLibExtPath, "jfxrt.jar");
- if (!jfxRtJar.canRead()) {
- File jfxRtJar2 = new File(jfxRtLibPath, "jfxrt.jar");
- if (!jfxRtJar2.canRead()) {
- if (verbose) {
- System.err.println("Unable to read " + jfxRtJar.toString()
- + " or " + jfxRtJar2.toString());
- }
- return null;
- }
- }
-
- return findLaunchMethod(jfxRtPath, fxClassPath);
- }
-
- // convert version string in the form of x.y.z into int array of (x,y.z)
- // return the array if version string can be converted.
- // otherwise retun null
- private static int[] convertVersionStringtoArray(String version) {
- int[] v = new int[3];
- if (version == null) {
- return null;
- }
-
- String s[] = version.split("\\.");
- if (s.length == 3) {
- v[0] = Integer.parseInt(s[0]);
- v[1] = Integer.parseInt(s[1]);
- v[2] = Integer.parseInt(s[2]);
- return v;
- }
- // version string passed in is bad
- return null;
- }
-
- // compare the two version array a1 and a2
- // return 0 if the two array contains the same version information
- // (or both are invalid version specs)
- // return 1 if a2 is greater than a1
- // return -1 if a2 is less than a1
- private static int compareVersionArray(int[] a1, int[] a2) {
- boolean isValid1 = (a1 != null) && (a1.length == 3);
- boolean isValid2 = (a2 != null) && (a2.length == 3);
-
- // both bad
- if (!isValid1 && !isValid2) {
- return 0;
- }
-
- // a2 < a1
- if (!isValid2) {
- return -1;
- }
-
- // a2 > a1
- if (!isValid1) {
- return 1;
- }
-
- for (int i = 0; i < a1.length; i++) {
- if (a2[i] > a1[i]) {
- return 1;
- }
- if (a2[i] < a1[i]) {
- return -1;
- }
- }
-
- return 0;
- }
-
- private static File getDeployJarFromJRE() {
- final String javaHome = System.getProperty("java.home");
- if (verbose) {
- System.err.println("java.home = " + javaHome);
- }
- if (javaHome == null || javaHome.equals("")) {
- return null;
- }
-
- File jreLibPath = new File(javaHome, "lib");
- File deployJar = new File(jreLibPath, "deploy.jar");
-
- if (deployJar.exists()) {
- return deployJar;
- }
- return null;
- }
-
- /**
- * If we are on Windows, look in the system registry for the
- * installed JavaFX runtime.
- *
- * @return the path to the JavaFX Runtime or null
- */
- private static String lookupRegistry() {
- if (Platform.getPlatform() != Platform.WINDOWS) {
- return null;
- }
-
- try {
- // Load deploy.jar, get a Config instance and load the native
- // libraries; then load the windows registry class and lookup
- // the method to get the windows registry entry
-
- File deployJar = getDeployJarFromJRE();
- if (deployJar == null) {
- return null;
- }
-
- URL[] urls = new URL[]{fileToURL(deployJar)};
- if (verbose) {
- System.err.println(">>>> URL to deploy.jar = " + urls[0]);
- }
-
- ClassLoader deployClassLoader = new URLClassLoader(urls, null);
-
- try {
- // Load and initialize the native deploy library, ignore exception
- String configClassName = "com.sun.deploy.config.Config";
- Class configClass = Class.forName(configClassName, true,
- deployClassLoader);
- Method m = configClass.getMethod("getInstance", null);
- Object config = m.invoke(null, null);
- m = configClass.getMethod("loadDeployNativeLib", null);
- m.invoke(config, null);
- } catch (Exception ex) {
- // Ignore any exception, since JDK7 no longer has this method
- }
-
- String winRegistryWrapperClassName =
- "com.sun.deploy.association.utility.WinRegistryWrapper";
-
- Class winRegistryWrapperClass = Class.forName(
- winRegistryWrapperClassName, true, deployClassLoader);
-
- Method mGetSubKeys = winRegistryWrapperClass.getMethod(
- "WinRegGetSubKeys", new Class[]{
- Integer.TYPE,
- String.class,
- Integer.TYPE
- });
-
- Field HKEY_LOCAL_MACHINE_Field2 =
- winRegistryWrapperClass.getField("HKEY_LOCAL_MACHINE");
- final int HKEY_LOCAL_MACHINE2 = HKEY_LOCAL_MACHINE_Field2.getInt(null);
- final String registryKey = "Software\\Oracle\\JavaFX\\";
-
- // Read the registry and find all installed JavaFX runtime versions
- // under HKLM\Software\Oracle\JavaFX\
- String[] fxVersions = (String[]) mGetSubKeys.invoke(null, new Object[]{
- new Integer(HKEY_LOCAL_MACHINE2),
- registryKey,
- new Integer(255)
- });
-
- if (fxVersions == null) {
- // No JavaFX runtime installed in the system
- return null;
- }
- String version = ZERO_VERSION;
- // Iterate thru all installed JavaFX runtime verions in the system
- for (int i = 0; i < fxVersions.length; i++) {
- // get the latest version that is compatibible with the
- // launcher JavaFX family version and meets minimum version requirement
- if (fxVersions[i].startsWith(JAVAFX_FAMILY_VERSION)
- && fxVersions[i].compareTo(JAVAFX_REQUIRED_VERSION) >= 0) {
- int[] v1Array = convertVersionStringtoArray(version);
- int[] v2Array = convertVersionStringtoArray(fxVersions[i]);
- if (compareVersionArray(v1Array, v2Array) > 0) {
- version = fxVersions[i];
- }
- } else {
- if (verbose) {
- System.err.println(" Skip version " + fxVersions[i]
- + " (required=" + JAVAFX_REQUIRED_VERSION + ")");
- }
- }
- }
-
- if (version.equals(ZERO_VERSION)) {
- // No installed JavaFX runtime compatible with this Launcher
- return null;
- }
-
- // Read the registry entry for: Software\Oracle\JavaFX\
- String winRegistryClassName = "com.sun.deploy.util.WinRegistry";
- Class winRegistryClass = Class.forName(winRegistryClassName, true,
- deployClassLoader);
- Method mGet = winRegistryClass.getMethod("getString", new Class[]{
- Integer.TYPE,
- String.class,
- String.class
- });
- Field HKEY_LOCAL_MACHINE_Field = winRegistryClass.getField("HKEY_LOCAL_MACHINE");
- final int HKEY_LOCAL_MACHINE = HKEY_LOCAL_MACHINE_Field.getInt(null);
- String path = (String) mGet.invoke(null, new Object[]{
- new Integer(HKEY_LOCAL_MACHINE),
- registryKey + version,
- "Path"
- });
- if (verbose) {
- System.err.println("FOUND KEY: " + registryKey + version + " = " + path);
- }
- return path;
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- return null;
- }
-
- private static Attributes getJarAttributes() throws Exception {
- String theClassFile = "Main.class";
- Class theClass = Main.class;
- String classUrlString = theClass.getResource(theClassFile).toString();
- if (!classUrlString.startsWith("jar:file:") || classUrlString.indexOf("!") == -1){
- return null;
- }
- // Strip out the "jar:" and everything after and including the "!"
- String urlString = classUrlString.substring(4, classUrlString.lastIndexOf("!"));
- File jarFile = new File(new URI(urlString).getPath());
- String jarName = jarFile.getCanonicalPath();
-
- Attributes attr;
- JarFile jf = null;
- try {
- jf = new JarFile(jarName);
- Manifest mf = jf.getManifest();
- attr = mf.getMainAttributes();
- } finally {
- if (jf != null) {
- try {
- jf.close();
- } catch (Exception ex) {
- /* swallow the exception */
- }
- }
- }
- return attr;
- }
-
- private static String decodeBase64(String inp) throws IOException {
- return new String(Base64.getDecoder().decode(inp));
- }
-
- private static String[] getAppArguments(Attributes attrs) {
- List args = new LinkedList();
-
- try {
- int idx = 1;
- String argNamePrefix = "JavaFX-Argument-";
- while (attrs.getValue(argNamePrefix + idx) != null) {
- args.add(decodeBase64(attrs.getValue(argNamePrefix + idx)));
- idx++;
- }
-
- String paramNamePrefix = "JavaFX-Parameter-Name-";
- String paramValuePrefix = "JavaFX-Parameter-Value-";
- idx = 1;
- while (attrs.getValue(paramNamePrefix + idx) != null) {
- String k = decodeBase64(attrs.getValue(paramNamePrefix + idx));
- String v = null;
- if (attrs.getValue(paramValuePrefix + idx) != null) {
- v = decodeBase64(attrs.getValue(paramValuePrefix + idx));
- }
- args.add("--" + k + "=" + (v != null ? v : ""));
- idx++;
- }
- } catch (IOException ioe) {
- System.err.println("Failed to extract application parameters");
- ioe.printStackTrace();
- }
-
-
- return (String[]) args.toArray(new String[0]);
- }
-
- // Return the application class name, either from the property or from the
- // jar file
- private static String getAppName(Attributes attrs, boolean preloader) {
- String propName = preloader
- ? "javafx.preloader.class"
- : "javafx.application.class";
-
- String className = System.getProperty(propName);
- if (className != null && className.length() != 0) {
- return className;
- }
-
- String appName;
-
- //this only true in the dev environment if run out of jar
- if (attrs == null) {
- return "TEST";
- }
-
- if (preloader) {
- appName = (String)attrs.getValue(manifestPreloaderClass);
- if (appName == null || appName.length() == 0) {
- if (verbose) {
- System.err.println("Unable to find preloader class name");
- }
- return null;
- }
- return appName;
- } else {
- appName = (String)attrs.getValue(manifestAppClass);
- if (appName == null || appName.length() == 0) {
- System.err.println("Unable to find application class name");
- return null;
- }
- return appName;
- }
- }
-
- private static Class getAppClass(String appName) {
- try {
- // load the user's JavaFX class but do *not* initialize!
- if (verbose) {
- System.err.println("Try calling Class.forName(" + appName
- + ") using classLoader = "
- + Thread.currentThread().getContextClassLoader());
- }
- Class appClass = Class.forName(appName, false,
- Thread.currentThread().getContextClassLoader());
- if (verbose) {
- System.err.println("found class: " + appClass);
- }
- return appClass;
- } catch (NoClassDefFoundError ncdfe) {
- ncdfe.printStackTrace();
- errorExit("Unable to find class: " + appName);
- } catch (ClassNotFoundException cnfe) {
- cnfe.printStackTrace();
- errorExit("Unable to find class: " + appName);
- }
-
- return null;
- }
-
- //try to install webstart proxy to avoid asking user for proxy info
- private static void tryToSetProxy() {
- try {
- if (attrs != null) {
- String proxySetting = attrs.getValue(manifestAutoProxy);
- if (proxySetting != null && !"auto".equals(proxySetting.toLowerCase())) {
- if (verbose) {
- System.out.println("Auto proxy detection is disabled in manifest.");
- }
- return;
- }
- }
-
- //if explicit proxy settings are proxided we will skip autoproxy
- //Note: we only check few most popular settings.
- if (System.getProperty("http.proxyHost") != null
- || System.getProperty("https.proxyHost") != null
- || System.getProperty("ftp.proxyHost") != null
- || System.getProperty("socksProxyHost") != null) {
- if (verbose) {
- System.out.println("Explicit proxy settings detected. Skip autoconfig.");
- System.out.println(" http.proxyHost=" + System.getProperty("http.proxyHost"));
- System.out.println(" https.proxyHost=" + System.getProperty("https.proxyHost"));
- System.out.println(" ftp.proxyHost=" + System.getProperty("ftp.proxyHost"));
- System.out.println(" socksProxyHost=" + System.getProperty("socksProxyHost"));
- }
- return;
- }
- if (System.getProperty("javafx.autoproxy.disable") != null) {
- if (verbose) {
- System.out.println("Disable autoproxy on request.");
- }
- return;
- }
-
- Class sm = Class.forName("com.sun.deploy.services.ServiceManager",
- true,
- Thread.currentThread().getContextClassLoader());
- Class params[] = {Integer.TYPE};
- Method setservice = sm.getDeclaredMethod("setService", params);
- String osname = System.getProperty("os.name");
-
- String servicename = null;
- if (osname.startsWith("Win")) {
- servicename = "STANDALONE_TIGER_WIN32";
- } else if (osname.contains("Mac")) {
- servicename = "STANDALONE_TIGER_MACOSX";
- } else {
- servicename = "STANDALONE_TIGER_UNIX";
- }
- Object values[] = new Object[1];
- Class pt = Class.forName("com.sun.deploy.services.PlatformType",
- true,
- Thread.currentThread().getContextClassLoader());
- values[0] = pt.getField(servicename).get(null);
- setservice.invoke(null, values);
-
- Class dps = Class.forName(
- "com.sun.deploy.net.proxy.DeployProxySelector",
- true,
- Thread.currentThread().getContextClassLoader());
- Method m = dps.getDeclaredMethod("reset", new Class[0]);
- m.invoke(null, new Object[0]);
- if (verbose) {
- System.out.println("Autoconfig of proxy is completed.");
- }
- } catch (Exception e) {
- if (verbose) {
- System.out.println("Failed to autoconfig proxy due to "+e);
- }
- }
- }
-
- private static void processUpdateHook(String updateHookName) {
- if (updateHookName == null) {
- return;
- }
-
- try {
- // load UpdateHook class
- if (verbose) {
- System.err.println("Try calling Class.forName(" + updateHookName
- + ") using classLoader = "
- + Thread.currentThread().getContextClassLoader());
- }
- Class hookClass = Class.forName(updateHookName, false,
- Thread.currentThread().getContextClassLoader());
- if (verbose) {
- System.err.println("found class: " + hookClass.getCanonicalName());
- }
-
- Method mainMethod = hookClass.getMethod("main",
- new Class[] { (new String[0]).getClass() });
- String args[] = null;
- mainMethod.invoke(null, new Object[] {args});
-
- } catch (Exception ex) {
- if (verbose) {
- System.err.println("Failed to run update hook: "+ex.getMessage());
- ex.printStackTrace();
- }
- }
- }
-
- private static void launchApp(Method launchMethod,
- String appName,
- String preloaderName,
- String updateHookName,
- String[] args) {
-
- Class preloaderClass = null;
- if (preloaderName != null) {
- preloaderClass = getAppClass(preloaderName);
- }
- Class appClass = getAppClass(appName);
- Class fxApplicationClass = null;
- try {
- fxApplicationClass = Class.forName(fxApplicationClassName,
- true, Thread.currentThread().getContextClassLoader());
- } catch (NoClassDefFoundError ex) {
- errorExit("Cannot find " + fxApplicationClassName);
- } catch (ClassNotFoundException ex) {
- errorExit("Cannot find " + fxApplicationClassName);
- }
-
- if (fxApplicationClass.isAssignableFrom(appClass)) {
- try {
- if (verbose) {
- System.err.println("launchApp: Try calling "
- + launchMethod.getDeclaringClass().getName() + "."
- + launchMethod.getName());
- }
- tryToSetProxy();
- processUpdateHook(updateHookName);
- launchMethod.invoke(null, new Object[] { appClass, preloaderClass, args });
- } catch (InvocationTargetException ex) {
- ex.printStackTrace();
- errorExit("Exception while running Application");
- } catch (Exception ex) {
- ex.printStackTrace();
- errorExit("Unable to invoke launch method");
- }
- } else {
- try {
- if (verbose) {
- System.err.println("Try calling " + appClass.getName()
- + ".main(String[])");
- }
- Method mainMethod = appClass.getMethod("main",
- new Class[] { (new String[0]).getClass() });
- mainMethod.invoke(null, new Object[] { args });
- } catch (Exception ex) {
- ex.printStackTrace();
- errorExit("Unable to invoke main method");
- }
- }
- }
-
- // Check the JRE version. Exit with error if < 1.6
- private static boolean checkJre() {
- if (verbose) {
- System.err.println("java.version = "
- + System.getProperty("java.version"));
- System.err.println("java.runtime.version = "
- + System.getProperty("java.runtime.version"));
- }
-
- // Check for minimum JRE version
- if (isOldJRE()) {
- showFallback(true);
- return false;
- }
- return true;
- }
-
- private static Method findLaunchMethod(String fxClassPath) {
- Method launchMethod;
-
- // Try to find JavaFX LauncherImpl class on classpath
- if (verbose) {
- System.err.println("1) Try existing classpath...");
- }
- launchMethod = findLaunchMethodInClasspath(fxClassPath);
- if (launchMethod != null) {
- return launchMethod;
- }
-
- // Check for javafx.runtime.path variable; if set, look for the
- // JavaFX LauncherImpl class there.
- if (verbose) {
- System.err.println("2) Try javafx.runtime.path property...");
- }
- String javafxRuntimePath = System.getProperty("javafx.runtime.path");
- if (javafxRuntimePath != null) {
- if (verbose) {
- System.err.println(" javafx.runtime.path = " + javafxRuntimePath);
- }
- launchMethod = findLaunchMethodInJar(javafxRuntimePath, fxClassPath);
- }
- if (launchMethod != null) {
- return launchMethod;
- }
-
- if (verbose) {
- System.err.println("3) Look for cobundled JavaFX ... " +
- "[java.home="+System.getProperty("java.home"));
- }
- launchMethod = findLaunchMethodInJar(
- System.getProperty("java.home"), fxClassPath);
- if (launchMethod != null) {
- return launchMethod;
- }
-
- // Check the platform registry for this architecture.
- if (verbose) {
- System.err.println("4) Look in the OS platform registry...");
- }
- javafxRuntimePath = lookupRegistry();
- if (javafxRuntimePath != null) {
- if (verbose) {
- System.err.println(" Installed JavaFX runtime found in: "
- + javafxRuntimePath);
- }
- launchMethod = findLaunchMethodInJar(javafxRuntimePath, fxClassPath);
- if (launchMethod != null) {
- return launchMethod;
- }
- }
-
- return launchMethod;
- }
-
- public static void main(String [] args) {
- // Set verbose flag
- verbose = Boolean.getBoolean("javafx.verbose");
-
- // First check the minimum JRE
- if (!checkJre()) {
- return;
- }
-
- // Load the main jar manifest attributes
- try {
- attrs = getJarAttributes();
- } catch (Exception ex) {
- ex.printStackTrace();
- errorExit("Unable to load jar manifest");
- }
-
- // Next get the application name
- String appName = getAppName(attrs, false);
- if (verbose) {
- System.err.println("appName = " + appName);
- }
- if (appName == null) {
- errorExit("Unable to find application class name");
- }
-
- // Next get the preloader name
- String preloaderName = getAppName(attrs, true);
- if (verbose) {
- System.err.println("preloaderName = " + preloaderName);
- }
-
- String embeddedArgs[] = getAppArguments(attrs);
- if (verbose) {
- System.err.println("embeddedArgs = " + Arrays.toString(embeddedArgs));
- System.err.println("commandLineArgs = " + Arrays.toString(args));
- }
-
- String updateHook = (String) attrs.getValue(manifestUpdateHook);
- if (verbose && updateHook != null) {
- System.err.println("updateHook = " + updateHook);
- }
-
- // Get JavaFX-Class-Path entry
- String fxClassPath;
- if (attrs != null) {
- fxClassPath = (String)attrs.getValue(manifestClassPath);
- } else {
- fxClassPath = "";
- }
-
- Method launchMethod = findLaunchMethod(fxClassPath);
- if (launchMethod != null) {
- launchApp(launchMethod, appName, preloaderName, updateHook,
- args.length > 0 ? args: embeddedArgs);
- return;
- }
-
- showFallback(false);
- }
-
- private static void showFallback(final boolean jreError) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- JFrame f = new JFrame("JavaFX Launcher");
- f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- JApplet japp = null;
-
- //try to use custom fallback if available
- if (attrs != null && attrs.getValue(manifestFallbackClass) != null) {
- Class customFallback = null;
- try {
- customFallback = Class.forName(
- attrs.getValue(manifestFallbackClass), false,
- Thread.currentThread().getContextClassLoader());
- } catch (ClassNotFoundException ce) {
- System.err.println("Custom fallback class is not found: "
- + attrs.getValue(manifestFallbackClass));
- }
-
- //If custom fallback attribute actually points to the
- // default JavaFX fallback we want to use other way to launch it
- if (customFallback != null
- && !NoJavaFXFallback.class.getName().equals(
- customFallback.getName())) {
- try {
- japp = (JApplet) customFallback.newInstance();
- } catch (Exception e) {
- System.err.println("Failed to instantiate custom fallback "
- + customFallback.getName() + " due to " + e);
- }
- }
- }
-
- //custom fallback missing or we fail to init it
- if (japp == null) {
- //custom fallback will need to figure reason of error
- //on its own. Generic fallback gets extra input.
- japp = new NoJavaFXFallback(
- jreError, !jreError, JAVAFX_REQUIRED_VERSION);
- f.getContentPane().add(japp); //could be old JRE! use content pane
- f.pack();
- f.setVisible(true);
- } else {
- japp.init();
- f.getContentPane().add(japp); //could be old JRE! use content pane
- japp.start();
- f.pack();
- f.setVisible(true);
- }
-
- }
- });
- }
-
- private static void errorExit(final String string) {
- try {
- Runnable runnable = new Runnable() {
- public void run() {
- try {
- Class componentClass = Class.forName("java.awt.Component");
- Class jOptionPaneClass = Class.forName("javax.swing.JOptionPane");
- Field ERROR_MESSAGE_Field = jOptionPaneClass.getField("ERROR_MESSAGE");
- final int ERROR_MESSAGE = ERROR_MESSAGE_Field.getInt(null);
- Method showMessageDialogMethod = jOptionPaneClass.getMethod(
- "showMessageDialog",
- new Class[] { componentClass,
- Object.class,
- String.class,
- Integer.TYPE });
- showMessageDialogMethod.invoke(null, new Object[] {
- null, string, "JavaFX Launcher Error",
- new Integer(ERROR_MESSAGE) });
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
- };
-
- Class swingUtilsClass = Class.forName("javax.swing.SwingUtilities");
- Method invokeAndWaitMethod = swingUtilsClass.getMethod("invokeAndWait",
- new Class[] { Runnable.class });
- invokeAndWaitMethod.invoke(null, new Object[] { runnable });
- if (verbose) {
- System.err.println("Done with invoke and wait");
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- System.exit(1);
- }
-
- // Package-scope method used to check minimum JRE version
- static boolean isOldJRE() {
- return getJavaVersionAsFloat() < 160.18f; //< 6u18
-}
-
- static float getJavaVersionAsFloat() {
- String versionString = System.getProperty("java.version", "1.5.0");
-
- StringBuffer sb = new StringBuffer();
-
- int firstDot = versionString.indexOf(".");
- sb.append(versionString.substring(0,firstDot));
-
- int secondDot = versionString.indexOf(".", firstDot+1);
- sb.append(versionString.substring(firstDot+1, secondDot));
-
- int underscore = versionString.indexOf("_", secondDot+1);
- if (underscore >= 0) {
- int dash = versionString.indexOf("-", underscore+1);
- if (dash < 0) {
- dash = versionString.length();
- }
- sb.append(versionString.substring(secondDot+1, underscore)).
- append(".").
- append(versionString.substring(underscore+1, dash));
- } else {
- int dash = versionString.indexOf("-", secondDot+1);
- if (dash < 0) {
- dash = versionString.length();
- }
- sb.append(versionString.substring(secondDot+1, dash));
- }
-
- float version = 150.0f;
- try {
- version = Float.parseFloat(sb.toString());
- } catch (NumberFormatException e) {}
-
- return version;
- }
-
-}
--- old/modules/jdk.packager/src/main/java/com/javafx/main/NoJavaFXFallback.java 2016-11-02 13:31:06.925210937 -0400
+++ /dev/null 2016-10-31 09:37:02.128008072 -0400
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.javafx.main;
-
-import java.applet.Applet;
-import java.awt.BorderLayout;
-import java.awt.Container;
-import java.awt.Desktop;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.lang.reflect.Method;
-import java.net.URL;
-import javax.swing.JApplet;
-import javax.swing.JButton;
-import javax.swing.JTextPane;
-
-public class NoJavaFXFallback extends JApplet implements ActionListener {
- boolean isInBrowser = false;
- boolean oldJRE = true;
- String requiredJavaFXVersion = null;
- boolean oldJavaFX = false;
- boolean doNotUseJNLPAPI = false;
-
- public NoJavaFXFallback() {
- }
-
- //used by standalone launcher
- public NoJavaFXFallback(boolean needJREUpgrade, boolean needFXUpgrade, String requiredJavaFX) {
- this.isInBrowser = false;
- this.oldJavaFX = needFXUpgrade;
- this.requiredJavaFXVersion = requiredJavaFX;
- this.oldJRE = needJREUpgrade;
- this.doNotUseJNLPAPI = true;
-
- populate();
- }
-
-
- private void test() {
- oldJRE = Main.isOldJRE();
- try {
- // if run in browser then should be able to get JSObject
- Class jclass = Class.forName("netscape.javascript.JSObject");
- Method m = jclass.getMethod("getWindow", new Class[] {Applet.class});
- isInBrowser = (m.invoke(null, new Object[] {this}) != null);
- } catch (Exception e) {}
- }
-
- String getText() {
- String text = "This application requires a newer version "
- + "of the Java runtime. Please download and install the "
- + "latest Java runtime from java.com.";
- if (isInBrowser) {
- text = text + " Then restart the browser.";
- } else {
- text = text + " Then restart the application.";
- }
- return text;
- }
-
- public void init() {
- //do not get here in the standalone more
- requiredJavaFXVersion = getParameter("requiredFXVersion");
- test();
- populate();
- }
-
- private void populate() {
- Container pane = this.getContentPane();
- pane.setLayout(new BorderLayout());
- JTextPane l = new JTextPane();
- l.setText(getText());
- l.setEditable(false);
-
- pane.add(l, BorderLayout.CENTER);
-
- if (Main.getJavaVersionAsFloat() > 160f || //can use AWT APIs
- (Main.getJavaVersionAsFloat() > 150f && !doNotUseJNLPAPI)) { //do not have JNLP API in 1.4?
- JButton installButton = new JButton("Install Now");
- installButton.addActionListener(this);
- pane.add(installButton, BorderLayout.SOUTH);
- }
- }
-
- public void actionPerformed(ActionEvent ae) {
- try {
- URL u = new URL("http://java.com/");
- if (isInBrowser) {
- getAppletContext().showDocument(u);
- } else {
- if (!doNotUseJNLPAPI) {
- Class sm = Class.forName("javax.jnlp.ServiceManager");
- Class bs = Class.forName("javax.jnlp.BasicService");
- Method lookup = sm.getMethod(
- "lookup", new Class[]{String.class});
- Method showDoc = bs.getMethod(
- "showDocument", new Class[]{java.net.URL.class});
- Object s = lookup.invoke(
- null, new Object[]{"javax.jnlp.BasicService"});
- showDoc.invoke(s, new Object[]{u});
- } else { //running standalone app?
- //use awt.Desktop. if we got here then it must be available
- Desktop d = Desktop.getDesktop();
- if (d != null) {
- d.browse(u.toURI());
- }
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
--- old/modules/javafx.graphics/src/main/java/com/sun/javafx/application/LauncherImpl.java 2016-11-02 13:31:07.173205303 -0400
+++ new/modules/javafx.graphics/src/main/java/com/sun/javafx/application/LauncherImpl.java 2016-11-02 13:31:07.065207756 -0400
@@ -481,7 +481,7 @@
}
}
- // we have to add jfxrt.jar to the new class loader, or the app won't load
+ // we have to add the current code source to the new class loader, or the app won't load
URL jfxRtURL = LauncherImpl.class.getProtectionDomain().getCodeSource().getLocation();
urlList.add(jfxRtURL);
--- old/modules/javafx.graphics/src/main/java/com/sun/javafx/css/parser/Css2Bin.java 2016-11-02 13:31:07.561196487 -0400
+++ new/modules/javafx.graphics/src/main/java/com/sun/javafx/css/parser/Css2Bin.java 2016-11-02 13:31:07.453198941 -0400
@@ -31,7 +31,7 @@
import java.io.IOException;
/** Css2Bin [
Commom types of charts such as {@link javafx.scene.chart.BarChart
Bar}, {@link javafx.scene.chart.LineChart Line}, {@link
javafx.scene.chart.AreaChart Area}, {@link
@@ -239,4 +239,4 @@