Repository Public
1#!/bin/bash2# SP Term build helper (filters the Xcode 27.2 plug-in noise that is irrelevant to a macOS app).3# Scripts/build.sh generate xcodegen generate4# Scripts/build.sh debug|release build the app5# Scripts/build.sh test hosted app tests (xcodebuild test)6# Scripts/build.sh kits swift test for the three local packages7# Scripts/build.sh run [args…] build debug and launch8# Scripts/build.sh app-path [debug|release]9set -uo pipefail10cd "$(dirname "$0")/.."11DD="build/DerivedData"12XCB=(xcodebuild -project SPTerm.xcodeproj -scheme SPTerm -derivedDataPath "$DD" -skipPackagePluginValidation)13filter() { sed 's/\x1b\[[0-9;]*m//g' | grep -E "^/.*: (error|warning):|error:|\*\* (BUILD|TEST)|Test Suite '.*' (passed|failed)|Executed [0-9]+ tests|Test Case .* failed|: error -" | grep -vE "DVT|CoreSimulator|CoreDevice|/\.build/|SourcePackages/checkouts" | sed "s|$PWD/||" | sort -u | head -${LINES_MAX:-70}; }14cmd="${1:-debug}"; shift || true15case "$cmd" in16 generate) xcodegen generate --quiet && echo "project generated" ;;17 debug|release)18 cfg=Debug; [ "$cmd" = release ] && cfg=Release19 "${XCB[@]}" -configuration "$cfg" build 2>&1 | filter20 test -d "$DD/Build/Products/$cfg/SP Term.app" && echo "app: $DD/Build/Products/$cfg/SP Term.app" ;;21 test) "${XCB[@]}" -configuration Debug test "$@" 2>&1 | filter ;;22 kits) for p in SPTermKit SPRemoteKit SPIntelligence; do echo "== $p"; Scripts/kit.sh test "$p" | grep -E "Test run|✘|error" ; done ;;23 run)24 "$0" debug >/dev/null25 pkill -x "SP Term" 2>/dev/null; sleep 0.326 open "$DD/Build/Products/Debug/SP Term.app" --args "$@" ;;27 app-path) cfg=Debug; [ "${1:-}" = release ] && cfg=Release; echo "$DD/Build/Products/$cfg/SP Term.app" ;;28 *) echo "unknown command $cmd"; exit 2 ;;29esac30