fetch.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 protos into the staging area.
  22. git clone --depth 1 https://github.com/grpc/grpc-proto "$checkouts/grpc-proto"
  23. # Remove the old protos.
  24. rm -rf "$upstream"
  25. # Create new directories to populate. These are based on proto package name
  26. # rather than source repository name.
  27. mkdir -p "$upstream/grpc/testing"
  28. mkdir -p "$upstream/grpc/core"
  29. # Copy over the grpc-proto protos.
  30. cp -rp "$checkouts/grpc-proto/grpc/testing/benchmark_service.proto" "$upstream/grpc/testing/benchmark_service.proto"
  31. cp -rp "$checkouts/grpc-proto/grpc/testing/messages.proto" "$upstream/grpc/testing/messages.proto"
  32. cp -rp "$checkouts/grpc-proto/grpc/testing/worker_service.proto" "$upstream/grpc/testing/worker_service.proto"
  33. cp -rp "$checkouts/grpc-proto/grpc/testing/control.proto" "$upstream/grpc/testing/control.proto"
  34. cp -rp "$checkouts/grpc-proto/grpc/testing/payloads.proto" "$upstream/grpc/testing/payloads.proto"
  35. cp -rp "$checkouts/grpc-proto/grpc/testing/stats.proto" "$upstream/grpc/testing/stats.proto"
  36. cp -rp "$checkouts/grpc-proto/grpc/core/stats.proto" "$upstream/grpc/core/stats.proto"