From 84caf96d3fea057bbb9637469863f082b8b06124 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Fri, 31 Mar 2023 18:21:30 +0200 Subject: [PATCH] closes #2814 Zulu JDK does not create required directory structure, so use temurin + gluon jfx jmods instead --- .github/workflows/win-exe.yml | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/.github/workflows/win-exe.yml b/.github/workflows/win-exe.yml index cb754ca17..788d26a75 100644 --- a/.github/workflows/win-exe.yml +++ b/.github/workflows/win-exe.yml @@ -11,8 +11,10 @@ on: env: JAVA_VERSION: 19 - JAVA_DIST: 'zulu' + JAVA_DIST: 'temurin' JAVA_CACHE: 'maven' + JFX_JMODS_URL: 'https://download2.gluonhq.com/openjfx/19.0.2.1/openjfx-19.0.2.1_windows-x64_bin-jmods.zip' + JFX_JMODS_HASH: 'B7CF2CAD2468842B3B78D99F6C0555771499A36FA1F1EE3DD1B9A4597F1FAB86' defaults: run: @@ -39,15 +41,29 @@ jobs: java-version: ${{ env.JAVA_VERSION }} java-package: 'jdk+fx' cache: ${{ env.JAVA_CACHE }} - - name: Ensure major jfx version in pom equals in jdk - shell: pwsh + - name: Download and extract JavaFX jmods from Gluon + #In the last step we move all jmods files a dir level up because jmods are placed inside a directory in the zip run: | - $jfxPomVersion = (&mvn help:evaluate "-Dexpression=javafx.version" -q -DforceStdout) -split "\." - $jfxJdkVersion = ((Get-Content -path "${env:JAVA_HOME}/lib/javafx.properties" | Where-Object {$_ -like 'javafx.version=*' }) -replace '.*=','') -split "\." - if ($jfxPomVersion[0] -ne $jfxJdkVersion[0]) { - Write-Error "Major part of JavaFX version in pom($($jfxPomVersion[0])) does not match the version in JDK($($jfxJdkVersion[0])) " - exit 1 + curl --output jfxjmods.zip -L "${{ env.JFX_JMODS_URL }}" + if(!(Get-FileHash -Path jfxjmods.zip -Algorithm SHA256).Hash.equals("${{ env.JFX_JMODS_HASH }}")) { + exit 1; } + Expand-Archive -Path jfxjmods.zip -DestinationPath jfxjmods + Get-ChildItem -Path jfxjmods -Recurse -Filter "*.jmod" | ForEach-Object { Move-Item -Path $_ -Destination $_.Directory.Parent} + shell: pwsh + - name: Ensure major jfx version in pom and in jmods is the same + run: | + JMOD_VERSION_AMD64=$(jmod describe jfxjmods/javafx.base.jmod | head -1) + JMOD_VERSION_AMD64=${JMOD_VERSION_AMD64#*@} + JMOD_VERSION_AMD64=${JMOD_VERSION_AMD64%%.*} + POM_JFX_VERSION=$(mvn help:evaluate "-Dexpression=javafx.version" -q -DforceStdout) + POM_JFX_VERSION=${POM_JFX_VERSION#*@} + POM_JFX_VERSION=${POM_JFX_VERSION%%.*} + + if [ $POM_JFX_VERSION -ne $JMOD_VERSION_AMD64 ]; then + >&2 echo "Major JavaFX version in pom.xml (${POM_JFX_VERSION}) != amd64 jmod version (${JMOD_VERSION_AMD64})" + exit 1 + fi - name: Set version run : mvn versions:set -DnewVersion=${{ needs.get-version.outputs.semVerStr }} - name: Run maven @@ -61,7 +77,7 @@ jobs: ${JAVA_HOME}/bin/jlink --verbose --output runtime - --module-path "${JAVA_HOME}/jmods" + --module-path "jfxjmods;${JAVA_HOME}/jmods" --add-modules java.base,java.desktop,java.instrument,java.logging,java.naming,java.net.http,java.scripting,java.sql,java.xml,javafx.base,javafx.graphics,javafx.controls,javafx.fxml,jdk.unsupported,jdk.crypto.ec,jdk.accessibility,jdk.management.jfr --strip-native-commands --no-header-files