diff --git a/.github/workflows/gradle-build.yml b/.github/workflows/gradle-build.yml index 9bc0ade..e98b19a 100644 --- a/.github/workflows/gradle-build.yml +++ b/.github/workflows/gradle-build.yml @@ -12,8 +12,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest] - java-version: [11, 17] - graalvm-version: ['22.3.2'] + java-version: [17, 21] graalvm-distribution: ['graalvm-community'] fail-fast: false @@ -34,11 +33,24 @@ jobs: - name: Download Liberica NIK ${{ matrix.graalvm-distribution }} for Java ${{ matrix.java-version }} (Linux) if: runner.os == 'Linux' && matrix.java-version == 17 run: | - download_url="https://download.bell-sw.com/vm/23.0.0/bellsoft-liberica-vm-core-openjdk17.0.7+7-23.0.0+1-linux-amd64.tar.gz" + download_url="https://download.bell-sw.com/vm/23.0.2/bellsoft-liberica-vm-core-openjdk17.0.9+11-23.0.2+1-linux-amd64.tar.gz" wget -O $RUNNER_TEMP/java_package.tar.gz $download_url + - name: Download Liberica NIK ${{ matrix.graalvm-distribution }} for Java ${{ matrix.java-version }} (Linux) + if: runner.os == 'Linux' && matrix.java-version == 21 + run: | + download_url="https://download.bell-sw.com/vm/23.1.1/bellsoft-liberica-vm-core-openjdk21.0.1+12-23.1.1+1-linux-amd64.tar.gz" + wget -O $RUNNER_TEMP/java_package.tar.gz $download_url + + - name: Download Liberica NIK ${{ matrix.graalvm-distribution }} for Java ${{ matrix.java-version }} (Windows) + if: runner.os == 'Windows' && matrix.java-version == 21 + shell: cmd + run: | + set download_url="https://download.bell-sw.com/vm/23.1.1/bellsoft-liberica-vm-core-openjdk21.0.1+12-23.1.1+1-windows-amd64.zip" + C:\msys64\usr\bin\wget.exe -O %RUNNER_TEMP%\java_package.zip %download_url% + - name: Set up Liberica NIK ${{ matrix.graalvm-distribution }} for Java ${{ matrix.java-version }} (Linux) - if: runner.os == 'Linux' && matrix.java-version == 17 + if: runner.os == 'Linux' uses: actions/setup-java@v3 with: distribution: jdkfile @@ -46,21 +58,25 @@ jobs: jdkFile: ${{ runner.temp }}/java_package.tar.gz architecture: x64 - - name: Set up GraalVM ${{ matrix.graalvm-distribution }} for Java ${{ matrix.java-version }} - if: runner.os != 'Linux' && matrix.java-version == 17 - uses: graalvm/setup-graalvm@v1 + - name: Set up Liberica NIK ${{ matrix.graalvm-distribution }} for Java ${{ matrix.java-version }} (Windows) + if: runner.os == 'Windows' && matrix.java-version == 21 + uses: actions/setup-java@v3 with: + distribution: jdkfile java-version: ${{ matrix.java-version }} - distribution: ${{ matrix.graalvm-distribution }} - components: 'native-image' + jdkFile: ${{ runner.temp }}/java_package.zip + architecture: x64 + + - name: Set up a Developer Command Prompt for Microsoft Visual C++ (Windows) + if: runner.os == 'Windows' && matrix.java-version == 21 + uses: ilammy/msvc-dev-cmd@v1 - - name: Set up GraalVM ${{ matrix.graalvm-version }} for Java 11 - if: matrix.java-version == 11 + - name: Set up GraalVM ${{ matrix.graalvm-distribution }} for Java ${{ matrix.java-version }} + if: runner.os == 'Windows' && matrix.java-version == 17 uses: graalvm/setup-graalvm@v1 with: java-version: ${{ matrix.java-version }} - version: ${{ matrix.graalvm-version }} - components: 'native-image' + distribution: ${{ matrix.graalvm-distribution }} - name: Report Java version run: | @@ -83,3 +99,24 @@ jobs: .\gradlew.bat --no-daemon --info nativeCompile if: runner.os == 'Windows' + - name: Package Linux artifacts + if: runner.os == 'Linux' + uses: actions/upload-artifact@v3 + with: + name: SwingSet3 ${{ runner.os }} native image with SubstrateVM for Java ${{ matrix.java-version }} + path: | + trunk/SwingSet3/build/native/nativeCompile/ + !trunk/SwingSet3/build/native/nativeCompile/reports + !trunk/SwingSet3/build/native/nativeCompile/sources + + - name: Package Windows artifacts + if: runner.os == 'Windows' + uses: actions/upload-artifact@v3 + with: + name: SwingSet3 ${{ runner.os }} native image with SubstrateVM for Java ${{ matrix.java-version }} + path: | + trunk/SwingSet3/build/native/nativeCompile/ + !trunk/SwingSet3/build/native/nativeCompile/native-image-*.args + !trunk/SwingSet3/build/native/nativeCompile/reports + !trunk/SwingSet3/build/native/nativeCompile/sources + diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml index 8d6f93a..35c4839 100644 --- a/.github/workflows/maven-build.yml +++ b/.github/workflows/maven-build.yml @@ -12,8 +12,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest] - java-version: [11, 17] - graalvm-version: ['22.3.2'] + java-version: [17, 21] graalvm-distribution: ['graalvm-community'] fail-fast: false @@ -24,11 +23,24 @@ jobs: - name: Download Liberica NIK ${{ matrix.graalvm-distribution }} for Java ${{ matrix.java-version }} (Linux) if: runner.os == 'Linux' && matrix.java-version == 17 run: | - download_url="https://download.bell-sw.com/vm/23.0.0/bellsoft-liberica-vm-core-openjdk17.0.7+7-23.0.0+1-linux-amd64.tar.gz" + download_url="https://download.bell-sw.com/vm/23.0.2/bellsoft-liberica-vm-core-openjdk17.0.9+11-23.0.2+1-linux-amd64.tar.gz" wget -O $RUNNER_TEMP/java_package.tar.gz $download_url + - name: Download Liberica NIK ${{ matrix.graalvm-distribution }} for Java ${{ matrix.java-version }} (Linux) + if: runner.os == 'Linux' && matrix.java-version == 21 + run: | + download_url="https://download.bell-sw.com/vm/23.1.1/bellsoft-liberica-vm-core-openjdk21.0.1+12-23.1.1+1-linux-amd64.tar.gz" + wget -O $RUNNER_TEMP/java_package.tar.gz $download_url + + - name: Download Liberica NIK ${{ matrix.graalvm-distribution }} for Java ${{ matrix.java-version }} (Windows) + if: runner.os == 'Windows' && matrix.java-version == 21 + shell: cmd + run: | + set download_url="https://download.bell-sw.com/vm/23.1.1/bellsoft-liberica-vm-core-openjdk21.0.1+12-23.1.1+1-windows-amd64.zip" + C:\msys64\usr\bin\wget.exe -O %RUNNER_TEMP%\java_package.zip %download_url% + - name: Set up Liberica NIK ${{ matrix.graalvm-distribution }} for Java ${{ matrix.java-version }} (Linux) - if: runner.os == 'Linux' && matrix.java-version == 17 + if: runner.os == 'Linux' uses: actions/setup-java@v3 with: distribution: jdkfile @@ -36,21 +48,25 @@ jobs: jdkFile: ${{ runner.temp }}/java_package.tar.gz architecture: x64 - - name: Set up GraalVM ${{ matrix.graalvm-distribution }} for Java ${{ matrix.java-version }} - if: runner.os != 'Linux' && matrix.java-version == 17 - uses: graalvm/setup-graalvm@v1 + - name: Set up Liberica NIK ${{ matrix.graalvm-distribution }} for Java ${{ matrix.java-version }} (Windows) + if: runner.os == 'Windows' && matrix.java-version == 21 + uses: actions/setup-java@v3 with: + distribution: jdkfile java-version: ${{ matrix.java-version }} - distribution: ${{ matrix.graalvm-distribution }} - components: 'native-image' + jdkFile: ${{ runner.temp }}/java_package.zip + architecture: x64 + + - name: Set up a Developer Command Prompt for Microsoft Visual C++ (Windows) + if: runner.os == 'Windows' && matrix.java-version == 21 + uses: ilammy/msvc-dev-cmd@v1 - - name: Set up GraalVM ${{ matrix.graalvm-version }} for Java 11 - if: matrix.java-version == 11 + - name: Set up GraalVM ${{ matrix.graalvm-distribution }} for Java ${{ matrix.java-version }} + if: runner.os == 'Windows' && matrix.java-version == 17 uses: graalvm/setup-graalvm@v1 with: java-version: ${{ matrix.java-version }} - version: ${{ matrix.graalvm-version }} - components: 'native-image' + distribution: ${{ matrix.graalvm-distribution }} - name: Report Java version run: | @@ -73,17 +89,3 @@ jobs: .\mvnw.cmd -V -B package if: runner.os == 'Windows' - - name: Package Linux artifact - if: runner.os == 'Linux' - uses: actions/upload-artifact@v3 - with: - name: SwingSet3 ${{ runner.os }} native image with SubstrateVM for Java ${{ matrix.java-version }} - path: trunk/SwingSet3/target/native-image-linux/SwingSet3** - - - name: Package Windows artifacts - if: runner.os == 'Windows' - uses: actions/upload-artifact@v3 - with: - name: SwingSet3 ${{ runner.os }} native image with SubstrateVM for Java ${{ matrix.java-version }} - path: trunk/SwingSet3/target/native-image-windows/ - diff --git a/.gitignore b/.gitignore index 53e1105..acfe001 100644 --- a/.gitignore +++ b/.gitignore @@ -7,5 +7,6 @@ .vscode bin build +dependency-reduced-pom.xml dist target diff --git a/trunk/SwingSet3/.mvn/wrapper/maven-wrapper.properties b/trunk/SwingSet3/.mvn/wrapper/maven-wrapper.properties index 0d2696f..7975f5f 100644 --- a/trunk/SwingSet3/.mvn/wrapper/maven-wrapper.properties +++ b/trunk/SwingSet3/.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.2/apache-maven-3.9.2-bin.zip +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-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/trunk/SwingSet3/build.gradle b/trunk/SwingSet3/build.gradle index de749ef..61a19c4 100644 --- a/trunk/SwingSet3/build.gradle +++ b/trunk/SwingSet3/build.gradle @@ -1,10 +1,10 @@ plugins { id 'application' - id 'org.graalvm.buildtools.native' version '0.9.23' + id 'org.graalvm.buildtools.native' version '0.9.28' } tasks.wrapper { - gradleVersion = '8.1.1' + gradleVersion = '8.4' distributionType = Wrapper.DistributionType.ALL } @@ -16,7 +16,7 @@ ext { mainClassName = 'com.github.chirontt.graalvm.swingset3.NativeSwingSet3' splashImage = 'com/sun/swingset3/resources/images/splash.png' currentPlatform = getCurrentPlatform() - nativeImageDirName = "native-image-$currentPlatform" + nativeImageDirName = "native/nativeCompile" } //detect the OS (assuming 64-bit, on Intel/AMD hardware) @@ -123,34 +123,6 @@ task markWindowsGui(type: Exec) { commandLine 'editbin.exe', '/subsystem:windows', file("$buildDir/$nativeImageDirName/${project.name}.exe").path } -//remove unneeded .dll/.txt/.pdb 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' - //keep the shim DLLs and some - exclude name: 'awt.dll' - exclude name: 'fontmanager.dll' - exclude name: 'java.dll' - exclude name: 'jvm.dll' - } - } - } - 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") - } - } -} - javadoc { options.encoding = 'UTF-8' //turn off doclint errors/warnings output (but some warnings are still in the output) @@ -171,15 +143,14 @@ graalvmNative { verbose = true fallback = false - if (currentPlatform == 'linux') { + //if (currentPlatform == 'linux') { systemProperties = ['java.awt.headless': 'false'] - } + //} buildArgs.add('--enable-url-protocols=http,https') buildArgs.add('--report-unsupported-elements-at-runtime') buildArgs.add('--native-image-info') - 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 @@ -194,6 +165,5 @@ tasks.named("nativeCompile") { if (currentPlatform == 'windows') { finalizedBy copyFontConfigFiles, markWindowsGui } - finalizedBy removeUnneededDllFiles } diff --git a/trunk/SwingSet3/gradle/wrapper/gradle-wrapper.jar b/trunk/SwingSet3/gradle/wrapper/gradle-wrapper.jar index ccebba7..7f93135 100644 Binary files a/trunk/SwingSet3/gradle/wrapper/gradle-wrapper.jar and b/trunk/SwingSet3/gradle/wrapper/gradle-wrapper.jar differ diff --git a/trunk/SwingSet3/gradle/wrapper/gradle-wrapper.properties b/trunk/SwingSet3/gradle/wrapper/gradle-wrapper.properties index 8707e8b..8838ba9 100644 --- a/trunk/SwingSet3/gradle/wrapper/gradle-wrapper.properties +++ b/trunk/SwingSet3/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/trunk/SwingSet3/gradlew b/trunk/SwingSet3/gradlew index 79a61d4..0adc8e1 100755 --- a/trunk/SwingSet3/gradlew +++ b/trunk/SwingSet3/gradlew @@ -83,10 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -# 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"' +# 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 @@ -133,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. @@ -197,6 +198,10 @@ if "$cygwin" || "$msys" ; then done 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 diff --git a/trunk/SwingSet3/pom.xml b/trunk/SwingSet3/pom.xml index 31a8921..995648f 100644 --- a/trunk/SwingSet3/pom.xml +++ b/trunk/SwingSet3/pom.xml @@ -13,14 +13,13 @@ 11 UTF-8 - 0.9.23 + 0.9.28 com.github.chirontt.graalvm.swingset3.NativeSwingSet3 com/sun/swingset3/resources/images/splash.png - native-image-${current.platform} true true @@ -152,7 +151,6 @@ package ${skip.in.linux} - ${project.name} ${main.class} true @@ -166,9 +164,8 @@ --enable-https --report-unsupported-elements-at-runtime --native-image-info + -march=compatibility -H:+TraceNativeToolUsage - -H:TempDirectory=${project.build.directory}/tmp/${native.image.dir.name} - -H:Path=${project.build.directory}/${native.image.dir.name} @@ -192,20 +189,21 @@ package ${skip.in.windows} - ${project.name} ${main.class} true true false + + -Djava.awt.headless=false + --enable-http --enable-https --report-unsupported-elements-at-runtime --native-image-info + -march=compatibility -H:+TraceNativeToolUsage - -H:TempDirectory=${project.build.directory}/tmp/${native.image.dir.name} - -H:Path=${project.build.directory}/${native.image.dir.name} @@ -225,7 +223,7 @@ ${skip.in.windows} - ${project.build.directory}/${native.image.dir.name}/lib + ${project.build.directory}/lib ${java.home}/lib @@ -275,7 +273,7 @@ editbin.exe /subsystem:windows - ${project.build.directory}/${native.image.dir.name}/${project.name}.exe + ${project.build.directory}/${project.name}.exe @@ -286,40 +284,6 @@ - - - org.apache.maven.plugins - maven-antrun-plugin - 3.1.0 - - - remove-unneeded-dll-files - package - - run - - - - - - - - - - - - - - - - - - - - diff --git a/trunk/SwingSet3/src/com/github/chirontt/graalvm/swingset3/NativeImageUtils.java b/trunk/SwingSet3/src/com/github/chirontt/graalvm/swingset3/NativeImageUtils.java index 14e0f28..539d13c 100644 --- a/trunk/SwingSet3/src/com/github/chirontt/graalvm/swingset3/NativeImageUtils.java +++ b/trunk/SwingSet3/src/com/github/chirontt/graalvm/swingset3/NativeImageUtils.java @@ -11,8 +11,8 @@ public class NativeImageUtils { - private NativeImageUtils() { - } + private NativeImageUtils() { + } public static Optional getManifestValue(String mainClass, String attributeName) { if (mainClass == null || mainClass.isEmpty()) return Optional.empty();