Configure CARGO_TARGET_DIR to be inside of DerivedData

This commit is contained in:
Conrad Kramer 2024-03-16 10:34:59 -07:00
parent 0fe630878d
commit 4334f8c9c9
3 changed files with 13 additions and 8 deletions

View file

@ -24,6 +24,7 @@ runs:
path: | path: |
Apple/PackageCache Apple/PackageCache
Apple/SourcePackages Apple/SourcePackages
Apple/DerivedData
key: ${{ runner.os }}-${{ inputs.scheme }}-${{ hashFiles('**/Package.resolved') }} key: ${{ runner.os }}-${{ inputs.scheme }}-${{ hashFiles('**/Package.resolved') }}
restore-keys: | restore-keys: |
${{ runner.os }}-${{ inputs.scheme }}- ${{ runner.os }}-${{ inputs.scheme }}-
@ -33,17 +34,18 @@ runs:
run: | run: |
echo "${{ inputs.app-store-key }}" > AuthKey_${{ inputs.app-store-key-id }}.p8 echo "${{ inputs.app-store-key }}" > AuthKey_${{ inputs.app-store-key-id }}.p8
xcodebuild clean build-for-testing \ xcodebuild build-for-testing \
-allowProvisioningUpdates \ -allowProvisioningUpdates \
-allowProvisioningDeviceRegistration \ -allowProvisioningDeviceRegistration \
-skipPackagePluginValidation \
-skipMacroValidation \
-onlyUsePackageVersionsFromResolvedFile \
-authenticationKeyID ${{ inputs.app-store-key-id }} \ -authenticationKeyID ${{ inputs.app-store-key-id }} \
-authenticationKeyIssuerID ${{ inputs.app-store-key-issuer-id }} \ -authenticationKeyIssuerID ${{ inputs.app-store-key-issuer-id }} \
-authenticationKeyPath "${PWD}/AuthKey_${{ inputs.app-store-key-id }}.p8" \ -authenticationKeyPath "${PWD}/AuthKey_${{ inputs.app-store-key-id }}.p8" \
-onlyUsePackageVersionsFromResolvedFile \
-clonedSourcePackagesDirPath SourcePackages \ -clonedSourcePackagesDirPath SourcePackages \
-packageCachePath $PWD/PackageCache \ -packageCachePath $PWD/PackageCache \
-skipPackagePluginValidation \ -derivedDataPath $PWD/DerivedData \
-skipMacroValidation \
-scheme '${{ inputs.scheme }}' \ -scheme '${{ inputs.scheme }}' \
-destination '${{ inputs.destination }}' \ -destination '${{ inputs.destination }}' \
-resultBundlePath BuildResults.xcresult -resultBundlePath BuildResults.xcresult

View file

@ -37,6 +37,9 @@ runs:
-exportArchive \ -exportArchive \
-allowProvisioningUpdates \ -allowProvisioningUpdates \
-allowProvisioningDeviceRegistration \ -allowProvisioningDeviceRegistration \
-skipPackagePluginValidation \
-skipMacroValidation \
-onlyUsePackageVersionsFromResolvedFile \
-authenticationKeyID ${{ inputs.app-store-key-id }} \ -authenticationKeyID ${{ inputs.app-store-key-id }} \
-authenticationKeyIssuerID ${{ inputs.app-store-key-issuer-id }} \ -authenticationKeyIssuerID ${{ inputs.app-store-key-issuer-id }} \
-authenticationKeyPath "${PWD}/AuthKey_${{ inputs.app-store-key-id }}.p8" \ -authenticationKeyPath "${PWD}/AuthKey_${{ inputs.app-store-key-id }}.p8" \

View file

@ -56,10 +56,10 @@ CARGO_ARGS+=("--lib")
# Pass the configuration (Debug or Release) through to cargo # Pass the configuration (Debug or Release) through to cargo
if [[ $SWIFT_ACTIVE_COMPILATION_CONDITIONS == *DEBUG* ]]; then if [[ $SWIFT_ACTIVE_COMPILATION_CONDITIONS == *DEBUG* ]]; then
CARGO_DIR="debug" CARGO_TARGET_SUBDIR="debug"
else else
CARGO_ARGS+=("--release") CARGO_ARGS+=("--release")
CARGO_DIR="release" CARGO_TARGET_SUBDIR="release"
fi fi
if [[ -x "$(command -v rustup)" ]]; then if [[ -x "$(command -v rustup)" ]]; then
@ -70,11 +70,11 @@ fi
# Run cargo without the various environment variables set by Xcode. # Run cargo without the various environment variables set by Xcode.
# Those variables can confuse cargo and the build scripts it runs. # Those variables can confuse cargo and the build scripts it runs.
env -i PATH="$CARGO_PATH" cargo build "${CARGO_ARGS[@]}" env -i PATH="$CARGO_PATH" CARGO_TARGET_DIR="${CONFIGURATION_TEMP_DIR}/target" cargo build "${CARGO_ARGS[@]}"
mkdir -p "${BUILT_PRODUCTS_DIR}" mkdir -p "${BUILT_PRODUCTS_DIR}"
# Use `lipo` to merge the architectures together into BUILT_PRODUCTS_DIR # Use `lipo` to merge the architectures together into BUILT_PRODUCTS_DIR
/usr/bin/xcrun --sdk $PLATFORM_NAME lipo \ /usr/bin/xcrun --sdk $PLATFORM_NAME lipo \
-create $(printf "${PROJECT_DIR}/../target/%q/${CARGO_DIR}/libburrow.a " "${RUST_TARGETS[@]}") \ -create $(printf "${CONFIGURATION_TEMP_DIR}/target/%q/${CARGO_TARGET_SUBDIR}/libburrow.a " "${RUST_TARGETS[@]}") \
-output "${BUILT_PRODUCTS_DIR}/libburrow.a" -output "${BUILT_PRODUCTS_DIR}/libburrow.a"