build_one_example.sh 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #!/bin/bash
  2. # Copyright 2016 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 -ev
  18. # Params:
  19. # EXAMPLE_PATH - directory of the example
  20. # SCHEME - scheme of the example, used by xcodebuild
  21. # CocoaPods requires the terminal to be using UTF-8 encoding.
  22. export LANG=en_US.UTF-8
  23. TEST_PATH=$(cd "$(dirname $0)" > /dev/null ; pwd)
  24. cd `dirname $0`/../../..
  25. cd $EXAMPLE_PATH
  26. # clean the directory
  27. rm -rf Pods
  28. rm -rf *.xcworkspace
  29. rm -f Podfile.lock
  30. pod install | $TEST_PATH/verbose_time.sh
  31. set -o pipefail
  32. XCODEBUILD_FILTER='(^CompileC |^Ld |^.*clang |^ *cd |^ *export |^Libtool |^.*libtool |^CpHeader |^ *builtin-copy )'
  33. if [ "$SCHEME" == "tvOS-sample" ]; then
  34. xcodebuild \
  35. build \
  36. -workspace *.xcworkspace \
  37. -scheme $SCHEME \
  38. -destination generic/platform=tvOS \
  39. -derivedDataPath Build/Build \
  40. CODE_SIGN_IDENTITY="" \
  41. CODE_SIGNING_REQUIRED=NO \
  42. | $TEST_PATH/verbose_time.sh \
  43. | egrep -v "$XCODEBUILD_FILTER" \
  44. | egrep -v "^$" -
  45. else
  46. xcodebuild \
  47. build \
  48. -workspace *.xcworkspace \
  49. -scheme $SCHEME \
  50. -destination generic/platform=iOS \
  51. -derivedDataPath Build/Build \
  52. CODE_SIGN_IDENTITY="" \
  53. CODE_SIGNING_REQUIRED=NO \
  54. | $TEST_PATH/verbose_time.sh \
  55. | egrep -v "$XCODEBUILD_FILTER" \
  56. | egrep -v "^$" -
  57. fi