From e61e827eb93c71f3b0fe1e7e07b5ca4887587532 Mon Sep 17 00:00:00 2001 From: txtsd Date: Mon, 7 Feb 2022 15:48:47 +0530 Subject: [PATCH] Use Adoptium JREs --- .github/scripts/prepare_JREs.sh | 49 +++++++++++++++++++++++++++++++++ .github/workflows/build.yml | 15 +++++----- 2 files changed, 57 insertions(+), 7 deletions(-) create mode 100755 .github/scripts/prepare_JREs.sh diff --git a/.github/scripts/prepare_JREs.sh b/.github/scripts/prepare_JREs.sh new file mode 100755 index 00000000..1525fdb9 --- /dev/null +++ b/.github/scripts/prepare_JREs.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +URL_JDK8="https://api.adoptium.net/v3/binary/latest/8/ga/linux/x64/jre/hotspot/normal/eclipse" +URL_JDK17="https://api.adoptium.net/v3/binary/latest/17/ga/linux/x64/jre/hotspot/normal/eclipse" + +mkdir -p JREs +pushd JREs + +wget --content-disposition "$URL_JDK8" +wget --content-disposition "$URL_JDK17" + +for file in *; +do + mkdir temp + + # Handle OpenJDK17 archive + re='(OpenJDK17U-jre_x64_linux_hotspot_17.(.*).tar.gz)' + if [[ $file =~ $re ]]; + then + version=${BASH_REMATCH[2]} + version_edit=$(echo $version | sed -e 's/_/+/g') + dir_name=jdk-17.$version_edit-jre + echo $dir_name + mkdir jre17 + tar -xzf $file -C temp + pushd temp/$dir_name + cp -r . ../../jre17 + popd + + fi + + # Handle OpenJDK8 archive + re='(OpenJDK8U-jre_x64_linux_hotspot_8(.*).tar.gz)' + if [[ $file =~ $re ]]; + then + version=${BASH_REMATCH[2]} + version_edit=$(echo $version | sed -e 's/b/-b/g') + dir_name=jdk8$version_edit-jre + mkdir jre8 + tar -xzf $file -C temp + pushd temp/$dir_name + cp -r . ../../jre8 + popd + fi + + rm -rf temp +done + +popd diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f19da8d9..d2973b0f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,11 +43,6 @@ jobs: with: submodules: 'true' - - name: Install OpenJDK - uses: AdoptOpenJDK/install-jdk@v1 - with: - version: '8' - - name: Install OpenJDK uses: AdoptOpenJDK/install-jdk@v1 with: @@ -103,6 +98,12 @@ jobs: wget "https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-x86_64.AppImage" wget "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage" + - name: Download JREs for AppImage + if: matrix.app_image == true + shell: bash + run: | + ${{ github.workspace }}/.github/scripts/prepare_JREs.sh + - name: AppImage magic if: matrix.app_image == true shell: bash @@ -110,8 +111,8 @@ jobs: export OUTPUT="PolyMC-${{ github.sha }}-x86_64.AppImage" chmod +x linuxdeploy-*.AppImage mkdir -p ${{ env.INSTALL_DIR }}/usr/lib/jvm/java-{8,17}-openjdk - cp -r /opt/hostedtoolcache/jdk-8-hotspot/1.0.0/x64/* ${{ env.INSTALL_DIR }}/usr/lib/jvm/java-8-openjdk - cp -r /opt/hostedtoolcache/jdk-17-hotspot/1.0.0/x64/* ${{ env.INSTALL_DIR }}/usr/lib/jvm/java-17-openjdk + cp -r ${{ github.workspace }}/JREs/jre8/* ${{ env.INSTALL_DIR }}/usr/lib/jvm/java-8-openjdk + cp -r ${{ github.workspace }}/JREs/jre17/* ${{ env.INSTALL_DIR }}/usr/lib/jvm/java-17-openjdk LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${{ env.INSTALL_DIR }}/usr/lib:${{ env.INSTALL_DIR }}/usr/lib/jvm/java-8-openjdk/jre/lib/amd64/server:${{ env.INSTALL_DIR }}/usr/lib/jvm/java-8-openjdk/jre/lib/amd64:${{ env.INSTALL_DIR }}/usr/lib/jvm/java-17-openjdk/lib/server:${{ env.INSTALL_DIR }}/usr/lib/jvm/java-17-openjdk/lib" \ ./linuxdeploy-x86_64.AppImage --appdir ${{ env.INSTALL_DIR }} --output appimage --plugin qt -d ${{ env.INSTALL_DIR }}/usr/share/applications/org.polymc.polymc.desktop -i ${{ env.INSTALL_DIR }}/usr/share/icons/hicolor/scalable/apps/org.polymc.PolyMC.svg