forked from grpc/grpc-swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbundle-plugins-for-release.sh
executable file
·66 lines (54 loc) · 1.71 KB
/
bundle-plugins-for-release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
# Copyright 2020, gRPC Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -eu
# This script bundles up the gRPC and Protobuf protoc plugins into a zip file
# suitable for the 'gRPC-Swift-Plugins' CocoaPod.
#
# The contents of thie zip should look like this:
#
# ├── LICENSE
# └── bin
# ├── protoc-gen-grpc-swift
# └── protoc-gen-swift
#
# Note: the name of the generated zip should match that expected by the
# buid_podspecs.py script.
if [[ $# -lt 1 ]]; then
echo "Usage: $0 RELEASE_VERSION"
exit 1
fi
version=$1
zipfile="protoc-grpc-swift-plugins-${version}.zip"
# Where are we?
here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# The root of the repo is just above us.
root="${here}/.."
# Make a staging area.
stage=$(mktemp -d)
stage_bin="${stage}/bin"
mkdir -p "${stage_bin}"
# Make the plugins.
make -C "${root}" plugins
# Copy them to the stage.
cp "${root}/protoc-gen-grpc-swift" "${stage_bin}"
cp "${root}/protoc-gen-swift" "${stage_bin}"
# Copy the LICENSE to the stage.
cp "${root}/LICENSE" "${stage}"
# Zip it up.
pushd "${stage}" || exit
zip -r "${zipfile}" .
popd || exit
# Tell us where it is.
echo "Created ${stage}/${zipfile}"