SPB Git

Repository Public

build.sh 2.0 KB 33 lines shellscript

1#!/usr/bin/env bash2# Author: Simon-Pierre Boucher — contact@spboucher.ai3# File: Scripts/build.sh4# Description: Generates the Xcode project and builds SP Vault (errors and warnings only on the console).5#6# Usage: Scripts/build.sh mac [Debug|Release]     macOS app + AutoFill extension (Debug = "SP Vault Dev", ad hoc)7#        Scripts/build.sh ios [Debug]             iOS app + extension for the dedicated simulator "SPVault iPhone"8#        Scripts/build.sh ipad                    same, for "SPVault iPad"9#        Scripts/build.sh generate                project only10# Products go outside ~/Desktop (TCC freezes processes that run from there). Override the DerivedData root with SPV_DD.11set -uo pipefail12cd "$(dirname "$0")/.."13WHAT="${1:-mac}"; CONFIG="${2:-Debug}"14DD="${SPV_DD:-$HOME/Library/Developer/SPVault/DerivedData}"; mkdir -p build/logs "$DD"15xcodegen generate --quiet || exit 116sim() { # name, device type → udid (created once; never touches other simulators)17  local udid; udid=$(xcrun simctl list devices | grep -F "$1 (" | head -1 | sed -E 's/.*\(([0-9A-F-]{36})\).*/\1/')18  if [ -z "$udid" ]; then udid=$(xcrun simctl create "$1" "$2"); fi19  echo "$udid"20}21case "$WHAT" in22  generate) exit 0 ;;23  mac) LOG=build/logs/build-mac-$CONFIG.log24       xcodebuild -project SPVault.xcodeproj -scheme SPVault -configuration "$CONFIG" -derivedDataPath "$DD" build > "$LOG" 2>&1 ;;25  ios|ipad)26       if [ "$WHAT" = ios ]; then UDID=$(sim "SPVault iPhone" "iPhone 17 Pro"); else UDID=$(sim "SPVault iPad" "iPad Pro 11-inch (M5)"); fi27       LOG=build/logs/build-$WHAT-$CONFIG.log28       xcodebuild -project SPVault.xcodeproj -scheme SPVault-iOS -configuration "$CONFIG" -destination "platform=iOS Simulator,id=$UDID" -derivedDataPath "$DD" build > "$LOG" 2>&1 ;;29  *) echo "usage: $0 mac|ios|ipad|generate [Debug|Release]"; exit 2 ;;30esac31sed 's/\x1b\[[0-9;]*m//g' "$LOG" | grep -E "error:|warning: |BUILD" | grep -v "appintentsmetadataprocessor" | sed -E "s#$PWD/##" | grep -v "^ *|" | sort -u | cut -c1-320 | head -"${SPV_LINES:-60}"32grep -q "BUILD SUCCEEDED" "$LOG"33
Files main
Menu

Theme