bundle-plugins-for-release.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. if [[ $# -lt 1 ]]; then
  26. echo "Usage: $0 RELEASE_VERSION"
  27. exit 1
  28. fi
  29. version=$1
  30. zipfile="protoc-grpc-swift-plugins-${version}.zip"
  31. # Where are we?
  32. here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
  33. # The root of the repo is just above us.
  34. root="${here}/.."
  35. # Make a staging area.
  36. stage=$(mktemp -d)
  37. stage_bin="${stage}/bin"
  38. mkdir -p "${stage_bin}"
  39. # Make the plugins.
  40. make -C "${root}" plugins
  41. # Copy them to the stage.
  42. cp "${root}/protoc-gen-grpc-swift" "${stage_bin}"
  43. cp "${root}/protoc-gen-swift" "${stage_bin}"
  44. # Copy the LICENSE to the stage.
  45. cp "${root}/LICENSE" "${stage}"
  46. # Zip it up.
  47. pushd "${stage}" || exit
  48. zip -r "${zipfile}" .
  49. popd || exit
  50. # Tell us where it is.
  51. echo "Created ${stage}/${zipfile}"