@@ -309,14 +309,11 @@ runs:
309
309
# Swift Android SDK 6.0/6.1 targets API 24+
310
310
SWIFT_SDK_ANROID_API="24"
311
311
SWIFT_SDK_ID="${SWIFT_SDK_ID}-android-${SWIFT_SDK_ANROID_API}-${SWIFT_SDK_VERSION}"
312
- # resourcePath in info.json in SDK 6.0/6.1 does not contain arch
313
- SWIFT_SDK_ARCH_RESOURCE_PATTERN=""
314
312
else
315
313
# Swift Android SDK 6.2+ targets API 28+
316
314
SWIFT_SDK_ANROID_API="28"
317
315
# 6.2+ no longer includes the API in the artifactbundle name
318
316
SWIFT_SDK_ID="${SWIFT_SDK_ID}-android-${SWIFT_SDK_VERSION}"
319
- SWIFT_SDK_ARCH_RESOURCE_PATTERN="${SWIFT_SDK_ARCH}"
320
317
fi
321
318
ANDROID_SDK_URL="https://github.com/skiptools/swift-android-toolchain/releases/download/${{ steps.setup.outputs.swift-version }}/${SWIFT_SDK_ID}.artifactbundle.tar.gz"
322
319
@@ -345,9 +342,11 @@ runs:
345
342
echo "SWIFT_ARTIFACTBUNDLE_SDK_ROOT_PATH=${SWIFT_ARTIFACTBUNDLE_SDK_ROOT_PATH}" >> $GITHUB_ENV
346
343
347
344
# extract the swiftResourcesPath from the swift-sdk.json
348
- # note that we need to use the right path for the architecure;
349
- # we use a crude grep pattern for SWIFT_SDK_ARCH_RESOURCE_PATTERN
350
- SWIFT_RESOURCES_ROOT_PATH=$(cat ${SWIFT_ARTIFACTBUNDLE_ROOT}/swift-sdk.json | jq -r '.targetTriples[] | .swiftResourcesPath' | grep "${SWIFT_SDK_ARCH_RESOURCE_PATTERN}" | head -n 1)
345
+ # note that we need to match current architecture or else
346
+ # we will copy the wrong libraries
347
+ RES_ARCH_PREFIX="${{ steps.setup.outputs.android-sdk-arch }}"
348
+ JQ_RES_ARCH_MATCH=".targetTriples | to_entries[] | select(.key | startswith("${RES_ARCH_PREFIX}")) | .value.swiftResourcesPath"
349
+ SWIFT_RESOURCES_ROOT_PATH=$(cat ${SWIFT_ARTIFACTBUNDLE_ROOT}/swift-sdk.json | jq -r "${JQ_RES_ARCH_MATCH}" | head -n 1)
351
350
SWIFT_ARTIFACTBUNDLE_RESOURCES_ROOT_PATH="${SWIFT_ARTIFACTBUNDLE_ROOT}/${SWIFT_RESOURCES_ROOT_PATH}"
352
351
353
352
echo "SWIFT_ARTIFACTBUNDLE_RESOURCES_ROOT_PATH=${SWIFT_ARTIFACTBUNDLE_RESOURCES_ROOT_PATH}" >> $GITHUB_ENV
0 commit comments