fetch.sh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. root="$here/../.."
  20. # Create a temporary directory for the repo checkouts.
  21. checkouts="$(mktemp -d)"
  22. # Clone the grpc and google protos into the staging area.
  23. git clone --depth 1 https://github.com/grpc/grpc-proto "$checkouts/grpc-proto"
  24. git clone --depth 1 https://github.com/googleapis/googleapis.git "$checkouts/googleapis"
  25. # Remove the old protos.
  26. rm -rf "$upstream"
  27. # Create new directories to poulate. These are based on proto package name
  28. # rather than source repository name.
  29. mkdir -p "$upstream/google"
  30. mkdir -p "$upstream/grpc/core"
  31. mkdir -p "$upstream/grpc/examples"
  32. # Copy over the grpc-proto protos.
  33. cp -rp "$checkouts/grpc-proto/grpc/service_config" "$upstream/grpc/service_config"
  34. cp -rp "$checkouts/grpc-proto/grpc/lookup" "$upstream/grpc/lookup"
  35. cp "$checkouts/grpc-proto/grpc/examples/helloworld.proto" "$upstream/grpc/examples/helloworld.proto"
  36. # Copy over the googleapis protos.
  37. mkdir -p "$upstream/google/rpc"
  38. cp -rp "$checkouts/googleapis/google/rpc/code.proto" "$upstream/google/rpc/code.proto"