#!/usr/bin/env bash set -e # Exit if one of commands exit with non-zero exit code set -u # Treat unset variables and parameters other than the special parameters ‘@’ or ‘*’ as an error set -o pipefail # Any command failed in the pipe fails the whole pipe # set -x # Print shell commands as they are executed (or you can try -v which is less verbose) if ! grep -q '^5\.' <<< "$BASH_VERSION"; then echo "Your bash version is too old. Version 5 is the minimum required version" > /dev/stderr exit 1 fi add-optional-dep-to-bin() { if /usr/bin/which "$1" &> /dev/null; then /bin/cat > ".deps/bin/${2:-$1}" < /dev/null; then swiftly run swift "$@" else echo "warning: swiftly is not installed. Fallback to plain swift. Swift compilation might not be reproducible" > /dev/stderr /usr/bin/env swift --version /usr/bin/env swift "$@" fi } xcodebuild-pretty() { log_file="$1" shift # Mute stderr # 2024-02-12 23:48:11.713 xcodebuild[60777:7403664] [MT] DVTAssertions: Warning in /System/Volumes/Data/SWE/Apps/DT/BuildRoots/BuildRoot11/ActiveBuildRoot/Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-22269/IDEFoundation/Provisioning/Capabilities Infrastructure/IDECapabilityQuerySelection.swift:103 # Details: createItemModels creation requirements should not create capability item model for a capability item model that already exists. # Function: createItemModels(for:itemModelSource:) # Thread: <_NSMainThread: 0x6000037202c0>{number = 1, name = main} # Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide. if /usr/bin/which xcbeautify &> /dev/null; then /usr/bin/xcrun xcodebuild "$@" 2>&1 | tee "$log_file" | xcbeautify --quiet # Only print tasks that have warnings or errors echo "The full unmodified xcodebuild log is saved to $log_file" else /usr/bin/xcrun xcodebuild "$@" 2>&1 | tee "$log_file" fi }