diff --git a/.github/workflows/gradle-build.yml b/.github/workflows/gradle-build.yml index 6e8ce08..870a5c0 100644 --- a/.github/workflows/gradle-build.yml +++ b/.github/workflows/gradle-build.yml @@ -12,8 +12,7 @@ jobs: strategy: matrix: os: [macos-latest, windows-latest, ubuntu-latest] - java-version: [11, 17] - graalvm-version: ['22.3.3'] + java-version: [17, 21] graalvm-distribution: ['graalvm-community'] fail-fast: false @@ -32,20 +31,10 @@ jobs: restore-keys: ${{ runner.os }}-gradle- - name: Set up GraalVM ${{ matrix.graalvm-distribution }} for Java ${{ matrix.java-version }} - if: matrix.java-version == 17 uses: graalvm/setup-graalvm@v1 with: java-version: ${{ matrix.java-version }} distribution: ${{ matrix.graalvm-distribution }} - components: 'native-image' - - - name: Set up GraalVM ${{ matrix.graalvm-version }} for Java ${{ matrix.java-version }} - if: matrix.java-version == 11 - uses: graalvm/setup-graalvm@v1 - with: - java-version: ${{ matrix.java-version }} - version: ${{ matrix.graalvm-version }} - components: 'native-image' - name: Report Java version run: | diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml index 5eac846..e4d3e94 100644 --- a/.github/workflows/maven-build.yml +++ b/.github/workflows/maven-build.yml @@ -12,8 +12,7 @@ jobs: strategy: matrix: os: [macos-latest, windows-latest, ubuntu-latest] - java-version: [11, 17] - graalvm-version: ['22.3.3'] + java-version: [17, 21] graalvm-distribution: ['graalvm-community'] fail-fast: false @@ -22,20 +21,10 @@ jobs: uses: actions/checkout@v3 - name: Set up GraalVM ${{ matrix.graalvm-distribution }} for Java ${{ matrix.java-version }} - if: matrix.java-version == 17 uses: graalvm/setup-graalvm@v1 with: java-version: ${{ matrix.java-version }} distribution: ${{ matrix.graalvm-distribution }} - components: 'native-image' - - - name: Set up GraalVM ${{ matrix.graalvm-version }} for Java ${{ matrix.java-version }} - if: matrix.java-version == 11 - uses: graalvm/setup-graalvm@v1 - with: - java-version: ${{ matrix.java-version }} - version: ${{ matrix.graalvm-version }} - components: 'native-image' - name: Report Java version run: | @@ -52,22 +41,22 @@ jobs: - name: Package Linux artifact if: runner.os == 'Linux' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: lwjgl3-helloworld ${{ runner.os }} native image with SubstrateVM Java ${{ matrix.java-version }} - path: target/native-image-linux/lwjgl3-helloworld** + path: target/lwjgl3-helloworld - name: Package MacOS artifact if: runner.os == 'macOS' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: lwjgl3-helloworld ${{ runner.os }} native image with SubstrateVM Java ${{ matrix.java-version }} - path: target/native-image-macos/lwjgl3-helloworld* + path: target/lwjgl3-helloworld - name: Package Windows artifact if: runner.os == 'Windows' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: lwjgl3-helloworld ${{ runner.os }} native image with SubstrateVM Java ${{ matrix.java-version }} - path: target/native-image-windows/lwjgl3-helloworld.exe + path: target/lwjgl3-helloworld.exe diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index 8d98d6d..4a95a13 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -14,5 +14,5 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar diff --git a/build.gradle b/build.gradle index 07a0761..6277bf3 100644 --- a/build.gradle +++ b/build.gradle @@ -1,11 +1,11 @@ plugins { id 'application' - id 'org.graalvm.buildtools.native' version '0.9.25' + id 'org.graalvm.buildtools.native' version '0.9.28' id 'com.google.osdetector' version '1.7.3' } tasks.wrapper { - gradleVersion = '8.3' + gradleVersion = '8.5' distributionType = Wrapper.DistributionType.ALL } @@ -43,7 +43,6 @@ ext { mainClassName = 'com.github.chirontt.lwjgl.demo.HelloWorld' currentPlatform = getCurrentPlatform() - nativeImageDirName = "native-image-$currentPlatform" } repositories { @@ -129,29 +128,6 @@ task uberJar(type: Jar) { duplicatesStrategy 'exclude' } -//remove unneeded .dll/.txt files -task removeUnneededDllFiles { - doLast { - if (file("$buildDir/$nativeImageDirName").exists()) { - ant.move(todir: "$buildDir/tmp/$nativeImageDirName") { - fileset(dir: "$buildDir/$nativeImageDirName") { - include name: '*.dll' - include name: '*.pdb' - include name: '*.txt' - } - } - } - if (file("$buildDir/$nativeImageDirName/reports").exists()) { - ant.move(file: "$buildDir/$nativeImageDirName/reports", - tofile: "$buildDir/tmp/$nativeImageDirName/reports") - } - if (file("$buildDir/$nativeImageDirName/sources").exists()) { - ant.move(file: "$buildDir/$nativeImageDirName/sources", - tofile: "$buildDir/tmp/$nativeImageDirName/sources") - } - } -} - graalvmNative { toolchainDetection = false binaries { @@ -164,9 +140,7 @@ graalvmNative { buildArgs.add('--initialize-at-run-time=org.lwjgl') buildArgs.add('--native-image-info') - //buildArgs.add('-march=native') //only available in GraalVM for JDK 17+ - buildArgs.add("-H:Path=$buildDir/$nativeImageDirName") - buildArgs.add("-H:TempDirectory=$buildDir/tmp/$nativeImageDirName") + buildArgs.add('-march=compatibility') //only available in GraalVM for JDK 17+ //buildArgs.add('-H:+TraceNativeToolUsage') useFatJar = false @@ -181,6 +155,5 @@ tasks.named("nativeCompile") { //use the uber jar if long classpath becomes a problem in Windows: //dependsOn uberJar //classpathJar = uberJar.archiveFile - finalizedBy removeUnneededDllFiles } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index c1962a7..d64cd49 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 03bc515..e6aba25 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.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index aeb74cb..1aa94a4 100755 --- a/gradlew +++ b/gradlew @@ -83,7 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -130,10 +131,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. @@ -141,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -149,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -198,11 +202,11 @@ fi # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/pom.xml b/pom.xml index 054e106..0bae2bd 100644 --- a/pom.xml +++ b/pom.xml @@ -11,8 +11,7 @@ 3.11.0 3.5.0 3.3.3-SNAPSHOT - 0.9.25 - native-image-${platform} + 0.9.28 com.github.chirontt.lwjgl.demo.HelloWorld ${project.name} ${exec.mainClass} @@ -227,10 +225,8 @@ --initialize-at-run-time=org.lwjgl --native-image-info --verbose - + -march=compatibility - -H:TempDirectory=${project.build.directory}/tmp/${native.image.dir.name} - -H:Path=${project.build.directory}/${native.image.dir.name} false