Skip to content

Commit

Permalink
Backport 89d1cf2
Browse files Browse the repository at this point in the history
  • Loading branch information
sercher committed Sep 10, 2024
1 parent 0eef854 commit a5d4136
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 12 deletions.
47 changes: 38 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,9 @@ if (BUILD_CLOSED) {
defineProperty("GRADLE_VERSION_CHECK", "true")
ext.IS_GRADLE_VERSION_CHECK = Boolean.parseBoolean(GRADLE_VERSION_CHECK)

// JAVA_TARGET_VERSION specifies the minimum compile and runtime Java version that we will target when building the JavaFX classes
ext.JAVA_TARGET_VERSION = Integer.parseInt(jfxJdkTargetVersion)

// JFX_DEPS_URL specifies the optional location of an alternate local repository
defineProperty("JFX_DEPS_URL", "")

Expand Down Expand Up @@ -640,8 +643,12 @@ try {
defineProperty("jdkBuildNumber", jdkVersionInfo[1])

// Define global properties based on the version of Java
def status = compareJdkVersion(jdkVersion, "12")
ext.jdk12OrLater = (status >= 0)
// For example, we could define a "jdk18OrLater" property as
// follows that could then be used to implement conditional build
// logic based on whether we were running on JDK 18 or later,
// should the need arise.
// def status = compareJdkVersion(jdkVersion, "17")
// ext.jdk18OrLater = (status >= 0)
}
}
} finally {
Expand Down Expand Up @@ -1341,6 +1348,7 @@ logger.quiet("jdk version: ${jdkVersion}")
logger.quiet("jdk build number: ${jdkBuildNumber}")
logger.quiet("minimum jdk version: ${jfxBuildJdkVersionMin}")
logger.quiet("minimum jdk build number: ${jfxBuildJdkBuildnumMin}")
logger.quiet("Java target version: ${JAVA_TARGET_VERSION}")

if (IS_LINUX) {
logger.quiet("GCC version: ${jfxBuildLinuxGccVersion}")
Expand Down Expand Up @@ -1955,7 +1963,11 @@ allprojects {
// All of our projects are java projects

apply plugin: "java"
sourceCompatibility = 11

// Set sourceCompatibility to the target release of Java. Most modules
// set compiler.options.release (to the same target version), which will
// override this setting, but it is needed for those modules that can't.
sourceCompatibility = JAVA_TARGET_VERSION

// By default all of our projects require junit for testing so we can just
// setup this dependency here.
Expand Down Expand Up @@ -2626,6 +2638,12 @@ project(":controls") {

project(":swing") {

// We need to skip setting compiler.options.release for this module,
// since javafx.swing requires jdk.unsupported.desktop, which is
// excluded by "--release NN". This will fall back to using
// "-source NN -target NN" for this module.
project.ext.skipJavaCompilerOptionRelease = true

tasks.all {
if (!COMPILE_SWING) it.enabled = false
}
Expand Down Expand Up @@ -3490,9 +3508,7 @@ project(":web") {
dependsOn webArchiveJar
def testResourceDir = file("$buildDir/testing/resources")
jvmArgs "-DWEB_ARCHIVE_JAR_TEST_DIR=$testResourceDir"
if (jdk12OrLater) {
systemProperty 'java.security.manager', 'allow'
}
systemProperty 'java.security.manager', 'allow'
}

task compileJavaDOMBinding()
Expand Down Expand Up @@ -3702,6 +3718,12 @@ project(":systemTests") {
sourceSets.testscriptapp2
]

// We need to skip setting compiler.options.release for system tests,
// since the tests export an internal package from java.desktop, which
// is disallowed by "--release NN". This will fall back to using
// "-source NN -target NN" for the system tests.
project.ext.skipJavaCompilerOptionRelease = true

project.ext.buildModule = false
project.ext.moduleRuntime = false
project.ext.moduleName = "systemTests"
Expand Down Expand Up @@ -3871,9 +3893,7 @@ project(":systemTests") {
systemProperty "ClipShapeTest.numTests", rootProject.getProperty("ClipShapeTest.numTests")
}

if (jdk12OrLater) {
systemProperty 'java.security.manager', 'allow'
}
systemProperty 'java.security.manager', 'allow'

if (!IS_USE_ROBOT) {
// Disable all robot-based visual tests
Expand Down Expand Up @@ -3908,6 +3928,15 @@ allprojects {
} else if (compile.options.hasProperty("incremental")) {
compile.options.incremental = IS_INCREMENTAL
}

if (project.hasProperty('skipJavaCompilerOptionRelease') &&
project.ext.skipJavaCompilerOptionRelease) {

logger.info "Using 'javac -source/-target' for ${compile}"
} else {
compile.options.release = JAVA_TARGET_VERSION
}

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
Expand Down
11 changes: 8 additions & 3 deletions build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,18 @@ javadoc.header=JavaFX 17
# jfx.build.jdk.buildnum.min should be set to the lowest version that
# supports building FX (which must be <= jfx.build.jdk.buildnum)
#
# jfx.jdk.target.version is set to the minimum runtime version that
# JavaFX will run on. This is passed to javac as the value of "--release",
# so it also defines the language features that can be used.
#
##############################################################################

# JDK
jfx.build.jdk.version=17.0.4
jfx.build.jdk.buildnum=11
jfx.build.jdk.version.min=11
jfx.build.jdk.buildnum.min=28
jfx.build.jdk.version.min=17
jfx.build.jdk.buildnum.min=35
jfx.jdk.target.version=17

# The jfx.gradle.version property defines the version of gradle that is
# used in the build. It must match the version number in
Expand All @@ -85,7 +90,7 @@ jfx.build.jdk.buildnum.min=28
# The jfx.gradle.version.min property defines the minimum version of gradle
# that is supported. It must be <= jfx.gradle.version.
jfx.gradle.version=7.3
jfx.gradle.version.min=6.3
jfx.gradle.version.min=7.3

# Toolchains
jfx.build.linux.gcc.version=gcc12.2.0-OL6.4+1.0
Expand Down

0 comments on commit a5d4136

Please sign in to comment.