Branchwell

Groundroom / app / tools / check.sh

1#!/bin/bash
2set -euo pipefail
3cd "$(dirname "$0")/.."
4out="${1:-.check-build}"
5mkdir -p "$out/tmp" "$out/modules"
6out="$(cd "$out" && pwd)"
7export TMPDIR="$out/tmp" CLANG_MODULE_CACHE_PATH="$out/modules"
8swift=(xcrun swiftc -parse-as-library -module-cache-path "$out/modules")
9"${swift[@]}" -D GROUNDROOM_SELF_TEST Sources/Groundroom.swift -o "$out/GroundroomChecks"
10"$out/GroundroomChecks"
11"${swift[@]}" Sources/RoomLayout.swift Checks/LayoutChecks.swift -o "$out/LayoutChecks"
12"$out/LayoutChecks"
13for entry in 'macosx arm64-apple-macosx14.0 Mac' 'iphoneos arm64-apple-ios17.0 iPhone-iPad' 'xros arm64-apple-xros2.0 VisionPro' 'xrsimulator arm64-apple-xros2.0-simulator VisionSimulator'; do
14 set -- $entry
15 sdk=$1 target=$2 name=$3
16 "${swift[@]}" -target "$target" -sdk "$(xcrun --sdk "$sdk" --show-sdk-path)" Sources/*.swift -o "$out/$name"
17 xcrun vtool -show-build "$out/$name" | grep -E 'platform|minos' | tr -s ' '
18done