2
0

fetch.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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/grpc"
  29. mkdir -p "$upstream/google"
  30. # Copy over the grpc-proto protos.
  31. cp -rp "$checkouts/grpc-proto/grpc/service_config" "$upstream/grpc/service_config"
  32. cp -rp "$checkouts/grpc-proto/grpc/lookup" "$upstream/grpc/lookup"
  33. cp -rp "$checkouts/grpc-proto/grpc/reflection" "$upstream/grpc/reflection"
  34. cp -rp "$checkouts/grpc-proto/grpc/examples" "$upstream/grpc/examples"
  35. # Copy over the googleapis protos.
  36. mkdir -p "$upstream/google/rpc"
  37. cp -rp "$checkouts/googleapis/google/rpc/code.proto" "$upstream/google/rpc/code.proto"