SPB Git

Repository Public License

build.sh 2.4 KB 41 lines shellscript

1#!/usr/bin/env bash2# ORIX Scan3# File: Scripts/build.sh4# Description: Generate the Xcode project, build, and test (filtered output; full logs in build/logs).5#              usage: build.sh generate | kit | debug | release | uitest [xcodebuild args] | all6#              ORIX_SIM selects the simulator (default "ORIX iPhone"; iPad: "ORIX iPad").7#8# Author: Simon-Pierre Boucher9# Contact: contact@spboucher.ai10set -uo pipefail11cd "$(dirname "$0")/.."12SIM="${ORIX_SIM:-ORIX iPhone}"13DD="build/DerivedData"14mkdir -p build/logs15filter() { sed -E 's/\x1b\[[0-9;]*m//g' | grep -E "error:|warning: unre|\*\* |Test Suite .* (passed|failed)|Executed [0-9]+ tests|✘|Testing failed|failed \(|Test run with|Test Case .* (failed)" | sort -u | head -"${LINES_MAX:-60}"; }16case "${1:-debug}" in17  generate)18    xcodegen generate --quiet && echo "project generated" ;;19  kit)20    # Engines and design system on the host Mac (fast): every package test.21    (cd Packages/ORIXKit && swift test --no-parallel 2>&1 | tee ../../build/logs/kit.log | filter) ;;22  debug)23    xcodebuild -project ORIXScan.xcodeproj -scheme ORIXScan -configuration Debug -destination "platform=iOS Simulator,name=$SIM" -derivedDataPath "$DD" build 2>&1 | tee build/logs/debug.log | filter ;;24  release)25    xcodebuild -project ORIXScan.xcodeproj -scheme ORIXScan -configuration Release -destination "generic/platform=iOS Simulator" -derivedDataPath "$DD" build 2>&1 | tee build/logs/release.log | filter ;;26  uitest)27    shift || true28    NAME="${SIM// /_}"29    rm -rf "build/results/uitest-$NAME.xcresult"30    # Boot and wait: launching the test runner on a simulator that is still starting fails its preflight ("Busy").31    xcrun simctl boot "$SIM" 2>/dev/null || true32    xcrun simctl bootstatus "$SIM" -b >/dev/null 2>&1 || true33    xcodebuild -project ORIXScan.xcodeproj -scheme ORIXScan -destination "platform=iOS Simulator,name=$SIM" -derivedDataPath "$DD" \34      -only-testing:ORIXScanUITests -resultBundlePath "build/results/uitest-$NAME.xcresult" "$@" test 2>&1 | tee "build/logs/uitest-$NAME.log" | filter35    rm -rf "build/shots/$NAME"; mkdir -p "build/shots/$NAME"36    xcrun xcresulttool export attachments --path "build/results/uitest-$NAME.xcresult" --output-path "build/shots/$NAME" >/dev/null 2>&1 || true ;;37  all)38    "$0" generate && "$0" kit && "$0" debug && "$0" uitest ;;39  *) echo "usage: build.sh generate|kit|debug|release|uitest|all"; exit 2 ;;40esac41
Files main
Menu

Theme