pod_lib_lint.sh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. if [[ $# -lt 1 ]]; then
  19. cat 1>&2 <<EOF
  20. USAGE: $0 podspec [options]
  21. podspec is the podspec to lint
  22. options can be any options for pod spec lint
  23. Optionally, ALT_SOURCES can be set in the script to add extra repos to the
  24. search path. This is useful when API's to core dependencies like FirebaseCore
  25. or GoogleUtilities and the public podspecs are not yet updated.
  26. EOF
  27. exit 1
  28. fi
  29. # Set ALT_SOURCES like the following to continue lint testing until release when Utilities
  30. # or Core APIs change. GoogleUtilities.podspec and FirebaseCore.podspec should be
  31. # manually pushed to a temporary Specs repo. See
  32. # https://guides.cocoapods.org/making/private-cocoapods.
  33. ALT_SOURCES="--sources=https://github.com/Firebase/SpecsStaging.git,https://github.com/CocoaPods/Specs.git"
  34. podspec="$1"
  35. if [[ $# -gt 1 ]]; then
  36. options="${@:2}"
  37. else
  38. options=
  39. fi
  40. command="bundle exec pod lib lint $podspec $options $ALT_SOURCES"
  41. echo $command
  42. $command ; result=$?
  43. if [[ $result != 0 ]]; then
  44. # retry because of occasional network flakiness
  45. $command ; result=$?
  46. fi
  47. exit $result