From 9138062e1a11a573aadc8a5737204c071d62d43c Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Tue, 2 Apr 2024 06:46:21 -0600 Subject: [PATCH 01/24] Modify GH ant action to upload installer packages for testing Signed-off-by: Taylor Smock --- .github/workflows/ant-test.yml | 2 +- .github/workflows/ant.yml | 57 ++++++++++++++++++++++++++++------ 2 files changed, 49 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ant-test.yml b/.github/workflows/ant-test.yml index 9cca5c2040a..b5e077deecf 100644 --- a/.github/workflows/ant-test.yml +++ b/.github/workflows/ant-test.yml @@ -19,7 +19,7 @@ jobs: fail-fast: false matrix: # test against latest update of each major Java version, as well as specific updates of LTS versions: - java: [8, 11, 17, 21, 22-ea] + java: [8, 11, 17, 21, 22, 23-ea] os: [ubuntu-latest, macos-latest, windows-latest] name: Java ${{ matrix.java }} on ${{ matrix.os }} steps: diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml index 5b4db2f5a2c..cb8c1378cca 100644 --- a/.github/workflows/ant.yml +++ b/.github/workflows/ant.yml @@ -4,7 +4,7 @@ env: JAVAFX_VERSION: '17.0.7' on: push: - branches: [master] + branches: [master, windows-installer] defaults: run: @@ -59,6 +59,7 @@ jobs: JOSM release ${{ env.josm_release_tag }} draft: false prerelease: ${{ env.josm_prerelease }} + if: github.ref == 'refs/heads/master' build: needs: createrelease @@ -69,7 +70,7 @@ jobs: fail-fast: false matrix: # test against latest update of each major Java version, as well as specific updates of LTS versions: - java: [8, 11, 17, 21, 22-ea] + java: [8, 11, 17, 21, 22, 23-ea] os: [ubuntu-latest, macos-latest, windows-latest] name: Java ${{ matrix.java }} on ${{ matrix.os }} steps: @@ -113,18 +114,20 @@ jobs: SIGN_TSA: ${{ secrets.SIGN_TSA }} # Calls ant with -Dreleasebuild=true if we're a 'tested' build run: | - export SIGN_KEYSTORE=certificate.p12 - echo "$SIGN_CERT" | base64 --decode > $SIGN_KEYSTORE + if [ ! -z "${SIGN_CERT}" ]; then + export SIGN_KEYSTORE=certificate.p12 + echo "$SIGN_CERT" | base64 --decode > $SIGN_KEYSTORE + fi if [ "${{ needs.createrelease.outputs.josm_prerelease }}" == "true" ]; then ANT="ant" else ANT="ant -Dreleasebuild=true" fi $ANT dist - rm $SIGN_KEYSTORE + if [ ! -z "${SIGN_KEYSTORE}" ]; then rm $SIGN_KEYSTORE; fi - name: Upload jar - if: ${{ always() }} + if: ${{ always() && needs.createrelease.outputs.upload_url }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} uses: actions/upload-release-asset@v1 @@ -134,6 +137,15 @@ jobs: asset_name: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.createrelease.outputs.josm_revision }}.jar asset_content_type: application/java-archive + - name: Upload jar + if: ${{ always() && !needs.createrelease.outputs.upload_url }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: actions/upload-artifact@v4 + with: + path: dist/josm-custom.jar + name: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.createrelease.outputs.josm_revision }}.jar + - name: Build and package for macOS if: ${{ runner.os == 'macos' && matrix.java != '8' && matrix.java != '11' && always() }} env: @@ -172,7 +184,7 @@ jobs: ./native/windows/win-jpackage.sh ${{ needs.createrelease.outputs.josm_revision }} - name: Upload macOS app - if: ${{ runner.os == 'macos' && matrix.java != '8' && matrix.java != '11' && always() }} + if: ${{ runner.os == 'macos' && matrix.java != '8' && matrix.java != '11' && always() && needs.createrelease.outputs.upload_url }} uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -182,8 +194,17 @@ jobs: asset_name: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.createrelease.outputs.josm_revision }}.zip asset_content_type: application/zip + - name: Upload macOS app + if: ${{ runner.os == 'macos' && matrix.java != '8' && matrix.java != '11' && always() && !needs.createrelease.outputs.upload_url }} + uses: actions/upload-artifact@v4 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + path: app/JOSM.zip + name: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.createrelease.outputs.josm_revision }}.zip + - name: Upload Windows Installer executable - if: ${{ runner.os == 'windows' && matrix.java != '8' && matrix.java != '11' && always() }} + if: ${{ runner.os == 'windows' && matrix.java != '8' && matrix.java != '11' && always() && needs.createrelease.outputs.upload_url }} uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -193,8 +214,17 @@ jobs: asset_name: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.createrelease.outputs.josm_revision }}.exe asset_content_type: application/vnd.microsoft.portable-executable + - name: Upload Windows Installer executable + if: ${{ runner.os == 'windows' && matrix.java != '8' && matrix.java != '11' && always() && !needs.createrelease.outputs.upload_url }} + uses: actions/upload-artifact@v4 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + path: app/JOSM.exe + name: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.createrelease.outputs.josm_revision }}.exe + - name: Upload Windows Installer package - if: ${{ runner.os == 'windows' && matrix.java != '8' && matrix.java != '11' && always() }} + if: ${{ runner.os == 'windows' && matrix.java != '8' && matrix.java != '11' && always() && needs.createrelease.outputs.upload_url }} uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -203,3 +233,12 @@ jobs: asset_path: app/JOSM.msi asset_name: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.createrelease.outputs.josm_revision }}.msi asset_content_type: application/x-ole-storage + + - name: Upload Windows Installer package + if: ${{ runner.os == 'windows' && matrix.java != '8' && matrix.java != '11' && always() && !needs.createrelease.outputs.upload_url }} + uses: actions/upload-artifact@v4 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + path: app/JOSM.msi + name: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.createrelease.outputs.josm_revision }}.msi From b8dcfca5fb698d0041953eed61d9162c181eada7 Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Tue, 2 Apr 2024 08:08:35 -0600 Subject: [PATCH 02/24] Update setup-ant action to v2 due to node16 deprecation Signed-off-by: Taylor Smock --- .github/workflows/ant-test.yml | 2 +- .github/workflows/ant.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ant-test.yml b/.github/workflows/ant-test.yml index b5e077deecf..e094e36be13 100644 --- a/.github/workflows/ant-test.yml +++ b/.github/workflows/ant-test.yml @@ -43,7 +43,7 @@ jobs: java-version: ${{ matrix.java }} - name: Install Ant - uses: JOSM/JOSMPluginAction/actions/setup-ant@v1 + uses: JOSM/JOSMPluginAction/actions/setup-ant@v2 - name: Test with Ant run: | diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml index cb8c1378cca..903a345dfeb 100644 --- a/.github/workflows/ant.yml +++ b/.github/workflows/ant.yml @@ -94,7 +94,7 @@ jobs: java-version: ${{ matrix.java }} - name: Install Ant - uses: JOSM/JOSMPluginAction/actions/setup-ant@v1 + uses: JOSM/JOSMPluginAction/actions/setup-ant@v2 - name: Optimise images if: ${{ runner.os == 'macos' && always() }} From f647453a14c81d4b1c61d43cd17c5f4c781d37ff Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Wed, 3 Apr 2024 13:05:53 -0600 Subject: [PATCH 03/24] Build macOS packages for both aarch64 and x86 Signed-off-by: Taylor Smock --- .github/workflows/ant.yml | 75 +++++++++++++++++++++++++++++++++++---- 1 file changed, 68 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml index 903a345dfeb..cec79b63b42 100644 --- a/.github/workflows/ant.yml +++ b/.github/workflows/ant.yml @@ -1,6 +1,5 @@ name: Java CI Build env: - junit_platform_version: '1.9.3' JAVAFX_VERSION: '17.0.7' on: push: @@ -71,7 +70,7 @@ jobs: matrix: # test against latest update of each major Java version, as well as specific updates of LTS versions: java: [8, 11, 17, 21, 22, 23-ea] - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest, macos-14, windows-latest] name: Java ${{ matrix.java }} on ${{ matrix.os }} steps: - name: Checkout @@ -93,6 +92,14 @@ jobs: distribution: 'zulu' java-version: ${{ matrix.java }} + - name: Setup x64 Java (Mac) ${{ matrix.java }} + if: ${{ runner.os == 'macos' && runner.arch == 'ARM64' && always() }} + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: ${{ matrix.java }} + architecture: x64 + - name: Install Ant uses: JOSM/JOSMPluginAction/actions/setup-ant@v2 @@ -155,12 +162,66 @@ jobs: APPLE_ID_PW: ${{ secrets.APPLE_ID_PW }} APPLE_ID_TEAM: ${{ secrets.APPLE_ID_TEAM }} run: | - if [ ! -f tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}-jmods.zip ]; then - curl -o tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}-jmods.zip https://download2.gluonhq.com/openjfx/${JAVAFX_VERSION}/openjfx-${JAVAFX_VERSION}_osx-x64_bin-jmods.zip + function build_arch() { + if [ ! -f tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}-jmods.zip ]; then + curl -o tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}-jmods.zip https://download2.gluonhq.com/openjfx/${JAVAFX_VERSION}/openjfx-${JAVAFX_VERSION}_osx-${1}_bin-jmods.zip + fi + unzip tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}-jmods.zip + mv javafx-jmods-${JAVAFX_VERSION}/*.jmod $JAVA_HOME/jmods/ + ./native/macosx/macos-jpackage.sh ${{ needs.createrelease.outputs.josm_revision }} + app/JOSM.zip app/JOSM_${1}.zip + } + + function merge() { + if [ "$(command -v lipo)" ]; then + lipo -create -output "${1}" "${2}" "${3}" + elif [ "$(command -v llvm-lipo-15)" ]; then + llvm-lipo-15 -create -output "${1}" "${2}" "${3}" + fi + } + + function copy() { + # Trim the root path + FILE="${1#*/}" + if [ ! -e "target/${FILE}" ]; then + # Only make directories if we aren't looking at the root files + if [[ "${FILE}" == *"/"* ]]; then mkdir -p "target/${FILE%/*}"; fi + if file "${1}" | grep -q 'Mach-O' ; then + merge "target/${FILE}" "x64/${FILE}" "aarch64/${FILE}" + if file "${1}" | grep -q 'executable'; then + chmod 755 "target/${FILE}" + fi + else + cp -a "${1}" "target/${FILE}" + fi + fi + } + + function directory_iterate() { + while IFS= read -r -d '' file + do + copy "${file}" & + done < <(find "${1}" -type f,l -print0) + wait + } + + if [ ${{ runner.arch }} == "ARM64" ]; then + build_arch aarch64 + JAVA_HOME="${JAVA_HOME_${{ matrix.java }}_x64" build_arch x64 + + unzip -d app/x64 app/JOSM_x64.zip + unzip -d app/aarch64 app/JOSM_aarch64.zip + mkdir app/target + cd app + directory_iterate aarch64 + directory_iterate x64 + cd target + zip JOSM.zip -r JOSM.app + mv JOSM.zip .. + else + build_arch x64 + mv app/JOSM_x64.zip app/JOSM.zip fi - unzip tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}-jmods.zip - mv javafx-jmods-${JAVAFX_VERSION}/*.jmod $JAVA_HOME/jmods/ - ./native/macosx/macos-jpackage.sh ${{ needs.createrelease.outputs.josm_revision }} - name: Setup Windows PATH if: ${{ runner.os == 'windows' && matrix.java != '8' && matrix.java != '11' && always() }} From db869a96a7fe543609711454b6ff3a45c8bfc3a1 Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Wed, 3 Apr 2024 13:24:47 -0600 Subject: [PATCH 04/24] fixup! Build macOS packages for both aarch64 and x86 Signed-off-by: Taylor Smock --- .github/workflows/ant.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml index cec79b63b42..8887d3e1301 100644 --- a/.github/workflows/ant.yml +++ b/.github/workflows/ant.yml @@ -207,7 +207,7 @@ jobs: if [ ${{ runner.arch }} == "ARM64" ]; then build_arch aarch64 - JAVA_HOME="${JAVA_HOME_${{ matrix.java }}_x64" build_arch x64 + JAVA_HOME="${JAVA_HOME_${{ matrix.java }}_x64}" build_arch x64 unzip -d app/x64 app/JOSM_x64.zip unzip -d app/aarch64 app/JOSM_aarch64.zip From 6dc38dc35af421236c1b9aca76f738c76a94530d Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Wed, 3 Apr 2024 13:32:25 -0600 Subject: [PATCH 05/24] fixup! Build macOS packages for both aarch64 and x86 Signed-off-by: Taylor Smock --- .github/workflows/ant.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml index 8887d3e1301..ffc8aaef5dd 100644 --- a/.github/workflows/ant.yml +++ b/.github/workflows/ant.yml @@ -169,6 +169,7 @@ jobs: unzip tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}-jmods.zip mv javafx-jmods-${JAVAFX_VERSION}/*.jmod $JAVA_HOME/jmods/ ./native/macosx/macos-jpackage.sh ${{ needs.createrelease.outputs.josm_revision }} + if [ ! -f "app/JOSM.zip" ]; then ditto -c -k --zlibCompressionLevel 9 --keepParent app/JOSM.app app/JOSM.zip; fi app/JOSM.zip app/JOSM_${1}.zip } From ab3a0d858cd4d8bb754e5f54dfb5562451780a1b Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Wed, 3 Apr 2024 13:33:04 -0600 Subject: [PATCH 06/24] fixup! Build macOS packages for both aarch64 and x86 Signed-off-by: Taylor Smock --- .github/workflows/ant.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml index ffc8aaef5dd..141e262e881 100644 --- a/.github/workflows/ant.yml +++ b/.github/workflows/ant.yml @@ -217,7 +217,7 @@ jobs: directory_iterate aarch64 directory_iterate x64 cd target - zip JOSM.zip -r JOSM.app + ditto -c -k --zlibCompressionLevel 9 --keepParent JOSM.app JOSM.zip mv JOSM.zip .. else build_arch x64 From 10b6162bd65667fc9451e5cf4e1cbfb3bc182a41 Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Wed, 3 Apr 2024 14:00:47 -0600 Subject: [PATCH 07/24] fixup! Build macOS packages for both aarch64 and x86 --- .github/workflows/ant.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml index 141e262e881..dca6062816d 100644 --- a/.github/workflows/ant.yml +++ b/.github/workflows/ant.yml @@ -170,7 +170,7 @@ jobs: mv javafx-jmods-${JAVAFX_VERSION}/*.jmod $JAVA_HOME/jmods/ ./native/macosx/macos-jpackage.sh ${{ needs.createrelease.outputs.josm_revision }} if [ ! -f "app/JOSM.zip" ]; then ditto -c -k --zlibCompressionLevel 9 --keepParent app/JOSM.app app/JOSM.zip; fi - app/JOSM.zip app/JOSM_${1}.zip + mv app/JOSM.zip app/JOSM_${1}.zip } function merge() { From bbb9831ae2bd640b18390fb75a481caab94762b9 Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Wed, 3 Apr 2024 14:06:23 -0600 Subject: [PATCH 08/24] Print JAVA_HOME env variables Signed-off-by: Taylor Smock --- .github/workflows/ant.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml index dca6062816d..5da2e75d910 100644 --- a/.github/workflows/ant.yml +++ b/.github/workflows/ant.yml @@ -208,6 +208,7 @@ jobs: if [ ${{ runner.arch }} == "ARM64" ]; then build_arch aarch64 + env | grep JAVA_HOME JAVA_HOME="${JAVA_HOME_${{ matrix.java }}_x64}" build_arch x64 unzip -d app/x64 app/JOSM_x64.zip From 8bad97124e476e38cb4a7c1d3fb554309159e983 Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Wed, 3 Apr 2024 14:12:22 -0600 Subject: [PATCH 09/24] fixup! Build macOS packages for both aarch64 and x86 --- .github/workflows/ant.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml index 5da2e75d910..26ea3ad432d 100644 --- a/.github/workflows/ant.yml +++ b/.github/workflows/ant.yml @@ -208,8 +208,7 @@ jobs: if [ ${{ runner.arch }} == "ARM64" ]; then build_arch aarch64 - env | grep JAVA_HOME - JAVA_HOME="${JAVA_HOME_${{ matrix.java }}_x64}" build_arch x64 + JAVA_HOME="${JAVA_HOME_${{ matrix.java }}_X64}" build_arch x64 unzip -d app/x64 app/JOSM_x64.zip unzip -d app/aarch64 app/JOSM_aarch64.zip From db2a3c3e5708ef968c4490c630cdd64b1894fbdb Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Wed, 3 Apr 2024 14:24:42 -0600 Subject: [PATCH 10/24] fixup! Build macOS packages for both aarch64 and x86 --- .github/workflows/ant.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml index 26ea3ad432d..b691b3b7761 100644 --- a/.github/workflows/ant.yml +++ b/.github/workflows/ant.yml @@ -170,7 +170,7 @@ jobs: mv javafx-jmods-${JAVAFX_VERSION}/*.jmod $JAVA_HOME/jmods/ ./native/macosx/macos-jpackage.sh ${{ needs.createrelease.outputs.josm_revision }} if [ ! -f "app/JOSM.zip" ]; then ditto -c -k --zlibCompressionLevel 9 --keepParent app/JOSM.app app/JOSM.zip; fi - mv app/JOSM.zip app/JOSM_${1}.zip + mv app app_${1} } function merge() { @@ -210,8 +210,8 @@ jobs: build_arch aarch64 JAVA_HOME="${JAVA_HOME_${{ matrix.java }}_X64}" build_arch x64 - unzip -d app/x64 app/JOSM_x64.zip - unzip -d app/aarch64 app/JOSM_aarch64.zip + unzip -d app/x64 app_x64/JOSM.zip + unzip -d app/aarch64 app_aarch64/JOSM.zip mkdir app/target cd app directory_iterate aarch64 From 4723cf54f3ab5f17338175d2d97f14576b44b590 Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Wed, 3 Apr 2024 14:32:12 -0600 Subject: [PATCH 11/24] fixup! Build macOS packages for both aarch64 and x86 --- .github/workflows/ant.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml index b691b3b7761..cf9ec36e477 100644 --- a/.github/workflows/ant.yml +++ b/.github/workflows/ant.yml @@ -210,9 +210,9 @@ jobs: build_arch aarch64 JAVA_HOME="${JAVA_HOME_${{ matrix.java }}_X64}" build_arch x64 + mkdir -p app/target unzip -d app/x64 app_x64/JOSM.zip unzip -d app/aarch64 app_aarch64/JOSM.zip - mkdir app/target cd app directory_iterate aarch64 directory_iterate x64 From 375b7efd8d00939325f34a27a6021ea25db9f4f1 Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Wed, 3 Apr 2024 14:56:07 -0600 Subject: [PATCH 12/24] fixup! Build macOS packages for both aarch64 and x86 --- .github/workflows/ant.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml index cf9ec36e477..4c0b6ba505a 100644 --- a/.github/workflows/ant.yml +++ b/.github/workflows/ant.yml @@ -208,7 +208,7 @@ jobs: if [ ${{ runner.arch }} == "ARM64" ]; then build_arch aarch64 - JAVA_HOME="${JAVA_HOME_${{ matrix.java }}_X64}" build_arch x64 + JAVA_HOME="${JAVA_HOME_${{ matrix.java }}_X64}" PATH="${JAVA_HOME_${{ matrix.java }}_X64}:${PATH}" build_arch x64 mkdir -p app/target unzip -d app/x64 app_x64/JOSM.zip From ebeb283b899fde1545647197db8a613055c9b9d7 Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Wed, 3 Apr 2024 15:01:41 -0600 Subject: [PATCH 13/24] fixup! Build macOS packages for both aarch64 and x86 --- .github/workflows/ant.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml index 4c0b6ba505a..7c975abe2c6 100644 --- a/.github/workflows/ant.yml +++ b/.github/workflows/ant.yml @@ -208,7 +208,7 @@ jobs: if [ ${{ runner.arch }} == "ARM64" ]; then build_arch aarch64 - JAVA_HOME="${JAVA_HOME_${{ matrix.java }}_X64}" PATH="${JAVA_HOME_${{ matrix.java }}_X64}:${PATH}" build_arch x64 + JAVA_HOME="${JAVA_HOME_${{ matrix.java }}_X64}" PATH="${JAVA_HOME_${{ matrix.java }}_X64}/bin:${PATH}" build_arch x64 mkdir -p app/target unzip -d app/x64 app_x64/JOSM.zip From 3e1d7cb8c58e014f82bdd1051f84bbbe4a4a5f2f Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Wed, 3 Apr 2024 15:12:33 -0600 Subject: [PATCH 14/24] fixup! Build macOS packages for both aarch64 and x86 --- .github/workflows/ant.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml index 7c975abe2c6..f3f05337d09 100644 --- a/.github/workflows/ant.yml +++ b/.github/workflows/ant.yml @@ -265,6 +265,24 @@ jobs: path: app/JOSM.zip name: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.createrelease.outputs.josm_revision }}.zip + - name: Upload macOS app (x64) + if: ${{ runner.os == 'macos' && matrix.java != '8' && matrix.java != '11' && always() && runner.arch == 'ARM64' && !needs.createrelease.outputs.upload_url }} + uses: actions/upload-artifact@v4 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + path: app_x64/JOSM.zip + name: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.createrelease.outputs.josm_revision }}-x64.zip + + - name: Upload macOS app (aarch64) + if: ${{ runner.os == 'macos' && matrix.java != '8' && matrix.java != '11' && always() && runner.arch == 'ARM64' && !needs.createrelease.outputs.upload_url }} + uses: actions/upload-artifact@v4 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + path: app_aarch64/JOSM.zip + name: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.createrelease.outputs.josm_revision }}-aarch64.zip + - name: Upload Windows Installer executable if: ${{ runner.os == 'windows' && matrix.java != '8' && matrix.java != '11' && always() && needs.createrelease.outputs.upload_url }} uses: actions/upload-release-asset@v1 From 07d1d7e2caca595da8d18af0b235011eaabcaae2 Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Wed, 3 Apr 2024 15:27:36 -0600 Subject: [PATCH 15/24] fixup! Build macOS packages for both aarch64 and x86 --- .github/workflows/ant.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml index f3f05337d09..c4c79b6e357 100644 --- a/.github/workflows/ant.yml +++ b/.github/workflows/ant.yml @@ -207,7 +207,7 @@ jobs: } if [ ${{ runner.arch }} == "ARM64" ]; then - build_arch aarch64 + JAVA_HOME="${JAVA_HOME_${{ matrix.java }}_ARM64}" build_arch aarch64 JAVA_HOME="${JAVA_HOME_${{ matrix.java }}_X64}" PATH="${JAVA_HOME_${{ matrix.java }}_X64}/bin:${PATH}" build_arch x64 mkdir -p app/target From 42790819928673d8b8fe3ca5f7dc7086ad256da9 Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Wed, 3 Apr 2024 15:45:34 -0600 Subject: [PATCH 16/24] fixup! Build macOS packages for both aarch64 and x86 --- .github/workflows/ant.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml index c4c79b6e357..0b79487ad91 100644 --- a/.github/workflows/ant.yml +++ b/.github/workflows/ant.yml @@ -162,6 +162,7 @@ jobs: APPLE_ID_PW: ${{ secrets.APPLE_ID_PW }} APPLE_ID_TEAM: ${{ secrets.APPLE_ID_TEAM }} run: | + set -ex function build_arch() { if [ ! -f tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}-jmods.zip ]; then curl -o tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}-jmods.zip https://download2.gluonhq.com/openjfx/${JAVAFX_VERSION}/openjfx-${JAVAFX_VERSION}_osx-${1}_bin-jmods.zip From e5fdbe9749c0b25f4283ea59158da3e70313c71b Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Wed, 3 Apr 2024 15:51:51 -0600 Subject: [PATCH 17/24] fixup! Build macOS packages for both aarch64 and x86 --- .github/workflows/ant.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml index 0b79487ad91..0dbbcfda5bb 100644 --- a/.github/workflows/ant.yml +++ b/.github/workflows/ant.yml @@ -163,6 +163,7 @@ jobs: APPLE_ID_TEAM: ${{ secrets.APPLE_ID_TEAM }} run: | set -ex + env | grep JAVA_HOME function build_arch() { if [ ! -f tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}-jmods.zip ]; then curl -o tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}-jmods.zip https://download2.gluonhq.com/openjfx/${JAVAFX_VERSION}/openjfx-${JAVAFX_VERSION}_osx-${1}_bin-jmods.zip @@ -208,7 +209,7 @@ jobs: } if [ ${{ runner.arch }} == "ARM64" ]; then - JAVA_HOME="${JAVA_HOME_${{ matrix.java }}_ARM64}" build_arch aarch64 + JAVA_HOME="${JAVA_HOME_${{ matrix.java }}_ARM64}" PATH="${JAVA_HOME_${{ matrix.java }}_ARM64}/bin:${PATH}" build_arch aarch64 JAVA_HOME="${JAVA_HOME_${{ matrix.java }}_X64}" PATH="${JAVA_HOME_${{ matrix.java }}_X64}/bin:${PATH}" build_arch x64 mkdir -p app/target From b7e5b343ff9e7bca5068fc97e70245dd1a36c0d1 Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Wed, 3 Apr 2024 16:15:13 -0600 Subject: [PATCH 18/24] fixup! Build macOS packages for both aarch64 and x86 --- .github/workflows/ant.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml index 0dbbcfda5bb..8c9c1504f94 100644 --- a/.github/workflows/ant.yml +++ b/.github/workflows/ant.yml @@ -162,13 +162,11 @@ jobs: APPLE_ID_PW: ${{ secrets.APPLE_ID_PW }} APPLE_ID_TEAM: ${{ secrets.APPLE_ID_TEAM }} run: | - set -ex - env | grep JAVA_HOME function build_arch() { - if [ ! -f tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}-jmods.zip ]; then - curl -o tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}-jmods.zip https://download2.gluonhq.com/openjfx/${JAVAFX_VERSION}/openjfx-${JAVAFX_VERSION}_osx-${1}_bin-jmods.zip + if [ ! -f tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}_${{ runner.arch }}-jmods.zip ]; then + curl -o tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}_${{ runner.arch }}-jmods.zip https://download2.gluonhq.com/openjfx/${JAVAFX_VERSION}/openjfx-${JAVAFX_VERSION}_osx-${1}_bin-jmods.zip fi - unzip tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}-jmods.zip + unzip tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}_${{ runner.arch }}-jmods.zip mv javafx-jmods-${JAVAFX_VERSION}/*.jmod $JAVA_HOME/jmods/ ./native/macosx/macos-jpackage.sh ${{ needs.createrelease.outputs.josm_revision }} if [ ! -f "app/JOSM.zip" ]; then ditto -c -k --zlibCompressionLevel 9 --keepParent app/JOSM.app app/JOSM.zip; fi From d4a4c15ecb576187693b8be0b0f3c0420162af72 Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Wed, 3 Apr 2024 16:22:51 -0600 Subject: [PATCH 19/24] fixup! Build macOS packages for both aarch64 and x86 --- .github/workflows/ant.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml index 8c9c1504f94..d985762cac4 100644 --- a/.github/workflows/ant.yml +++ b/.github/workflows/ant.yml @@ -163,10 +163,10 @@ jobs: APPLE_ID_TEAM: ${{ secrets.APPLE_ID_TEAM }} run: | function build_arch() { - if [ ! -f tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}_${{ runner.arch }}-jmods.zip ]; then - curl -o tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}_${{ runner.arch }}-jmods.zip https://download2.gluonhq.com/openjfx/${JAVAFX_VERSION}/openjfx-${JAVAFX_VERSION}_osx-${1}_bin-jmods.zip + if [ ! -f tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}_${2}-jmods.zip ]; then + curl -o tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}_${2}-jmods.zip https://download2.gluonhq.com/openjfx/${JAVAFX_VERSION}/openjfx-${JAVAFX_VERSION}_osx-${1}_bin-jmods.zip fi - unzip tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}_${{ runner.arch }}-jmods.zip + unzip tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}_${2}-jmods.zip mv javafx-jmods-${JAVAFX_VERSION}/*.jmod $JAVA_HOME/jmods/ ./native/macosx/macos-jpackage.sh ${{ needs.createrelease.outputs.josm_revision }} if [ ! -f "app/JOSM.zip" ]; then ditto -c -k --zlibCompressionLevel 9 --keepParent app/JOSM.app app/JOSM.zip; fi @@ -207,8 +207,8 @@ jobs: } if [ ${{ runner.arch }} == "ARM64" ]; then - JAVA_HOME="${JAVA_HOME_${{ matrix.java }}_ARM64}" PATH="${JAVA_HOME_${{ matrix.java }}_ARM64}/bin:${PATH}" build_arch aarch64 - JAVA_HOME="${JAVA_HOME_${{ matrix.java }}_X64}" PATH="${JAVA_HOME_${{ matrix.java }}_X64}/bin:${PATH}" build_arch x64 + JAVA_HOME="${JAVA_HOME_${{ matrix.java }}_ARM64}" PATH="${JAVA_HOME_${{ matrix.java }}_ARM64}/bin:${PATH}" build_arch aarch64 ARM64 + JAVA_HOME="${JAVA_HOME_${{ matrix.java }}_X64}" PATH="${JAVA_HOME_${{ matrix.java }}_X64}/bin:${PATH}" build_arch x64 X64 mkdir -p app/target unzip -d app/x64 app_x64/JOSM.zip From 1e6ae82a8814a987095cb3a8f85651032f239fcf Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Thu, 4 Apr 2024 07:48:40 -0600 Subject: [PATCH 20/24] Move multiarch build to jpackage script Signed-off-by: Taylor Smock --- .github/workflows/ant.yml | 61 ++------------ native/macosx/macos-jpackage.sh | 141 ++++++++++++++++++++++---------- 2 files changed, 106 insertions(+), 96 deletions(-) diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml index d985762cac4..97af03b3e5a 100644 --- a/.github/workflows/ant.yml +++ b/.github/workflows/ant.yml @@ -162,66 +162,21 @@ jobs: APPLE_ID_PW: ${{ secrets.APPLE_ID_PW }} APPLE_ID_TEAM: ${{ secrets.APPLE_ID_TEAM }} run: | - function build_arch() { + function setup_openjfx() { if [ ! -f tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}_${2}-jmods.zip ]; then curl -o tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}_${2}-jmods.zip https://download2.gluonhq.com/openjfx/${JAVAFX_VERSION}/openjfx-${JAVAFX_VERSION}_osx-${1}_bin-jmods.zip fi unzip tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}_${2}-jmods.zip mv javafx-jmods-${JAVAFX_VERSION}/*.jmod $JAVA_HOME/jmods/ - ./native/macosx/macos-jpackage.sh ${{ needs.createrelease.outputs.josm_revision }} - if [ ! -f "app/JOSM.zip" ]; then ditto -c -k --zlibCompressionLevel 9 --keepParent app/JOSM.app app/JOSM.zip; fi - mv app app_${1} - } - - function merge() { - if [ "$(command -v lipo)" ]; then - lipo -create -output "${1}" "${2}" "${3}" - elif [ "$(command -v llvm-lipo-15)" ]; then - llvm-lipo-15 -create -output "${1}" "${2}" "${3}" - fi - } - - function copy() { - # Trim the root path - FILE="${1#*/}" - if [ ! -e "target/${FILE}" ]; then - # Only make directories if we aren't looking at the root files - if [[ "${FILE}" == *"/"* ]]; then mkdir -p "target/${FILE%/*}"; fi - if file "${1}" | grep -q 'Mach-O' ; then - merge "target/${FILE}" "x64/${FILE}" "aarch64/${FILE}" - if file "${1}" | grep -q 'executable'; then - chmod 755 "target/${FILE}" - fi - else - cp -a "${1}" "target/${FILE}" - fi - fi - } - - function directory_iterate() { - while IFS= read -r -d '' file - do - copy "${file}" & - done < <(find "${1}" -type f,l -print0) - wait } if [ ${{ runner.arch }} == "ARM64" ]; then - JAVA_HOME="${JAVA_HOME_${{ matrix.java }}_ARM64}" PATH="${JAVA_HOME_${{ matrix.java }}_ARM64}/bin:${PATH}" build_arch aarch64 ARM64 - JAVA_HOME="${JAVA_HOME_${{ matrix.java }}_X64}" PATH="${JAVA_HOME_${{ matrix.java }}_X64}/bin:${PATH}" build_arch x64 X64 - - mkdir -p app/target - unzip -d app/x64 app_x64/JOSM.zip - unzip -d app/aarch64 app_aarch64/JOSM.zip - cd app - directory_iterate aarch64 - directory_iterate x64 - cd target - ditto -c -k --zlibCompressionLevel 9 --keepParent JOSM.app JOSM.zip - mv JOSM.zip .. + JAVA_HOME="${JAVA_HOME_${{ matrix.java }}_ARM64}" PATH="${JAVA_HOME_${{ matrix.java }}_ARM64}/bin:${PATH}" setup_openjfx aarch64 ARM64 + JAVA_HOME="${JAVA_HOME_${{ matrix.java }}_X64}" PATH="${JAVA_HOME_${{ matrix.java }}_X64}/bin:${PATH}" setup_openjfx x64 X64 + JAVA_HOME="${JAVA_HOME_${{ matrix.java }}_ARM64}" ./native/macosx/macos-jpackage.sh ${{ needs.createrelease.outputs.josm_revision }} "${JAVA_HOME_${{ matrix.java }}_X64}" else - build_arch x64 - mv app/JOSM_x64.zip app/JOSM.zip + setup_openjfx x64 X64 + ./native/macosx/macos-jpackage.sh ${{ needs.createrelease.outputs.josm_revision }} fi - name: Setup Windows PATH @@ -271,7 +226,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - path: app_x64/JOSM.zip + path: app/JOSM_${{ matrix.java }}_x86_64.zip name: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.createrelease.outputs.josm_revision }}-x64.zip - name: Upload macOS app (aarch64) @@ -280,7 +235,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - path: app_aarch64/JOSM.zip + path: app/JOSM_${{ matrix.java }}_arm64.zip name: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.createrelease.outputs.josm_revision }}-aarch64.zip - name: Upload Windows Installer executable diff --git a/native/macosx/macos-jpackage.sh b/native/macosx/macos-jpackage.sh index dbbb948bae6..3c97b1a19b8 100755 --- a/native/macosx/macos-jpackage.sh +++ b/native/macosx/macos-jpackage.sh @@ -15,7 +15,7 @@ IMPORT_AND_UNLOCK_KEYCHAIN=${IMPORT_AND_UNLOCK_KEYCHAIN:-1} if [ -z "${1-}" ] then - echo "Usage: $0 josm_revision" + echo "Usage: $0 josm_revision [other_arch_jdk]" exit 1 fi @@ -52,46 +52,101 @@ fi set -u -echo "Building and signing app" -# We specifically need the options to not be quoted -- we _want_ the word splitting. -# shellcheck disable=SC2086 -jpackage $JPACKAGEOPTIONS -n "JOSM" --input dist --main-jar josm-custom.jar \ - --main-class org.openstreetmap.josm.gui.MainApplication \ - --icon ./native/macosx/JOSM.icns --type app-image --dest app \ - --java-options "--add-modules java.scripting,java.sql,javafx.controls,javafx.media,javafx.swing,javafx.web" \ - --java-options "--add-exports=java.base/sun.security.action=ALL-UNNAMED" \ - --java-options "--add-exports=java.desktop/com.apple.eawt=ALL-UNNAMED" \ - --java-options "--add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED" \ - --java-options "--add-exports=java.desktop/com.sun.imageio.spi=ALL-UNNAMED" \ - --java-options "--add-opens=java.base/java.lang=ALL-UNNAMED" \ - --java-options "--add-opens=java.base/java.nio=ALL-UNNAMED" \ - --java-options "--add-opens=java.base/jdk.internal.loader=ALL-UNNAMED" \ - --java-options "--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED" \ - --java-options "--add-opens=java.desktop/javax.imageio.spi=ALL-UNNAMED" \ - --java-options "--add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED" \ - --java-options "--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED" \ - --app-version "$1" \ - --copyright "JOSM, and all its integral parts, are released under the GNU General Public License v2 or later" \ - --vendor "JOSM" \ - --mac-package-identifier de.openstreetmap.josm \ - --mac-package-signing-prefix de.openstreetmap.josm \ - --file-associations native/file-associations/bz2.properties \ - --file-associations native/file-associations/geojson.properties \ - --file-associations native/file-associations/gpx.properties \ - --file-associations native/file-associations/gz.properties \ - --file-associations native/file-associations/jos.properties \ - --file-associations native/file-associations/joz.properties \ - --file-associations native/file-associations/osm.properties \ - --file-associations native/file-associations/xz.properties \ - --file-associations native/file-associations/zip.properties \ - --add-modules java.compiler,java.base,java.datatransfer,java.desktop,java.logging,java.management,java.naming,java.net.http,java.prefs,java.rmi,java.scripting,java.sql,java.transaction.xa,java.xml,jdk.crypto.ec,jdk.jfr,jdk.jsobject,jdk.unsupported,jdk.unsupported.desktop,jdk.xml.dom,javafx.controls,javafx.media,javafx.swing,javafx.web - -echo "Building done." - -if $SIGNAPP; then - echo "Preparing for notarization" - ditto -c -k --zlibCompressionLevel 9 --keepParent app/JOSM.app app/JOSM.zip - - echo "Uploading to Apple" - xcrun notarytool submit --apple-id "$APPLE_ID" --password "$APPLE_ID_PW" --team-id "$APPLE_ID_TEAM" --wait app/JOSM.zip +function do_jpackage() { + echo "Building app (${JAVA_HOME})" + # We specifically need the options to not be quoted -- we _want_ the word splitting. + # shellcheck disable=SC2086 + "${JAVA_HOME}/bin/jpackage" $JPACKAGEOPTIONS -n "JOSM" --input dist --main-jar josm-custom.jar \ + --main-class org.openstreetmap.josm.gui.MainApplication \ + --icon ./native/macosx/JOSM.icns --type app-image --dest app \ + --java-options "--add-modules java.scripting,java.sql,javafx.controls,javafx.media,javafx.swing,javafx.web" \ + --java-options "--add-exports=java.base/sun.security.action=ALL-UNNAMED" \ + --java-options "--add-exports=java.desktop/com.apple.eawt=ALL-UNNAMED" \ + --java-options "--add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED" \ + --java-options "--add-exports=java.desktop/com.sun.imageio.spi=ALL-UNNAMED" \ + --java-options "--add-opens=java.base/java.lang=ALL-UNNAMED" \ + --java-options "--add-opens=java.base/java.nio=ALL-UNNAMED" \ + --java-options "--add-opens=java.base/jdk.internal.loader=ALL-UNNAMED" \ + --java-options "--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED" \ + --java-options "--add-opens=java.desktop/javax.imageio.spi=ALL-UNNAMED" \ + --java-options "--add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED" \ + --java-options "--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED" \ + --app-version "$1" \ + --copyright "JOSM, and all its integral parts, are released under the GNU General Public License v2 or later" \ + --vendor "JOSM" \ + --mac-package-identifier de.openstreetmap.josm \ + --mac-package-signing-prefix de.openstreetmap.josm \ + --file-associations native/file-associations/bz2.properties \ + --file-associations native/file-associations/geojson.properties \ + --file-associations native/file-associations/gpx.properties \ + --file-associations native/file-associations/gz.properties \ + --file-associations native/file-associations/jos.properties \ + --file-associations native/file-associations/joz.properties \ + --file-associations native/file-associations/osm.properties \ + --file-associations native/file-associations/xz.properties \ + --file-associations native/file-associations/zip.properties \ + --add-modules java.compiler,java.base,java.datatransfer,java.desktop,java.logging,java.management,java.naming,java.net.http,java.prefs,java.rmi,java.scripting,java.sql,java.transaction.xa,java.xml,jdk.crypto.ec,jdk.jfr,jdk.jsobject,jdk.unsupported,jdk.unsupported.desktop,jdk.xml.dom,javafx.controls,javafx.media,javafx.swing,javafx.web + echo "Building done (${JAVA_HOME})." +} +function do_signapp() { + echo "Compressing app (${1})" + ditto -c -k --zlibCompressionLevel 9 --keepParent "app/${1}.app" "app/${1}.zip" + if $SIGNAPP; then + echo "Signing app (${1})" + echo "Preparing for notarization" + echo "Uploading to Apple" + xcrun notarytool submit --apple-id "$APPLE_ID" --password "$APPLE_ID_PW" --team-id "$APPLE_ID_TEAM" --wait "app/${1}.zip" + fi +} + +function merge() { + if [ "$(command -v lipo)" ]; then + lipo -create -output "${1}" "${2}" "${3}" + elif [ "$(command -v llvm-lipo-15)" ]; then + llvm-lipo-15 -create -output "${1}" "${2}" "${3}" + fi +} + +function copy() { + # Trim the root path + FILE="${1#*/}" + if [ ! -e "target/${FILE}" ]; then + # Only make directories if we aren't looking at the root files + if [[ "${FILE}" == *"/"* ]]; then mkdir -p "target/${FILE%/*}"; fi + if file "${1}" | grep -q 'Mach-O' ; then + merge "${2}/${FILE}" "${3}/${FILE}" "${4}/${FILE}" + if file "${1}" | grep -q 'executable'; then + chmod 755 "target/${FILE}" + fi + else + cp -a "${1}" "target/${FILE}" + fi + fi +} + +function directory_iterate() { + while IFS= read -r -d '' file + do + copy "${file}" "${2}" "${3}" "${4}" & + done < <(find "${1}" -type f,l -print0) + wait +} + +do_jpackage "${1}" +if [ -n "${2}" ]; then + function get_name() { + echo "$("${JAVA_HOME}/bin/java" --version | head -n1 | awk '{print $2}' | awk -F'.' '{print $1}')_$(file "${JAVA_HOME}/bin/java" | awk -F' executable ' '{print $2}')" + } + first="$(get_name)" + JAVA_HOME="${2}" second="$(get_name)" + mv app/JOSM.app "app/JOSM_${first}.app" + JAVA_HOME="${2}" do_jpackage "${1}" + mv app/JOSM.app "app/JOSM_${second}.app" + (cd app + directory_iterate "JOSM_${first}.app" "JOSM.app" "JOSM_${first}.app" "JOSM_${second}.app" + directory_iterate "JOSM_${second}.app" "JOSM.app" "JOSM_${first}.app" "JOSM_${second}.app" + ) + do_signapp "JOSM_${first}" + do_signapp "JOSM_${second}" fi +do_signapp JOSM From 3e5bb6c72c04f98dc1d44756a8cb5c457c7c49bc Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Thu, 4 Apr 2024 08:04:07 -0600 Subject: [PATCH 21/24] fixup! Move multiarch build to jpackage script Signed-off-by: Taylor Smock --- native/macosx/macos-jpackage.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/native/macosx/macos-jpackage.sh b/native/macosx/macos-jpackage.sh index 3c97b1a19b8..c06a64947cb 100755 --- a/native/macosx/macos-jpackage.sh +++ b/native/macosx/macos-jpackage.sh @@ -142,6 +142,7 @@ if [ -n "${2}" ]; then mv app/JOSM.app "app/JOSM_${first}.app" JAVA_HOME="${2}" do_jpackage "${1}" mv app/JOSM.app "app/JOSM_${second}.app" + mkdir app/JOSM.app (cd app directory_iterate "JOSM_${first}.app" "JOSM.app" "JOSM_${first}.app" "JOSM_${second}.app" directory_iterate "JOSM_${second}.app" "JOSM.app" "JOSM_${first}.app" "JOSM_${second}.app" From 8f62ddd5670484147e09d152e943d98963434f8b Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Thu, 4 Apr 2024 08:14:18 -0600 Subject: [PATCH 22/24] fixup! Move multiarch build to jpackage script Signed-off-by: Taylor Smock --- native/macosx/macos-jpackage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/native/macosx/macos-jpackage.sh b/native/macosx/macos-jpackage.sh index c06a64947cb..20124ecf918 100755 --- a/native/macosx/macos-jpackage.sh +++ b/native/macosx/macos-jpackage.sh @@ -110,9 +110,9 @@ function merge() { function copy() { # Trim the root path FILE="${1#*/}" - if [ ! -e "target/${FILE}" ]; then + if [ ! -e "${2}/${FILE}" ]; then # Only make directories if we aren't looking at the root files - if [[ "${FILE}" == *"/"* ]]; then mkdir -p "target/${FILE%/*}"; fi + if [[ "${FILE}" == *"/"* ]]; then mkdir -p "${2}/${FILE%/*}"; fi if file "${1}" | grep -q 'Mach-O' ; then merge "${2}/${FILE}" "${3}/${FILE}" "${4}/${FILE}" if file "${1}" | grep -q 'executable'; then From a1437c97317c568aefe78a515102af62af604182 Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Thu, 4 Apr 2024 08:20:31 -0600 Subject: [PATCH 23/24] fixup! Move multiarch build to jpackage script Signed-off-by: Taylor Smock --- native/macosx/macos-jpackage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/native/macosx/macos-jpackage.sh b/native/macosx/macos-jpackage.sh index 20124ecf918..a058cfcced7 100755 --- a/native/macosx/macos-jpackage.sh +++ b/native/macosx/macos-jpackage.sh @@ -116,10 +116,10 @@ function copy() { if file "${1}" | grep -q 'Mach-O' ; then merge "${2}/${FILE}" "${3}/${FILE}" "${4}/${FILE}" if file "${1}" | grep -q 'executable'; then - chmod 755 "target/${FILE}" + chmod 755 "${2}/${FILE}" fi else - cp -a "${1}" "target/${FILE}" + cp -a "${1}" "${2}/${FILE}" fi fi } From de06a6c89377aadb59303b5b27904dc267d10ef7 Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Thu, 4 Apr 2024 08:51:37 -0600 Subject: [PATCH 24/24] Drop 23-ea due to missing Mac build and use macos-latest instead of macos-14 Signed-off-by: Taylor Smock --- .github/workflows/ant-test.yml | 2 +- .github/workflows/ant.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ant-test.yml b/.github/workflows/ant-test.yml index e094e36be13..9b0d016fbce 100644 --- a/.github/workflows/ant-test.yml +++ b/.github/workflows/ant-test.yml @@ -19,7 +19,7 @@ jobs: fail-fast: false matrix: # test against latest update of each major Java version, as well as specific updates of LTS versions: - java: [8, 11, 17, 21, 22, 23-ea] + java: [8, 11, 17, 21, 22] os: [ubuntu-latest, macos-latest, windows-latest] name: Java ${{ matrix.java }} on ${{ matrix.os }} steps: diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml index 97af03b3e5a..e5ebc81658d 100644 --- a/.github/workflows/ant.yml +++ b/.github/workflows/ant.yml @@ -69,8 +69,8 @@ jobs: fail-fast: false matrix: # test against latest update of each major Java version, as well as specific updates of LTS versions: - java: [8, 11, 17, 21, 22, 23-ea] - os: [ubuntu-latest, macos-14, windows-latest] + java: [8, 11, 17, 21, 22] + os: [ubuntu-latest, macos-latest, windows-latest] name: Java ${{ matrix.java }} on ${{ matrix.os }} steps: - name: Checkout