SPB Git

Repository Public License

build.sh 3.9 KB 78 lines shellscript

1#!/usr/bin/env bash2# =============================================================================3#                  SP BOUCHER | INFRASTRUCTURE & AUTOMATION4#             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project          : ORIX Camera8# File             : Scripts/build.sh9# Description      : Generate the Xcode project, build, and test (filtered10#                    output; full logs in build/logs). usage: build.sh generate11#                    | kit | debug | release | uitest [xcodebuild args] | all12#                    ORIX_SIM selects the simulator (default "ORIXCamera13#                    iPhone"; iPad: "ORIXCamera iPad").14# Module           : Scripts15# Repository       : https://git.spboucher.ai/orix-camera16# Project Website  : https://www.orixlab.dev17# Created          : 2026-11-2118# Last Modified    : 2026-11-2119#20# Author           : Simon-Pierre Boucher21# Position         : Professor of Finance22# Institution      : Université du Québec en Outaouais (UQO)23# Organization     : SP Boucher24# Website          : https://spboucher.ai25# Git              : https://git.spboucher.ai26#27# Preferred Contact: support@spboucher.ai28# Technical Contact: dev@spboucher.ai29# Security/Admin   : admin@spboucher.ai30#31# Copyright (c) 202632# Simon-Pierre Boucher33# All rights reserved where applicable. This file is governed by the34# applicable project license, copyright notices and relevant law.35# Existing third-party rights and notices remain unaffected.36#37# License          : Proprietary, all rights reserved (see license file)38# License File     : LICENSE39#40# Do not embed credentials, private keys, access tokens,41# certificates or confidential personal information.42#43# =============================================================================44# END OF SP BOUCHER SOURCE HEADER45# =============================================================================4647set -uo pipefail48cd "$(dirname "$0")/.."49SIM="${ORIX_SIM:-ORIXCamera iPhone}"50DD="build/DerivedData"51mkdir -p build/logs52filter() { 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}"; }53case "${1:-debug}" in54  generate)55    xcodegen generate --quiet && echo "project generated" ;;56  kit)57    # Engines and design system on the host Mac (fast): every package test.58    (cd Packages/ORIXCameraKit && swift test --no-parallel 2>&1 | tee ../../build/logs/kit.log | filter) ;;59  debug)60    xcodebuild -project ORIXCamera.xcodeproj -scheme ORIXCamera -configuration Debug -destination "platform=iOS Simulator,name=$SIM" -derivedDataPath "$DD" build 2>&1 | tee build/logs/debug.log | filter ;;61  release)62    xcodebuild -project ORIXCamera.xcodeproj -scheme ORIXCamera -configuration Release -destination "generic/platform=iOS Simulator" -derivedDataPath "$DD" build 2>&1 | tee build/logs/release.log | filter ;;63  uitest)64    shift || true65    NAME="${SIM// /_}"66    rm -rf "build/results/uitest-$NAME.xcresult"67    # Boot and wait: launching the test runner on a simulator that is still starting fails its preflight ("Busy").68    xcrun simctl boot "$SIM" 2>/dev/null || true69    xcrun simctl bootstatus "$SIM" -b >/dev/null 2>&1 || true70    xcodebuild -project ORIXCamera.xcodeproj -scheme ORIXCamera -destination "platform=iOS Simulator,name=$SIM" -derivedDataPath "$DD" \71      -resultBundlePath "build/results/uitest-$NAME.xcresult" "$@" test 2>&1 | tee "build/logs/uitest-$NAME.log" | filter72    rm -rf "build/shots/$NAME"; mkdir -p "build/shots/$NAME"73    xcrun xcresulttool export attachments --path "build/results/uitest-$NAME.xcresult" --output-path "build/shots/$NAME" >/dev/null 2>&1 || true ;;74  all)75    "$0" generate && "$0" kit && "$0" debug && "$0" uitest ;;76  *) echo "usage: build.sh generate|kit|debug|release|uitest|all"; exit 2 ;;77esac78
Files main
Menu

Theme