generate.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/sh
  2. set -euo pipefail
  3. CURRENT_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  4. PLUGIN_SWIFT=../../.build/release/protoc-gen-swift
  5. PLUGIN_SWIFTGRPC=../../.build/release/protoc-gen-grpc-swift
  6. PROTO="src/proto/grpc/testing/test.proto"
  7. OUTPUT="Generated"
  8. FILE_NAMING="DropPath"
  9. VISIBILITY="Public"
  10. (cd "${CURRENT_SCRIPT_DIR}" && protoc "src/proto/grpc/testing/test.proto" \
  11. --plugin=${PLUGIN_SWIFT} \
  12. --plugin=${PLUGIN_SWIFTGRPC} \
  13. --swift_out=${OUTPUT} \
  14. --swift_opt=FileNaming=${FILE_NAMING},Visibility=${VISIBILITY} \
  15. --grpc-swift_out=${OUTPUT} \
  16. --grpc-swift_opt=FileNaming=${FILE_NAMING},Visibility=${VISIBILITY})
  17. (cd "${CURRENT_SCRIPT_DIR}" && protoc "src/proto/grpc/testing/empty.proto" \
  18. --plugin=${PLUGIN_SWIFT} \
  19. --plugin=${PLUGIN_SWIFTGRPC} \
  20. --swift_out=${OUTPUT} \
  21. --swift_opt=FileNaming=${FILE_NAMING},Visibility=${VISIBILITY} \
  22. --grpc-swift_out=${OUTPUT} \
  23. --grpc-swift_opt=FileNaming=${FILE_NAMING},Visibility=${VISIBILITY})
  24. (cd "${CURRENT_SCRIPT_DIR}" && protoc "src/proto/grpc/testing/messages.proto" \
  25. --plugin=${PLUGIN_SWIFT} \
  26. --plugin=${PLUGIN_SWIFTGRPC} \
  27. --swift_out=${OUTPUT} \
  28. --swift_opt=FileNaming=${FILE_NAMING},Visibility=${VISIBILITY} \
  29. --grpc-swift_out=${OUTPUT} \
  30. --grpc-swift_opt=FileNaming=${FILE_NAMING},Visibility=${VISIBILITY})
  31. # The generated code needs to be modified to support testing an unimplemented method.
  32. # On the server side, the generated code needs to be removed so the server has no
  33. # knowledge of it. Client code requires no modification, since it is required to call
  34. # the unimplemented method.
  35. (cd "${CURRENT_SCRIPT_DIR}" && patch -p3 < unimplemented_call.patch)