diff --git a/build.gradle b/build.gradle index adc027944f..750f33b916 100644 --- a/build.gradle +++ b/build.gradle @@ -27,13 +27,30 @@ plugins { // Definitions defaultTasks 'clean', 'build' -sourceCompatibility = 20 -targetCompatibility = 20 +java { + sourceCompatibility = JavaVersion.VERSION_20 + targetCompatibility = JavaVersion.VERSION_20 +} + +def javaArgs = [ + "-Xss8M", "-Dsun.java2d.d3d=false", "-Dsentry.environment=Production", "-Dfile.encoding=UTF-8", + "-Dpolyglot.engine.WarnInterpreterOnly=false", + "-DMAPTOOL_DATADIR=.maptool-" + vendor.toLowerCase(), "-XX:+ShowCodeDetailsInExceptionMessages", + "--add-opens=java.desktop/java.awt=ALL-UNNAMED", "--add-opens=java.desktop/java.awt.geom=ALL-UNNAMED", + "--add-opens=java.desktop/sun.awt.geom=ALL-UNNAMED", "--add-opens=java.base/java.util=ALL-UNNAMED", + "--add-opens=javafx.web/javafx.scene.web=ALL-UNNAMED", "--add-opens=javafx.web/com.sun.webkit=ALL-UNNAMED", "--add-opens=javafx.web/com.sun.webkit.dom=ALL-UNNAMED", + "--add-opens=java.desktop/javax.swing=ALL-UNNAMED","--add-opens=java.desktop/sun.awt.shell=ALL-UNNAMED", + "--add-opens=java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED"] // Used by gradle assemble & run tasks -mainClassName = 'net.rptools.maptool.client.LaunchInstructions' -applicationDefaultJvmArgs = ["-Xss8M"] +application { + mainClass = 'net.rptools.maptool.client.LaunchInstructions' + applicationDefaultJvmArgs = javaArgs + ["-DRUN_FROM_IDE=true"] + if (osdetector.os.is('osx')) { + applicationDefaultJvmArgs += [ '-Xdock:name=' + project.name + developerRelease ] + } +} def appSemVer = "" def winUpgradeUUID = UUID.randomUUID().toString(); @@ -140,21 +157,9 @@ sourceSets { run { args = ['-v=' + appSemVer] - applicationDefaultJvmArgs = ["-Xss8M", "-Dsun.java2d.d3d=false", "-Dsentry.environment=Development", "-Dfile.encoding=UTF-8", - "-Dpolyglot.engine.WarnInterpreterOnly=false","-DRUN_FROM_IDE=true", - "-DMAPTOOL_DATADIR=.maptool-" + vendor.toLowerCase(), "-XX:+ShowCodeDetailsInExceptionMessages", - "--add-opens=java.desktop/java.awt=ALL-UNNAMED", "--add-opens=java.desktop/java.awt.geom=ALL-UNNAMED", - "--add-opens=java.desktop/sun.awt.geom=ALL-UNNAMED", "--add-opens=java.base/java.util=ALL-UNNAMED", - "--add-opens=javafx.web/javafx.scene.web=ALL-UNNAMED", "--add-opens=javafx.web/com.sun.webkit=ALL-UNNAMED", "--add-opens=javafx.web/com.sun.webkit.dom=ALL-UNNAMED", - "--add-opens=java.desktop/javax.swing=ALL-UNNAMED", "--add-opens=java.desktop/sun.awt.shell=ALL-UNNAMED", - "--add-opens=java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED"] // Add -Dlog4j2.debug to see log4j2 details // Add -Djavax.net.debug=all to debug networking issues - if (osdetector.os.is('osx')) { - applicationDefaultJvmArgs += [ '-Xdock:name=' + project.name + developerRelease ] - } - if (System.getProperty("exec.args") != null) { args System.getProperty("exec.args").split() } @@ -163,7 +168,7 @@ run { compileJava.configure { // Keep the uninstrumented .class files out of the final destination directory. Otherwise we // might instrument the same file twice, resulting in duplicate methods. - destinationDirectory = file("$buildDir/classes/java/main-uninstrumented") + destinationDirectory = file("${layout.buildDirectory.get()}/classes/java/main-uninstrumented") } def instrumentForms = tasks.register('instrumentForms', Sync) { @@ -226,15 +231,7 @@ runtime { jpackage { installerOutputDir = file("releases") - jvmArgs = ["-Xss8M", "-Dsun.java2d.d3d=false", "-Dsentry.environment=Production", "-Dfile.encoding=UTF-8", - "-Dpolyglot.engine.WarnInterpreterOnly=false", - "-DMAPTOOL_DATADIR=.maptool-" + vendor.toLowerCase(), "-XX:+ShowCodeDetailsInExceptionMessages", - "--add-opens=java.desktop/java.awt=ALL-UNNAMED", "--add-opens=java.desktop/java.awt.geom=ALL-UNNAMED", - "--add-opens=java.desktop/sun.awt.geom=ALL-UNNAMED", "--add-opens=java.base/java.util=ALL-UNNAMED", - "--add-opens=javafx.web/javafx.scene.web=ALL-UNNAMED", "--add-opens=javafx.web/com.sun.webkit=ALL-UNNAMED", "--add-opens=javafx.web/com.sun.webkit.dom=ALL-UNNAMED", - "--add-opens=java.desktop/javax.swing=ALL-UNNAMED","--add-opens=java.desktop/sun.awt.shell=ALL-UNNAMED", - "--add-opens=java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED" - ] + jvmArgs = javaArgs imageOptions = [] imageName = project.name + developerRelease @@ -452,6 +449,7 @@ dependencies { // testimplementation dependency to testimplementation 'org.testng:testng:6.8.1' and add // 'test.useTestNG()' to your build script. //testCompile 'junit:junit:4.12' + testRuntimeOnly("org.junit.platform:junit-platform-launcher") testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' implementation group: 'com.google.code.gson', name: 'gson', version: '2.9.0' // https://mvnrepository.com/artifact/com.google.code.gson/gson @@ -546,9 +544,9 @@ shadowJar { 'Built-By': System.getProperty('user.name'), 'Built-Date': new Date(), 'Built-JDK': System.getProperty('java.version'), - 'Source-Compatibility': project.sourceCompatibility, - 'Target-Compatibility': project.targetCompatibility, - 'Main-Class': project.mainClassName, + 'Source-Compatibility': project.java.sourceCompatibility, + 'Target-Compatibility': project.java.targetCompatibility, + 'Main-Class': project.application.mainClass, 'Multi-Release': true } @@ -565,9 +563,9 @@ jar { 'Built-By': System.getProperty('user.name'), 'Built-Date': new Date(), 'Built-JDK': System.getProperty('java.version'), - 'Source-Compatibility': project.sourceCompatibility, - 'Target-Compatibility': project.targetCompatibility, - 'Main-Class': project.mainClassName + 'Source-Compatibility': project.java.sourceCompatibility, + 'Target-Compatibility': project.java.targetCompatibility, + 'Main-Class': project.application.mainClass } } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index c1962a79e2..033e24c4cd 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 17a8ddce2d..3fa8f862f7 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index aeb74cbb43..fcb6fca147 100755 --- a/gradlew +++ b/gradlew @@ -130,10 +130,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can.