apple_kit

Apple-native services for Radroots iOS and macOS apps
git clone https://radroots.dev/git/apple_kit.git
Log | Files | Refs | README | LICENSE

swift-package.sh (739B)


      1 #!/usr/bin/env bash
      2 set -euo pipefail
      3 
      4 repo_root="$(git rev-parse --show-toplevel)"
      5 cd "$repo_root"
      6 
      7 command=${1:-}
      8 case "$command" in
      9   build|test) shift ;;
     10   *) echo "usage: $0 {build|test} [SwiftPM arguments...]" >&2; exit 64 ;;
     11 esac
     12 
     13 scratch_path=${SWIFTPM_SCRATCH:-"$repo_root/.build"}
     14 case "$scratch_path" in
     15   /*) ;;
     16   *) echo "error: SWIFTPM_SCRATCH must be an absolute path" >&2; exit 64 ;;
     17 esac
     18 output_args=(--scratch-path "$scratch_path")
     19 if [[ -n "${SWIFTPM_CACHE:-}" ]]; then
     20   case "$SWIFTPM_CACHE" in
     21     /*) ;;
     22     *) echo "error: SWIFTPM_CACHE must be an absolute path" >&2; exit 64 ;;
     23   esac
     24   output_args+=(--cache-path "$SWIFTPM_CACHE")
     25 fi
     26 
     27 exec swift "$command" "${output_args[@]}" --disable-automatic-resolution "$@"