Repository Public
1#!/bin/bash2# Builds/tests one of the local Swift packages and prints only the useful diagnostics.3# Scripts/kit.sh build [SPTermKit|SPRemoteKit|SPIntelligence]4# Scripts/kit.sh test [package] [--filter Name]5set -uo pipefail6cd "$(dirname "$0")/.."7cmd="${1:-build}"; pkg="${2:-SPTermKit}"; shift; shift || true8cd "Packages/$pkg" || exit 29case "$cmd" in10 build)11 out="$(swift build 2>&1)"; rc=$?12 echo "$out" | sed 's/\x1b\[[0-9;]*m//g' | grep -E "^/.*: (error|warning):" | grep -v "/.build/" | sed "s|$PWD/||" | sort -u | head -6013 [ $rc -eq 0 ] && echo "BUILD OK ($pkg)" || echo "BUILD FAILED ($pkg)"14 exit $rc ;;15 test)16 out="$(swift test "$@" 2>&1)"; rc=$?17 echo "$out" | sed 's/\x1b\[[0-9;]*m//g' | grep -E "^/.*: (error|warning):|✘|recorded an issue|Test run with|error: |Executed .* tests" | grep -v "/.build/" | sed "s|$PWD/||" | head -8018 exit $rc ;;19 *) echo "unknown command"; exit 2 ;;20esac21