@@ -309,14 +309,11 @@ runs:
309309 # Swift Android SDK 6.0/6.1 targets API 24+
310310 SWIFT_SDK_ANROID_API="24"
311311 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=""
314312 else
315313 # Swift Android SDK 6.2+ targets API 28+
316314 SWIFT_SDK_ANROID_API="28"
317315 # 6.2+ no longer includes the API in the artifactbundle name
318316 SWIFT_SDK_ID="${SWIFT_SDK_ID}-android-${SWIFT_SDK_VERSION}"
319- SWIFT_SDK_ARCH_RESOURCE_PATTERN="${SWIFT_SDK_ARCH}"
320317 fi
321318 ANDROID_SDK_URL="https://github.com/skiptools/swift-android-toolchain/releases/download/${{ steps.setup.outputs.swift-version }}/${SWIFT_SDK_ID}.artifactbundle.tar.gz"
322319
@@ -345,9 +342,11 @@ runs:
345342 echo "SWIFT_ARTIFACTBUNDLE_SDK_ROOT_PATH=${SWIFT_ARTIFACTBUNDLE_SDK_ROOT_PATH}" >> $GITHUB_ENV
346343
347344 # 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)
351350 SWIFT_ARTIFACTBUNDLE_RESOURCES_ROOT_PATH="${SWIFT_ARTIFACTBUNDLE_ROOT}/${SWIFT_RESOURCES_ROOT_PATH}"
352351
353352 echo "SWIFT_ARTIFACTBUNDLE_RESOURCES_ROOT_PATH=${SWIFT_ARTIFACTBUNDLE_RESOURCES_ROOT_PATH}" >> $GITHUB_ENV
0 commit comments