Skip to content

Commit 4e91a40

Browse files
authored
Add a script to generate a bundle of plugins for CocoaPods (#872)
Motivation: #869 adds a plugin containing the protoc binaries for CocoaPods. It relies on having a zip of the binaries in the tagged release. Modifications: - Add a script to generate a zip of the protoc binaries. Result: We can generate a bundle of plugins which may be pulled in by a CocoaPod.
1 parent 419b441 commit 4e91a40

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

scripts/bundle-plugins-for-release.sh

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

0 commit comments

Comments
 (0)