fetch.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/bash
  2. ## Copyright 2024, 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. upstream="$here/upstream"
  18. # Create a temporary directory for the repo checkouts.
  19. checkouts="$(mktemp -d)"
  20. # Clone the grpc protos into the staging area.
  21. git clone --depth 1 https://github.com/grpc/grpc-proto "$checkouts/grpc-proto"
  22. # Remove the old protos.
  23. rm -rf "$upstream"
  24. # Create new directories to populate. These are based on proto package name
  25. # rather than source repository name.
  26. mkdir -p "$upstream/grpc/testing"
  27. mkdir -p "$upstream/grpc/core"
  28. # Copy over the grpc-proto protos.
  29. cp -rp "$checkouts/grpc-proto/grpc/testing/benchmark_service.proto" "$upstream/grpc/testing/benchmark_service.proto"
  30. cp -rp "$checkouts/grpc-proto/grpc/testing/messages.proto" "$upstream/grpc/testing/messages.proto"
  31. cp -rp "$checkouts/grpc-proto/grpc/testing/worker_service.proto" "$upstream/grpc/testing/worker_service.proto"
  32. cp -rp "$checkouts/grpc-proto/grpc/testing/control.proto" "$upstream/grpc/testing/control.proto"
  33. cp -rp "$checkouts/grpc-proto/grpc/testing/payloads.proto" "$upstream/grpc/testing/payloads.proto"
  34. cp -rp "$checkouts/grpc-proto/grpc/testing/stats.proto" "$upstream/grpc/testing/stats.proto"
  35. cp -rp "$checkouts/grpc-proto/grpc/core/stats.proto" "$upstream/grpc/core/stats.proto"