diff --git a/scripts/package-swift.sh b/scripts/package-swift.sh index bd0ecaab..bc32efe8 100755 --- a/scripts/package-swift.sh +++ b/scripts/package-swift.sh @@ -3,6 +3,12 @@ set -euo pipefail SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" PROJECT_ROOT="$( cd "$SCRIPT_DIR/.." && pwd )" + +# Ensure cargo is in PATH (rustup proxy may not be available on all CI runners) +if ! command -v cargo &>/dev/null; then + # shellcheck source=/dev/null + [ -f "$HOME/.cargo/env" ] && source "$HOME/.cargo/env" +fi SWIFT_DIR="$PROJECT_ROOT/swift" GENERATED_DIR="$SWIFT_DIR/Sources/IDKit/Generated" IOS_BUILD="$PROJECT_ROOT/ios_build" diff --git a/swift/Examples/IDKitSampleApp/IDKitSampleApp.xcodeproj/xcshareddata/xcschemes/IDKitSampleApp.xcscheme b/swift/Examples/IDKitSampleApp/IDKitSampleApp.xcodeproj/xcshareddata/xcschemes/IDKitSampleApp.xcscheme index 8be6f12b..b5fe4d0f 100644 --- a/swift/Examples/IDKitSampleApp/IDKitSampleApp.xcodeproj/xcshareddata/xcschemes/IDKitSampleApp.xcscheme +++ b/swift/Examples/IDKitSampleApp/IDKitSampleApp.xcodeproj/xcshareddata/xcschemes/IDKitSampleApp.xcscheme @@ -10,8 +10,8 @@ + title = "Build IDKit Dependencies" + scriptText = "REPO_ROOT="${SRCROOT}/../../.." XCFRAMEWORK="${REPO_ROOT}/IDKitFFI.xcframework" GENERATED="${REPO_ROOT}/swift/Sources/IDKit/Generated/idkit_core.swift" RUST_SRC="${REPO_ROOT}/rust/core/src" NEEDS_BUILD=0 if [ ! -d "${XCFRAMEWORK}" ] || [ ! -f "${GENERATED}" ]; then NEEDS_BUILD=1 elif [ -n "$(find "${RUST_SRC}" -newer "${GENERATED}" -name '*.rs' -print -quit)" ]; then NEEDS_BUILD=1 fi if [ "${NEEDS_BUILD}" -eq 1 ]; then echo "note: IDKit native artifacts missing or stale — rebuilding..." "${REPO_ROOT}/scripts/package-swift.sh" fi "> &2 - echo "error: Run the following from the repo root, then build again:" >&2 - echo "error: ./scripts/package-swift.sh" >&2 - exit 1 + NEEDS_BUILD=1 + elif [ -n "$(find "${RUST_SRC}" -newer "${GENERATED}" -name '*.rs' -print -quit)" ]; then + NEEDS_BUILD=1 + fi + + if [ "${NEEDS_BUILD}" -eq 1 ]; then + echo "note: IDKit native artifacts missing or stale — rebuilding..." + "${REPO_ROOT}/scripts/package-swift.sh" fi - name: Check IDKit Dependencies + name: Build IDKit Dependencies settingsTarget: IDKitSampleApp run: config: Debug