SPB Git

Repository Public

build.sh 3.7 KB 74 lines shellscript

1#!/usr/bin/env bash2# =============================================================================3#                  SP BOUCHER | INFRASTRUCTURE & AUTOMATION4#             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project          : SP Search iOS8# File             : Scripts/build.sh9# Description      : Generate the Xcode project, build, test (filtered10#                    xcodebuild output; full log in build/logs). usage:11#                    build.sh generate | debug | release | kit | test [iPad] |12#                    strings13# Module           : Scripts14# Repository       : https://git.spboucher.ai/sp-search-ios15# Project Website  : https://search.spboucher.ai16# Created          : 2026-12-0117# Last Modified    : 2026-12-0118#19# Author           : Simon-Pierre Boucher20# Position         : Professor of Finance21# Institution      : Université du Québec en Outaouais (UQO)22# Organization     : SP Boucher23# Website          : https://spboucher.ai24# Git              : https://git.spboucher.ai25#26# Preferred Contact: support@spboucher.ai27# Technical Contact: dev@spboucher.ai28# Security/Admin   : admin@spboucher.ai29#30# Copyright (c) 202631# Simon-Pierre Boucher32# All rights reserved where applicable. This file is governed by the33# applicable project license, copyright notices and relevant law.34# Existing third-party rights and notices remain unaffected.35#36# License          : None specified (no license file in this repository)37#38# Do not embed credentials, private keys, access tokens,39# certificates or confidential personal information.40#41# =============================================================================42# END OF SP BOUCHER SOURCE HEADER43# =============================================================================4445set -uo pipefail46cd "$(dirname "$0")/.."47SIM="${SPSEARCH_SIM:-SPSearch iPhone}"48[ "${2:-}" = "iPad" ] && SIM="SPSearch iPad"49DD="${SPSEARCH_DD:-build/DerivedData}"50mkdir -p build/logs51filter() { grep -E "error:|warning: |\*\* |Test Suite .* (passed|failed)|Executed [0-9]+ tests|✘|Test run with|Testing failed|failed \(" | grep -v "appintentsmetadataprocessor" | sed "s|$PWD/||" | sort -u | head -"${LINES_MAX:-60}"; }52# Dedicated simulators: other sessions on this Mac use the stock ones.53sims() {54  xcrun simctl list devices | grep -q "SPSearch iPhone (" || xcrun simctl create "SPSearch iPhone" "iPhone 17 Pro" >/dev/null55  xcrun simctl list devices | grep -q "SPSearch iPad (" || xcrun simctl create "SPSearch iPad" "iPad Pro 13-inch (M5)" >/dev/null56}57case "${1:-debug}" in58  generate) xcodegen generate --quiet && echo "project generated" ;;59  debug)60    sims; xcodegen generate --quiet61    xcodebuild -project SPSearch.xcodeproj -scheme SPSearch -configuration Debug -destination "platform=iOS Simulator,name=$SIM" -derivedDataPath "$DD" build 2>&1 | tee build/logs/debug.log | filter ;;62  release)63    xcodegen generate --quiet64    xcodebuild -project SPSearch.xcodeproj -scheme SPSearch -configuration Release -destination "generic/platform=iOS Simulator" -derivedDataPath "$DD" build 2>&1 | tee build/logs/release.log | filter ;;65  kit) (cd Core && swift test 2>&1 | grep -E "error|warning|✘|Test run with") ;;66  test)67    sims; xcodegen generate --quiet68    rm -rf "build/results/test-${SIM// /_}.xcresult"69    xcodebuild -project SPSearch.xcodeproj -scheme SPSearch -destination "platform=iOS Simulator,name=$SIM" -derivedDataPath "$DD" \70      -resultBundlePath "build/results/test-${SIM// /_}.xcresult" -parallel-testing-enabled NO test 2>&1 | tee "build/logs/test-${SIM// /_}.log" | filter ;;71  strings) python3 Scripts/strings.py check "$DD" ;;72  *) echo "usage: build.sh generate|debug|release|kit|test [iPad]|strings"; exit 2 ;;73esac74
Files main
Menu

Theme