generate-and-diff.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/bin/bash
  2. # Copyright 2020, gRPC Authors All rights reserved.
  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. set -eu
  16. HERE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
  17. source "${HERE}/../test-boilerplate.sh"
  18. MODULE_MAP="${HERE}/swift.modulemap"
  19. function all_at_once {
  20. echo "[${TEST}] all_at_once"
  21. prepare
  22. protoc \
  23. --proto_path="${PROTO_DIR}" \
  24. --plugin="${PROTOC_GEN_GRPC_SWIFT}" \
  25. --grpc-swift_opt=ProtoPathModuleMappings="${MODULE_MAP}" \
  26. --grpc-swift_out="${OUTPUT_DIR}" \
  27. "${PROTO_DIR}"/*.proto
  28. validate
  29. }
  30. function one_at_a_time {
  31. echo "[${TEST}] one_at_a_time"
  32. prepare
  33. protoc \
  34. --proto_path="${PROTO_DIR}" \
  35. --plugin="${PROTOC_GEN_GRPC_SWIFT}" \
  36. --grpc-swift_opt=ProtoPathModuleMappings="${MODULE_MAP}" \
  37. --grpc-swift_out="${OUTPUT_DIR}" \
  38. "${PROTO_DIR}"/a.proto
  39. protoc \
  40. --proto_path="${PROTO_DIR}" \
  41. --plugin="${PROTOC_GEN_GRPC_SWIFT}" \
  42. --grpc-swift_opt=ProtoPathModuleMappings="${MODULE_MAP}" \
  43. --grpc-swift_out="${OUTPUT_DIR}" \
  44. "${PROTO_DIR}"/b.proto
  45. validate
  46. }
  47. one_at_a_time
  48. all_at_once