bundle-plugins-for-release.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/bin/bash
  2. # Copyright 2020, 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. # This script bundles up the gRPC and Protobuf protoc plugins into a zip file
  17. # suitable for the 'gRPC-Swift-Plugins' CocoaPod.
  18. #
  19. # The contents of thie zip should look like this:
  20. #
  21. # ├── LICENSE
  22. # └── bin
  23. # ├── protoc-gen-grpc-swift
  24. # └── protoc-gen-swift
  25. #
  26. # Note: the name of the generated zip should match that expected by the
  27. # buid_podspecs.py script.
  28. if [[ $# -lt 1 ]]; then
  29. echo "Usage: $0 RELEASE_VERSION"
  30. exit 1
  31. fi
  32. version=$1
  33. zipfile="protoc-grpc-swift-plugins-${version}.zip"
  34. # Where are we?
  35. here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
  36. # The root of the repo is just above us.
  37. root="${here}/.."
  38. # Make a staging area.
  39. stage=$(mktemp -d)
  40. stage_bin="${stage}/bin"
  41. mkdir -p "${stage_bin}"
  42. # Make the plugins.
  43. make -C "${root}" plugins
  44. # Copy them to the stage.
  45. cp "${root}/protoc-gen-grpc-swift" "${stage_bin}"
  46. cp "${root}/protoc-gen-swift" "${stage_bin}"
  47. # Copy the LICENSE to the stage.
  48. cp "${root}/LICENSE" "${stage}"
  49. # Zip it up.
  50. pushd "${stage}" || exit
  51. zip -r "${zipfile}" .
  52. popd || exit
  53. # Tell us where it is.
  54. echo "Created ${stage}/${zipfile}"