fetch.sh 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 and google protos into the staging area.
  21. git clone --depth 1 https://github.com/grpc/grpc-proto "$checkouts/grpc-proto"
  22. git clone --depth 1 https://github.com/googleapis/googleapis.git "$checkouts/googleapis"
  23. # Remove the old protos.
  24. rm -rf "$upstream"
  25. # Create new directories to poulate. These are based on proto package name
  26. # rather than source repository name.
  27. mkdir -p "$upstream/google"
  28. mkdir -p "$upstream/grpc/core"
  29. mkdir -p "$upstream/grpc/examples"
  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 "$checkouts/grpc-proto/grpc/examples/helloworld.proto" "$upstream/grpc/examples/helloworld.proto"
  34. # Copy over the googleapis protos.
  35. mkdir -p "$upstream/google/rpc"
  36. cp -rp "$checkouts/googleapis/google/rpc/code.proto" "$upstream/google/rpc/code.proto"