diff --git a/Scripts/build-and-sign.sh b/Scripts/build-and-sign.sh index f1241752f..fc06ff143 100755 --- a/Scripts/build-and-sign.sh +++ b/Scripts/build-and-sign.sh @@ -211,7 +211,7 @@ fi echo "🏗️ Building KeyPath and plugins..." # Build all products in a single SwiftPM invocation to share module compilation. -swift build --configuration release -Xswiftc -no-whole-module-optimization +swift build ${KEYPATH_BUILD_SYSTEM:+--build-system "$KEYPATH_BUILD_SYSTEM"} --configuration release -Xswiftc -no-whole-module-optimization echo "📦 Creating app bundle..." APP_NAME="KeyPath" diff --git a/Scripts/build-helper.sh b/Scripts/build-helper.sh index b68f6740f..90b759494 100755 --- a/Scripts/build-helper.sh +++ b/Scripts/build-helper.sh @@ -41,7 +41,7 @@ if [ ! -f "$HELPER_INFO_PLIST" ]; then exit 1 fi -swift build --configuration release --product "$HELPER_NAME" \ +swift build ${KEYPATH_BUILD_SYSTEM:+--build-system "$KEYPATH_BUILD_SYSTEM"} --configuration release --product "$HELPER_NAME" \ -Xswiftc -no-whole-module-optimization \ -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __info_plist -Xlinker "$HELPER_INFO_PLIST" diff --git a/Scripts/quick-deploy.sh b/Scripts/quick-deploy.sh index c00d1e195..bcb000ffb 100755 --- a/Scripts/quick-deploy.sh +++ b/Scripts/quick-deploy.sh @@ -254,7 +254,13 @@ fi echo "🔨 Building..." BUILD_LOG="$BUILD_LOG_DIR/build-${BUILD_ID}.log" write_build_log_header "$BUILD_LOG" -if ! swift build "${MODULE_CACHE_FLAGS[@]}" >> "$BUILD_LOG" 2>&1; then +# Optional build-system override (e.g. KEYPATH_BUILD_SYSTEM=native on toolchains +# whose default swiftbuild system is broken). Unset = use the toolchain default. +BUILD_SYSTEM_FLAGS=() +if [[ -n "${KEYPATH_BUILD_SYSTEM:-}" ]]; then + BUILD_SYSTEM_FLAGS=(--build-system "$KEYPATH_BUILD_SYSTEM") +fi +if ! swift build "${BUILD_SYSTEM_FLAGS[@]}" "${MODULE_CACHE_FLAGS[@]}" >> "$BUILD_LOG" 2>&1; then BUILD_END_MS=$(get_time_ms) DURATION=$((BUILD_END_MS - BUILD_START_MS)) print_build_failure_diagnostics "$BUILD_LOG" @@ -262,7 +268,7 @@ if ! swift build "${MODULE_CACHE_FLAGS[@]}" >> "$BUILD_LOG" 2>&1; then exit 1 fi -if ! BIN_DIR_OUTPUT=$(swift build --show-bin-path "${MODULE_CACHE_FLAGS[@]}" 2>> "$BUILD_LOG"); then +if ! BIN_DIR_OUTPUT=$(swift build --show-bin-path "${BUILD_SYSTEM_FLAGS[@]}" "${MODULE_CACHE_FLAGS[@]}" 2>> "$BUILD_LOG"); then BUILD_END_MS=$(get_time_ms) DURATION=$((BUILD_END_MS - BUILD_START_MS)) print_build_failure_diagnostics "$BUILD_LOG"