Repository Public
1#!/usr/bin/env bash2# =============================================================================3# SP BOUCHER | INFRASTRUCTURE & AUTOMATION4# ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project : ORIX Cosmos8# File : Scripts/build.sh9# Description : generate | debug | release | test [filter] | capture [dir]10# — Xcode project generation, app builds, the package test11# suites and the offscreen interface captures. No signing12# for distribution and no notarisation here: the release13# step is separate.14# Module : Scripts15# Repository : https://git.spboucher.ai/orix-cosmos16# Project Website : https://www.orixlab.dev17# Created : 2026-11-2418# Last Modified : 2026-11-2419#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 : None specified (no license file in this repository)38#39# Do not embed credentials, private keys, access tokens,40# certificates or confidential personal information.41#42# =============================================================================43# END OF SP BOUCHER SOURCE HEADER44# =============================================================================4546set -euo pipefail47cd "$(dirname "$0")/.."48PROJECT=ORIXCosmos.xcodeproj49case "${1:-debug}" in50 generate) xcodegen generate ;;51 debug) xcodegen generate >/dev/null; Scripts/xb.sh Debug ;;52 test)53 # Swift Testing output reduced to failures and the summary. Optional second argument: a --filter expression54 # (for example CosmosRenderTests). Golden images are compared, never rewritten, unless COSMOS_UPDATE_GOLDEN=1.55 if [ -n "${2:-}" ]; then FILTER=(--filter "$2"); else FILTER=(); fi56 swift test --scratch-path .build-render "${FILTER[@]}" 2>&1 | grep -E "error:|recorded an issue|Test run|Executed [1-9]" || true ;;57 release)58 # Apple Silicon only. Builds dist/ORIX Cosmos.app with the Release settings of project.yml (manual Developer ID59 # signing with a secure timestamp); packaging and notarisation belong to the release script.60 xcodegen generate >/dev/null61 xcodebuild -project "$PROJECT" -scheme ORIXCosmos -configuration Release -derivedDataPath build/rel ARCHS=arm64 ONLY_ACTIVE_ARCH=NO build 2>&1 \62 | grep -E "error:|warning: .*(deprecated|unused)|\*\* " | sed "s|$PWD/||" | sort -u63 rm -rf "dist/ORIX Cosmos.app"; mkdir -p dist64 ditto "build/rel/Build/Products/Release/ORIX Cosmos.app" "dist/ORIX Cosmos.app"65 echo "dist/ORIX Cosmos.app: $(/usr/libexec/PlistBuddy -c 'Print CFBundleShortVersionString' "dist/ORIX Cosmos.app/Contents/Info.plist") ($(/usr/libexec/PlistBuddy -c 'Print CFBundleVersion' "dist/ORIX Cosmos.app/Contents/Info.plist")), $(lipo -archs "dist/ORIX Cosmos.app/Contents/MacOS/ORIX Cosmos")" ;;66 capture)67 # Renders the real window hierarchy of the Debug app in a set of named states to PNG + JSON, without showing68 # a window or taking the keyboard (see Documentation/modules/CosmosUI.md, "Verification"). Optional second69 # argument: output directory (default build/captures).70 OUT="${2:-build/captures}"; BIN="build/dd/Build/Products/Debug/ORIX Cosmos.app/Contents/MacOS/ORIX Cosmos"71 [ -x "$BIN" ] || { echo "build the Debug app first: $0 debug" >&2; exit 1; }72 mkdir -p "$OUT"73 "$BIN" --screenshot "$OUT/welcome-fr.png" --state welcome --language fr74 "$BIN" --screenshot "$OUT/overview-fr.png" --state overview --language fr75 "$BIN" --screenshot "$OUT/earth.png" --state object --target naif:399 --language en76 "$BIN" --screenshot "$OUT/earth-equinox-sync.png" --state object --target naif:399 --time 2025-03-20T12:00:00Z --mode synchronous --apparent --language en77 "$BIN" --screenshot "$OUT/saturn.png" --state object --target naif:699 --altitude-radii 6 --language en78 "$BIN" --screenshot "$OUT/moon-1969.png" --state object --target naif:301 --time 1969-07-20T20:17:00Z --hide-sidebar --language en79 "$BIN" --screenshot "$OUT/enlarged.png" --state object --target naif:599 --enlarged --altitude-radii 30 --language en80 "$BIN" --screenshot "$OUT/night.png" --state object --target naif:499 --night --language en81 "$BIN" --screenshot "$OUT/outside-fr.png" --state object --target naif:499 --time 2200-01-01T00:00:00Z --language fr82 "$BIN" --screenshot "$OUT/palette-fr.png" --state palette --query tit --light --language fr83 "$BIN" --screenshot "$OUT/methodology.png" --state methodology --width 800 --height 1000 --language en84 "$BIN" --screenshot "$OUT/preferences-fr.png" --state preferences --width 600 --height 470 --language fr85 EMPTY="$(mktemp -d)"; "$BIN" --screenshot "$OUT/missing-fr.png" --state overview --packs-only "$EMPTY" --language fr; rmdir "$EMPTY" ;;86 *) echo "usage: $0 generate|debug|release|test [filter]|capture [dir]" >&2; exit 2 ;;87esac88