#!/usr/bin/env bash # Build the exact release-walk checkout's headless server and REAL simulator app under the caller's build lock. set -euo pipefail export COTTON_FLAVOR=real BUILD="${1:?build directory}" cd "$BUILD/src" . scripts/lib/cargo-path.sh ensure_cargo_on_path . scripts/lib/owned-root.sh refuse_wide_root 'release walk build products' "$BUILD" . scripts/lib/derived-data.sh # Keep this exact-commit build in the walk's owned cache, through the shared resolver. export COTTON_DERIVED_DATA="$BUILD/derived" DERIVED="$(cotton_derived_data)" # Helpers only delete inside this newly owned worktree, never a household. cargo build --manifest-path crates/Cargo.toml -p cotton-ffi --bin cotton-headless -j 4 cp "$CARGO_TARGET_DIR/debug/cotton-headless" "$BUILD/cotton-headless" bash scripts/build-xcframework.sh --debug --simulator-only bash scripts/gen-ios-project.sh xcodebuild build -project apps/cotton/Cotton.xcodeproj -scheme tinmen-cotton \ -configuration Debug -destination 'generic/platform=iOS Simulator' \ -derivedDataPath "$DERIVED" COTTON_FLAVOR=real COTTON_BUILD_COMMIT="$(git rev-parse HEAD)" ARCHS=arm64 ONLY_ACTIVE_ARCH=YES -jobs 4 touch "$BUILD/complete"