From 456cd0e16277367457ec865211183493bf7cfc54 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Wed, 28 Jun 2023 21:57:32 +0200 Subject: [PATCH] Use JabRef's JDK21 build (#10004) Co-authored-by: Christoph --- .github/workflows/deployment-arm64.yml | 14 +++++++ .github/workflows/deployment.yml | 56 ++++++++++++++++++++++++-- .github/workflows/tests-fetchers.yml | 2 +- build.gradle | 4 ++ 4 files changed, 71 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deployment-arm64.yml b/.github/workflows/deployment-arm64.yml index 261b7cb63af..b9e6ea1336b 100644 --- a/.github/workflows/deployment-arm64.yml +++ b/.github/workflows/deployment-arm64.yml @@ -61,6 +61,20 @@ jobs: java-version: 20 distribution: 'temurin' cache: 'gradle' + - name: setup jdk JabRef-fix mac + shell: bash + run: | + mkdir ${{runner.temp}}/jdk + wget -qO- https://files.jabref.org/jdks/jdk-macos-aarch64.tar.gz | tar xz -C ${{runner.temp}}/jdk + mv ${{runner.temp}}/jdk/jdk-21.jdk ${{runner.temp}}/jdk/jdk-21 + echo "JDK21=${{runner.temp}}/jdk/jdk-21" >> "$GITHUB_ENV" + ls ${{runner.temp}}/jdk + + echo "org.gradle.java.installations.paths=${{runner.temp}}/jdk/jdk-21" >> gradle.properties + echo "org.gradle.java.installations.auto-detect=false" >> gradle.properties + cat gradle.properties + + sed -i'.bak' -e "s/JavaLanguageVersion.of(20)/JavaLanguageVersion.of(21)/" build.gradle - name: Clean up keychain if: (matrix.os == 'self-hosted') && (steps.checksecrets.outputs.secretspresent == 'YES') run: | diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index ffca8ea3323..a0d4bb506a6 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -26,6 +26,7 @@ env: OSXCERT: ${{ secrets.OSX_SIGNING_CERT }} GRADLE_OPTS: -Xmx4g -Dorg.gradle.daemon=false -Dorg.gradle.vfs.watch=false JAVA_OPTS: -Xmx4g + JDK21: "" concurrency: group: ${{ github.ref }} @@ -41,12 +42,15 @@ jobs: - os: ubuntu-latest displayName: linux archivePortable: tar -c -C build/distribution JabRef | pigz --rsyncable > build/distribution/JabRef-portable_linux.tar.gz && rm -R build/distribution/JabRef + eaJdk: https://files.jabref.org/jdks/jdk-linux-x64.tar.gz - os: windows-latest displayName: windows archivePortable: 7z a -r build/distribution/JabRef-portable_windows.zip ./build/distribution/JabRef && rm -R build/distribution/JabRef + eaJDK: https://files.jabref.org/jdks/jdk-windows-x64.zip - os: macos-latest displayName: macOS archivePortable: brew install pigz && tar -c -C build/distribution JabRef.app | pigz --rsyncable > build/distribution/JabRef-portable_macos.tar.gz && rm -R build/distribution/JabRef.app + eaJDK: https://files.jabref.org/jdks/jdk-macos-x64.tar.gz runs-on: ${{ matrix.os }} name: Create installer and portable version for ${{ matrix.displayName }} steps: @@ -78,6 +82,49 @@ jobs: java-version: 20 distribution: 'temurin' cache: 'gradle' + - name: setup jdk JabRef-fix windows + if: (matrix.os == 'windows-latest') + shell: bash + run: | + mkdir ${{runner.temp}}\jdk + curl -kLsS ${{matrix.eaJDK}} -o temp.zip && 7z x temp.zip -o"$(cygpath -u "$RUNNER_TEMP\jdk")" + echo "JDK21=${{runner.temp}}\jdk\jdk-21" >> "$GITHUB_ENV" + ls "$(cygpath -u "$RUNNER_TEMP\jdk\jdk-21")" + + echo "org.gradle.java.installations.paths=${{runner.temp}}\jdk\jdk-21" >> gradle.properties + echo "org.gradle.java.installations.auto-detect=false" >> gradle.properties + cat gradle.properties + + sed -i "s/JavaLanguageVersion.of(20)/JavaLanguageVersion.of(21)/" build.gradle + - name: setup jdk JabRef-fix ubuntu + if: (matrix.os == 'ubuntu-latest') + shell: bash + run: | + mkdir ${{runner.temp}}/jdk + wget -qO- ${{matrix.eaJDK}} | tar xz -C ${{runner.temp}}/jdk + echo "JDK21=${{runner.temp}}/jdk/jdk-21" >> "$GITHUB_ENV" + ls ${{runner.temp}}/jdk + + echo "org.gradle.java.installations.paths=${{runner.temp}}/jdk/jdk-21" >> gradle.properties + echo "org.gradle.java.installations.auto-detect=false" >> gradle.properties + cat gradle.properties + + sed -i "s/JavaLanguageVersion.of(20)/JavaLanguageVersion.of(21)/" build.gradle + - name: setup jdk JabRef-fix mac + if: (matrix.os == 'macos-latest') + shell: bash + run: | + mkdir ${{runner.temp}}/jdk + wget -qO- ${{matrix.eaJDK}} | tar xz -C ${{runner.temp}}/jdk + mv ${{runner.temp}}/jdk/jdk-21.jdk ${{runner.temp}}/jdk/jdk-21 + echo "JDK21=${{runner.temp}}/jdk/jdk-21" >> "$GITHUB_ENV" + ls ${{runner.temp}}/jdk + + echo "org.gradle.java.installations.paths=${{runner.temp}}/jdk/jdk-21" >> gradle.properties + echo "org.gradle.java.installations.auto-detect=false" >> gradle.properties + cat gradle.properties + + sed -i'.bak' -e "s/JavaLanguageVersion.of(20)/JavaLanguageVersion.of(21)/" build.gradle - name: Setup OSX key chain on OSX if: (matrix.os == 'macos-latest') && (steps.checksecrets.outputs.secretspresent == 'YES') uses: apple-actions/import-codesign-certs@v2 @@ -95,10 +142,11 @@ jobs: keychain-password: jabref - name: Build runtime image if: (matrix.os != 'macos-latest') || (steps.checksecrets.outputs.secretspresent == 'YES') - run: ./gradlew -i -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" jlinkZip + shell: bash + run: ./gradlew -Porg.gradle.java.installations.paths="${{env.JDK21}}" -i -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" jlinkZip - name: Build installer if: (matrix.os != 'macos-latest') || (steps.checksecrets.outputs.secretspresent == 'YES') - run: ./gradlew -i -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" jpackage + run: ./gradlew -Porg.gradle.java.installations.paths="${{env.JDK21}}" -i -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" jpackage shell: bash - name: Resign app image for OSX and build dmg if: (matrix.os == 'macos-latest') && (steps.checksecrets.outputs.secretspresent == 'YES') @@ -107,9 +155,9 @@ jobs: codesign --entitlements buildres/mac/jabref.entitlements --options runtime -vvv -f --sign "Developer ID Application: JabRef e.V. (6792V39SK3)" build/distribution/JabRef.app/Contents/runtime/Contents/MacOS/libjli.dylib codesign --entitlements buildres/mac/jabref.entitlements --options runtime -vvv -f --sign "Developer ID Application: JabRef e.V. (6792V39SK3)" build/distribution/JabRef.app/Contents/MacOS/JabRef codesign --entitlements buildres/mac/jabref.entitlements --options runtime -vvv -f --sign "Developer ID Application: JabRef e.V. (6792V39SK3)" build/distribution/JabRef.app - jpackage --type pkg --dest build/distribution --name JabRef --app-version "${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}" --app-image build/distribution/JabRef.app --verbose --type dmg --vendor JabRef --app-version "${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}" --file-associations buildres/mac/bibtexAssociations.properties --resource-dir buildres/mac + ${{env.JDK21}}/Contents/Home/bin/jpackage --type pkg --dest build/distribution --name JabRef --app-version "${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}" --app-image build/distribution/JabRef.app --verbose --type dmg --vendor JabRef --app-version "${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}" --file-associations buildres/mac/bibtexAssociations.properties --resource-dir buildres/mac codesign -s "Developer ID Application: JabRef e.V. (6792V39SK3)" --options runtime --entitlements buildres/mac/jabref.entitlements -vvvv --deep "build/distribution/JabRef-${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}.dmg" - jpackage --type pkg --dest build/distribution --name JabRef --mac-package-identifier JabRef --app-version "${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}" --app-image build/distribution/JabRef.app --verbose --type pkg --vendor JabRef --app-version "${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}" --file-associations buildres/mac/bibtexAssociations.properties --resource-dir buildres/mac + ${{env.JDK21}}/Contents/Home/bin/jpackage --type pkg --dest build/distribution --name JabRef --mac-package-identifier JabRef --app-version "${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}" --app-image build/distribution/JabRef.app --verbose --type pkg --vendor JabRef --app-version "${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}" --file-associations buildres/mac/bibtexAssociations.properties --resource-dir buildres/mac productsign --sign "Developer ID Installer: JabRef e.V. (6792V39SK3)" "build/distribution/JabRef-${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}.pkg" "build/distribution/JabRef-${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}-signed.pkg" - name: Package application image if: (matrix.os != 'macos-latest') || (steps.checksecrets.outputs.secretspresent == 'YES') diff --git a/.github/workflows/tests-fetchers.yml b/.github/workflows/tests-fetchers.yml index 9f7357ffe6e..98a21bdef09 100644 --- a/.github/workflows/tests-fetchers.yml +++ b/.github/workflows/tests-fetchers.yml @@ -45,7 +45,7 @@ jobs: - name: Set up JDK uses: actions/setup-java@v3 with: - java-version: 19 + java-version: 20 distribution: 'temurin' cache: 'gradle' - name: Run fetcher tests diff --git a/build.gradle b/build.gradle index 2b6a5e58528..7a75a7847fd 100644 --- a/build.gradle +++ b/build.gradle @@ -47,6 +47,10 @@ java { // Workaround needed for Eclipse, probably because of https://github.com/gradle/gradle/issues/16922 // Should be removed as soon as Gradle 7.0.1 is released ( https://github.com/gradle/gradle/issues/16922#issuecomment-828217060 ) modularity.inferModulePath.set(false) + + toolchain { + languageVersion = JavaLanguageVersion.of(20) + } } application {