|
1 | 1 | name: Java CI Build
|
2 | 2 | env:
|
3 |
| - junit_platform_version: '1.9.3' |
4 | 3 | JAVAFX_VERSION: '17.0.7'
|
5 | 4 | on:
|
6 | 5 | push:
|
|
71 | 70 | matrix:
|
72 | 71 | # test against latest update of each major Java version, as well as specific updates of LTS versions:
|
73 | 72 | java: [8, 11, 17, 21, 22, 23-ea]
|
74 |
| - os: [ubuntu-latest, macos-latest, windows-latest] |
| 73 | + os: [ubuntu-latest, macos-14, windows-latest] |
75 | 74 | name: Java ${{ matrix.java }} on ${{ matrix.os }}
|
76 | 75 | steps:
|
77 | 76 | - name: Checkout
|
|
93 | 92 | distribution: 'zulu'
|
94 | 93 | java-version: ${{ matrix.java }}
|
95 | 94 |
|
| 95 | + - name: Setup x64 Java (Mac) ${{ matrix.java }} |
| 96 | + if: ${{ runner.os == 'macos' && runner.arch == 'ARM64' && always() }} |
| 97 | + uses: actions/setup-java@v4 |
| 98 | + with: |
| 99 | + distribution: 'zulu' |
| 100 | + java-version: ${{ matrix.java }} |
| 101 | + architecture: x64 |
| 102 | + |
96 | 103 | - name: Install Ant
|
97 | 104 | uses: JOSM/JOSMPluginAction/actions/setup-ant@v2
|
98 | 105 |
|
@@ -155,12 +162,66 @@ jobs:
|
155 | 162 | APPLE_ID_PW: ${{ secrets.APPLE_ID_PW }}
|
156 | 163 | APPLE_ID_TEAM: ${{ secrets.APPLE_ID_TEAM }}
|
157 | 164 | run: |
|
158 |
| - if [ ! -f tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}-jmods.zip ]; then |
159 |
| - 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 |
| 165 | + function build_arch() { |
| 166 | + if [ ! -f tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}-jmods.zip ]; then |
| 167 | + 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 |
| 168 | + fi |
| 169 | + unzip tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}-jmods.zip |
| 170 | + mv javafx-jmods-${JAVAFX_VERSION}/*.jmod $JAVA_HOME/jmods/ |
| 171 | + ./native/macosx/macos-jpackage.sh ${{ needs.createrelease.outputs.josm_revision }} |
| 172 | + app/JOSM.zip app/JOSM_${1}.zip |
| 173 | + } |
| 174 | +
|
| 175 | + function merge() { |
| 176 | + if [ "$(command -v lipo)" ]; then |
| 177 | + lipo -create -output "${1}" "${2}" "${3}" |
| 178 | + elif [ "$(command -v llvm-lipo-15)" ]; then |
| 179 | + llvm-lipo-15 -create -output "${1}" "${2}" "${3}" |
| 180 | + fi |
| 181 | + } |
| 182 | +
|
| 183 | + function copy() { |
| 184 | + # Trim the root path |
| 185 | + FILE="${1#*/}" |
| 186 | + if [ ! -e "target/${FILE}" ]; then |
| 187 | + # Only make directories if we aren't looking at the root files |
| 188 | + if [[ "${FILE}" == *"/"* ]]; then mkdir -p "target/${FILE%/*}"; fi |
| 189 | + if file "${1}" | grep -q 'Mach-O' ; then |
| 190 | + merge "target/${FILE}" "x64/${FILE}" "aarch64/${FILE}" |
| 191 | + if file "${1}" | grep -q 'executable'; then |
| 192 | + chmod 755 "target/${FILE}" |
| 193 | + fi |
| 194 | + else |
| 195 | + cp -a "${1}" "target/${FILE}" |
| 196 | + fi |
| 197 | + fi |
| 198 | + } |
| 199 | +
|
| 200 | + function directory_iterate() { |
| 201 | + while IFS= read -r -d '' file |
| 202 | + do |
| 203 | + copy "${file}" & |
| 204 | + done < <(find "${1}" -type f,l -print0) |
| 205 | + wait |
| 206 | + } |
| 207 | +
|
| 208 | + if [ ${{ runner.arch }} == "ARM64" ]; then |
| 209 | + build_arch aarch64 |
| 210 | + JAVA_HOME="${JAVA_HOME_${{ matrix.java }}_x64" build_arch x64 |
| 211 | +
|
| 212 | + unzip -d app/x64 app/JOSM_x64.zip |
| 213 | + unzip -d app/aarch64 app/JOSM_aarch64.zip |
| 214 | + mkdir app/target |
| 215 | + cd app |
| 216 | + directory_iterate aarch64 |
| 217 | + directory_iterate x64 |
| 218 | + cd target |
| 219 | + zip JOSM.zip -r JOSM.app |
| 220 | + mv JOSM.zip .. |
| 221 | + else |
| 222 | + build_arch x64 |
| 223 | + mv app/JOSM_x64.zip app/JOSM.zip |
160 | 224 | fi
|
161 |
| - unzip tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}-jmods.zip |
162 |
| - mv javafx-jmods-${JAVAFX_VERSION}/*.jmod $JAVA_HOME/jmods/ |
163 |
| - ./native/macosx/macos-jpackage.sh ${{ needs.createrelease.outputs.josm_revision }} |
164 | 225 |
|
165 | 226 | - name: Setup Windows PATH
|
166 | 227 | if: ${{ runner.os == 'windows' && matrix.java != '8' && matrix.java != '11' && always() }}
|
|
0 commit comments