pod_lib_lint.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/usr/bin/env bash
  2. # Copyright 2018 Google
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # USAGE: pod_lib_lint.sh podspec [options]
  16. #
  17. # Runs pod lib lint for the given podspec
  18. set -euo pipefail
  19. if [[ $# -lt 1 ]]; then
  20. cat 1>&2 <<EOF
  21. USAGE: $0 podspec [options]
  22. podspec is the podspec to lint
  23. options can be any options for pod spec lint
  24. Optionally, ALT_SOURCES can be set in the script to add extra repos to the
  25. search path. This is useful when APIs to core dependencies like FirebaseCore or
  26. GoogleUtilities and the public podspecs are not yet updated.
  27. EOF
  28. exit 1
  29. fi
  30. # Set ALT_SOURCES like the following to continue lint testing until release when Utilities
  31. # or Core APIs change. GoogleUtilities.podspec and FirebaseCore.podspec should be
  32. # manually pushed to a temporary Specs repo. See
  33. # https://guides.cocoapods.org/making/private-cocoapods.
  34. ALT_SOURCES="--sources=https://github.com/Firebase/SpecsStaging.git,https://github.com/CocoaPods/Specs.git"
  35. command=(bundle exec pod lib lint "$@")
  36. if [[ -n "${ALT_SOURCES:-}" ]]; then
  37. command+=("${ALT_SOURCES}")
  38. fi
  39. echo "${command[*]}"
  40. "${command[@]}"; result=$?
  41. if [[ $result != 0 ]]; then
  42. # retry because of occasional network flakiness
  43. "${command[@]}"; result=$?
  44. fi
  45. exit $result