Something went wrong. Try again.
An auto tiler for macOS
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113#!/bin/bashset -euo pipefailcd "$(dirname "$0")/../.."work=$(mktemp -d "${TMPDIR:-/tmp}/parcel-tool-cache.XXXXXX")work=$(CDPATH='' cd "$work" && pwd -P)trap 'rm -rf "$work"' EXITmkdir -p "$work/project/Scripts" "$work/project/Sources/ParcelDev" "$work/project/Sources/parcel-dev" "$work/project/sdk" "$work/bin"cp Scripts/parcel-dev.sh Scripts/swift-build.sh "$work/project/Scripts/"printf 'fixture package\n' > "$work/project/Package.swift"printf 'fixture source\n' > "$work/project/Sources/ParcelDev/Value.swift"cat > "$work/bin/swift" <<'MOCK'#!/bin/bashset -euo pipefailif [[ $1 == --version ]]; then printf '%s\n' "fixture Swift ${TEST_SWIFT_VERSION:-1}"; exit 0; fiprintf '%s\n' "$*" >> "$BUILD_LOG"[[ $1 == build && $2 == --scratch-path && $3 == "$PROJECT/.build/parcel-dev" ]][[ $4 == -c && $5 == release && $6 == --product && $7 == parcel-dev ]]if [[ ${BUILD_FAIL:-0} != 0 ]]; then exit "$BUILD_FAIL"; fimkdir -p "$3/release"printf '#!/bin/sh\nprintf "native fixture: %%s\\n" "$*"\n' > "$3/release/parcel-dev"chmod +x "$3/release/parcel-dev"MOCKcat > "$work/bin/xcrun" <<'MOCK'#!/bin/shset -eucase "$*" in '--find swift') printf '%s\n' "$PROJECT/compiler/swift" ;; '--show-sdk-path') printf '%s\n' "$PROJECT/sdk" ;; *) exit 2 ;;esacMOCKcat > "$work/bin/xcodebuild" <<'MOCK'#!/bin/shset -euprintf 'Xcode fixture\n'exit "${TEST_XCODE_STATUS:-0}"MOCKchmod +x "$work/bin/swift" "$work/bin/xcrun" "$work/bin/xcodebuild"export PATH="$work/bin:$PATH" BUILD_LOG="$work/builds" PROJECT="$work/project"unset PARCEL_DEV_BINARYbinary=$PROJECT/.build/parcel-dev/release/parcel-devactual=$("$PROJECT/Scripts/parcel-dev.sh" --path)[[ $actual == "$binary" ]][[ $(wc -l < "$BUILD_LOG") -eq 1 ]][[ $("$PROJECT/Scripts/parcel-dev.sh" probe) == 'native fixture: probe' ]][[ $(wc -l < "$BUILD_LOG") -eq 1 ]]touch -t 203001010000 "$PROJECT/Package.swift"[[ $("$PROJECT/Scripts/parcel-dev.sh" --path) == "$binary" ]][[ $(wc -l < "$BUILD_LOG") -eq 1 ]]printf 'changed package\n' > "$PROJECT/Package.swift"[[ $("$PROJECT/Scripts/parcel-dev.sh" --path) == "$binary" ]][[ $(wc -l < "$BUILD_LOG") -eq 2 ]][[ $(BUILD_FAIL=17 "$PROJECT/Scripts/parcel-dev.sh" probe) == 'native fixture: probe' ]][[ $(wc -l < "$BUILD_LOG") -eq 2 ]]printf 'changed source\n' > "$PROJECT/Sources/ParcelDev/Value.swift"status=0BUILD_FAIL=17 "$PROJECT/Scripts/parcel-dev.sh" probe > "$work/failure" 2>&1 || status=$?[[ $status == 17 ]]status=0PARCEL_DEV_BINARY="$work/missing" "$PROJECT/Scripts/parcel-dev.sh" --path > "$work/failure" 2>&1 || status=$?[[ $status == 2 ]]grep -q 'missing or not executable' "$work/failure"[[ $(wc -l < "$BUILD_LOG") -eq 3 ]][[ ! -f "$PROJECT/.build/parcel-dev/inputs" ]][[ $("$PROJECT/Scripts/parcel-dev.sh" probe) == 'native fixture: probe' ]][[ $(wc -l < "$BUILD_LOG") -eq 4 ]][[ $("$PROJECT/Scripts/parcel-dev.sh" --path) == "$binary" ]][[ $(wc -l < "$BUILD_LOG") -eq 4 ]]# Root invalidation must preserve dependencies and independently stamped caches.builder="$PROJECT/Scripts/swift-build.sh"state="$PROJECT/.build"mkdir -p "$state/checkouts" "$state/repositories" "$state/artifacts" "$state/independent/debug"printf dependency > "$state/checkouts/retained"printf dependency > "$state/repositories/retained"printf dependency > "$state/artifacts/retained"printf independent > "$state/independent/debug/retained""$builder" --prepareseed_objects() { mkdir -p "$state/arm64-apple-macosx/debug/ParcelCore.build" "$state/Modules" "$state/plugins/cache" "$state/apple/Intermediates.noindex" printf stale > "$state/arm64-apple-macosx/debug/ParcelCore.build/value.o" printf stale > "$state/Modules/ParcelCore.swiftmodule" printf stale > "$state/build.db" printf stale > "$state/debug.yaml" ln -s arm64-apple-macosx/debug "$state/debug"}objects_gone() { [[ ! -e $state/arm64-apple-macosx && ! -e $state/Modules && ! -e $state/build.db && ! -L $state/debug ]] [[ -f $state/checkouts/retained && -f $state/repositories/retained && -f $state/artifacts/retained ]] [[ -x $binary && -f $state/independent/debug/retained ]]}seed_objects"$builder" --prepare[[ -f $state/arm64-apple-macosx/debug/ParcelCore.build/value.o ]]printf 'resolved 1\n' > "$PROJECT/Package.resolved""$builder" --prepareobjects_goneseed_objectsTEST_SWIFT_VERSION=2 "$builder" --prepareobjects_goneseed_objectsTEST_SWIFT_VERSION=2 "$builder" --clean-modulesobjects_goneseed_objectsstatus=0TEST_XCODE_STATUS=23 "$builder" --prepare > "$work/failure" 2>&1 || status=$?[[ $status == 23 && -f $state/build.db ]]rm -f "$state/debug"ln -s "$state/independent" "$state/linked"status=0"$builder" --clean-modules --scratch-path "$state/linked" > "$work/failure" 2>&1 || status=$?[[ $status == 2 && -f $state/independent/debug/retained ]]printf 'Tool cache and build stamp checks passed.\n'