validate-playground.sh 762 B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. # Bash script to lint the content of playgrounds
  3. # Heavily based on RxSwift's
  4. # https://github.com/ReactiveX/RxSwift/blob/master/scripts/validate-playgrounds.sh
  5. if [ -z "$BUILD_DIRECTORY" ]; then
  6. echo "\$BUILD_DIRECTORY is not set. Are you trying to run \`validate-playgrounds.sh\` without building RAC first?\n"
  7. echo "To validate the playground, run \`script/build\`."
  8. exit 1
  9. fi
  10. PAGES_PATH=${BUILD_DIRECTORY}/Build/Products/${CONFIGURATION}/all-playground-pages.swift
  11. cat ReactiveCocoa.playground/Sources/*.swift ReactiveCocoa.playground/Pages/**/*.swift > ${PAGES_PATH}
  12. swift -v -D NOT_IN_PLAYGROUND -F ${BUILD_DIRECTORY}/Build/Products/${CONFIGURATION} ${PAGES_PATH} > /dev/null
  13. result=$?
  14. # Cleanup
  15. rm -Rf $BUILD_DIRECTORY
  16. exit $result