Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use JabRef's JDK21 build #10004

Merged
merged 13 commits into from
Jun 28, 2023
14 changes: 14 additions & 0 deletions .github/workflows/deployment-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
56 changes: 52 additions & 4 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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')
Expand All @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests-fetchers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That needs to be 21

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought,, 20 is the latest release version (21 is in ramp down, isn't it? - https://openjdk.org/projects/jdk/21/). That version is used generally (tests, ...). Exception; When using jlink, 21 is used. I thought, it is a good idea.to modify one workflow only instead of changing all (JDK custom build download etc)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I change this with sed in deployment.yml

}
}

application {
Expand Down