swiftformat.sh 964 B

1234567891011121314151617181920212223242526272829303132
  1. #! /bin/sh
  2. # Check if the folder name is exactly "LoopFollow"
  3. FOLDER_NAME=$(basename "${SRCROOT}")
  4. if [ "${FOLDER_NAME}" != "LoopFollow" ]; then
  5. echo "Skipping swiftformat: This script only runs in the LoopFollow directory, not in '${FOLDER_NAME}'"
  6. exit 0
  7. fi
  8. function assertEnvironment {
  9. if [ -z "$1" ]; then
  10. echo $2
  11. exit 127
  12. fi
  13. }
  14. assertEnvironment "${SRCROOT}" "Please set SRCROOT to project root folder"
  15. # Formatting is a developer convenience and must not prevent the app from
  16. # building when SwiftFormat has not been downloaded yet. Set
  17. # RUN_SWIFTFORMAT=1 explicitly when formatting is desired.
  18. if [ "${RUN_SWIFTFORMAT:-0}" != "1" ]; then
  19. echo "Skipping swiftformat (set RUN_SWIFTFORMAT=1 to enable it)"
  20. exit 0
  21. fi
  22. unset SDKROOT
  23. swift run -c release --package-path BuildTools swiftformat "${SRCROOT}" \
  24. --header "LoopFollow\n{file}" \
  25. --exclude Pods,Generated,R.generated.swift,fastlane/swift,Dependencies,dexcom-share-client-swift