build_tests.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/bash
  2. # Copyright 2019 gRPC authors.
  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. # Don't run this script standalone. Instead, run from the repository root:
  16. # ./tools/run_tests/run_tests.py -l objc
  17. set -ex
  18. # CocoaPods requires the terminal to be using UTF-8 encoding.
  19. export LANG=en_US.UTF-8
  20. cd "$(dirname "$0")"
  21. # Check that required tools are available.
  22. hash pod 2>/dev/null || { echo >&2 "Cocoapods needs to be installed."; exit 1; }
  23. hash xcodebuild 2>/dev/null || {
  24. echo >&2 "XCode command-line tools need to be installed."
  25. exit 1
  26. }
  27. # clean the directory
  28. rm -rf Pods
  29. rm -rf Tests.xcworkspace
  30. rm -f Podfile.lock
  31. rm -rf RemoteTestClientCpp/src
  32. time pod install
  33. # ios-cpp-test-cronet flakes sometimes because of missing files in Protobuf-C++,
  34. # add some log to help find out the root cause.
  35. # TODO(yulinliang): Delete it after solving the issue.
  36. if [ -d "./Pods/Headers/Public/Protobuf-C++/google/protobuf" ]
  37. then
  38. echo "Protobuf-C++/google/protobuf/ has been imported."
  39. number_of_files=$(find Pods/Headers/Public/Protobuf-C++/google/protobuf -name "*.h" | wc -l)
  40. echo "The number of header files in Pods/Headers/Public/Protobuf-C++/google/protobuf/ is $number_of_files"
  41. else
  42. echo "Error: Protobuf-C++/google/protobuf/ hasn't been imported."
  43. fi