fetch.sh 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/bash
  2. #
  3. # Copyright 2024, gRPC Authors All rights reserved.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. set -eu
  17. here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
  18. upstream="$here/upstream"
  19. # Create a temporary directory for the repo checkouts.
  20. checkouts="$(mktemp -d)"
  21. # Clone the grpc and google protos into the staging area.
  22. git clone --depth 1 https://github.com/grpc/grpc-proto "$checkouts/grpc-proto"
  23. git clone --depth 1 https://github.com/googleapis/googleapis.git "$checkouts/googleapis"
  24. # Remove the old protos.
  25. rm -rf "$upstream"
  26. # Create new directories to poulate. These are based on proto package name
  27. # rather than source repository name.
  28. mkdir -p "$upstream/google"
  29. mkdir -p "$upstream/grpc/testing"
  30. mkdir -p "$upstream/grpc/core"
  31. # Copy over the grpc-proto protos.
  32. cp -rp "$checkouts/grpc-proto/grpc/service_config" "$upstream/grpc/service_config"
  33. cp -rp "$checkouts/grpc-proto/grpc/lookup" "$upstream/grpc/lookup"
  34. cp -rp "$checkouts/grpc-proto/grpc/reflection" "$upstream/grpc/reflection"
  35. cp -rp "$checkouts/grpc-proto/grpc/examples" "$upstream/grpc/examples"
  36. cp -rp "$checkouts/grpc-proto/grpc/testing/benchmark_service.proto" "$upstream/grpc/testing/benchmark_service.proto"
  37. cp -rp "$checkouts/grpc-proto/grpc/testing/messages.proto" "$upstream/grpc/testing/messages.proto"
  38. cp -rp "$checkouts/grpc-proto/grpc/testing/worker_service.proto" "$upstream/grpc/testing/worker_service.proto"
  39. cp -rp "$checkouts/grpc-proto/grpc/testing/control.proto" "$upstream/grpc/testing/control.proto"
  40. cp -rp "$checkouts/grpc-proto/grpc/testing/payloads.proto" "$upstream/grpc/testing/payloads.proto"
  41. cp -rp "$checkouts/grpc-proto/grpc/testing/stats.proto" "$upstream/grpc/testing/stats.proto"
  42. cp -rp "$checkouts/grpc-proto/grpc/core/stats.proto" "$upstream/grpc/core/stats.proto"
  43. # Copy over the googleapis protos.
  44. mkdir -p "$upstream/google/rpc"
  45. cp -rp "$checkouts/googleapis/google/rpc/code.proto" "$upstream/google/rpc/code.proto"