SPB Git

Repository Public

build.sh 2.5 KB 40 lines shellscript

1#!/usr/bin/env bash2# SP Wallet iOS3# File: Scripts/build.sh4# Description: Generate the Xcode project, build, test (filtered xcodebuild output; full log in build/logs).5#              usage: build.sh generate | debug | release | test [xcodebuild args] | uitest [xcodebuild args] | core6#              SPWALLET_SIM selects the simulator (default "SPWallet iPhone"; "SPWallet iPad" for the tablet).7#8# Author: Simon-Pierre Boucher9# Contact: contact@spboucher.ai10set -uo pipefail11cd "$(dirname "$0")/.."12SIM="${SPWALLET_SIM:-SPWallet iPhone}"13DD="build/DerivedData"14mkdir -p build/logs15filter() { grep -E "error:|warning: unre|warning: var|\*\* |Executed [0-9]+ tests|✘|Testing failed|failed \(|: error|Test run with|Test Case .* failed" | grep -v "^$" | sort -u | head -"${LINES_MAX:-60}"; }16case "${1:-debug}" in17  generate)18    # Info-Debug.plist = Info.plist + local networking allowed (the throwaway stack on http://localhost)19    cp Resources/Info.plist Resources/Info-Debug.plist20    /usr/libexec/PlistBuddy -c "Set :NSAppTransportSecurity:NSAllowsLocalNetworking true" Resources/Info-Debug.plist21    xcodegen generate --quiet && echo "projet généré" ;;22  debug)23    xcodebuild -project SPWallet.xcodeproj -scheme SPWallet -configuration Debug -destination "platform=iOS Simulator,name=$SIM" -derivedDataPath "$DD" build 2>&1 | tee build/logs/debug.log | filter ;;24  release)25    xcodebuild -project SPWallet.xcodeproj -scheme SPWallet -configuration Release -destination "generic/platform=iOS Simulator" -derivedDataPath "$DD" build 2>&1 | tee build/logs/release.log | filter ;;26  test)27    shift || true28    xcodebuild -project SPWallet.xcodeproj -scheme SPWallet -destination "platform=iOS Simulator,name=$SIM" -derivedDataPath "$DD" -only-testing:SPWalletTests "$@" test 2>&1 | tee build/logs/test.log | filter ;;29  uitest)30    shift || true31    R="build/results/uitest-${SIM// /_}.xcresult"32    [[ -d "$R" ]] && mv "$R" "$R.$(date +%s).old"33    xcodebuild -project SPWallet.xcodeproj -scheme SPWallet -destination "platform=iOS Simulator,name=$SIM" -derivedDataPath "$DD" -only-testing:SPWalletUITests -resultBundlePath "$R" "$@" test 2>&1 | tee build/logs/uitest.log | filter34    mkdir -p "build/shots/${SIM// /_}"35    xcrun xcresulttool export attachments --path "$R" --output-path "build/shots/${SIM// /_}" >/dev/null 2>&1 || true ;;36  core)37    (cd ../SPWalletCore && swift test --scratch-path .build-ios 2>&1 | grep -E "error|✘|Test run") ;;38  *) echo "usage: build.sh generate|debug|release|test|uitest|core"; exit 2 ;;39esac40
Files main
Menu

Theme