test.sh 569 B

123456789101112131415161718
  1. #!/bin/zsh
  2. # A `realpath` alternative using the default C implementation.
  3. filepath() {
  4. [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
  5. }
  6. OPENSWIFTUI_ROOT="$(dirname $(dirname $(filepath $0)))"
  7. cd $OPENSWIFTUI_ROOT
  8. # Set OPENSWIFTUI_LIB_SWIFT_PATH on Linux if swiftly is installed
  9. if [[ "$(uname)" == "Linux" ]] && command -v swiftly &> /dev/null && [[ -z "$OPENSWIFTUI_LIB_SWIFT_PATH" ]]; then
  10. export OPENSWIFTUI_LIB_SWIFT_PATH="$(swiftly use --print-location)/usr/lib/swift"
  11. echo "Set OPENSWIFTUI_LIB_SWIFT_PATH=$OPENSWIFTUI_LIB_SWIFT_PATH"
  12. fi
  13. swift test