| 1 |
#!/bin/bash |
| 2 |
# Copyright 2019 gRPC authors. |
| 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 |
|
| 16 |
set -ex |
| 17 |
|
| 18 |
cd `dirname $0`/../.. |
| 19 |
|
| 20 |
# get the version of protobuf in /third_party/protobuf |
| 21 |
pushd third_party/protobuf |
| 22 |
|
| 23 |
version1=$(git describe --tags | cut -f 1 -d'-') |
| 24 |
v1=${version1:1} |
| 25 |
|
| 26 |
popd |
| 27 |
|
| 28 |
# get the version of protobuf in /src/objective-c/!ProtoCompiler.podspec |
| 29 |
v2=$(cat src/objective-c/\!ProtoCompiler.podspec | egrep "v = " | cut -f 2 -d"'") |
| 30 |
|
| 31 |
# get the version of protobuf in /src/objective-c/!ProtoCompiler-gRPCPlugin.podspec |
| 32 |
v3=$(cat src/objective-c/\!ProtoCompiler-gRPCPlugin.podspec | egrep 'dependency.*!ProtoCompiler' | cut -f 4 -d"'") |
| 33 |
|
| 34 |
# compare and emit error |
| 35 |
ret=0 |
| 36 |
if [ $v1 != $v2 ]; then |
| 37 |
echo 'Protobuf version in src/objective-c/!ProtoCompiler.podspec does not match protobuf version in third_party/protobuf.' |
| 38 |
ret=1 |
| 39 |
fi |
| 40 |
|
| 41 |
if [ $v1 != $v3 ]; then |
| 42 |
echo 'Protobuf version in src/objective-c/!ProtoCompiler-gRPCPlugin.podspec does not match protobuf version in third_party/protobuf.' |
| 43 |
ret=1 |
| 44 |
fi |
| 45 |
|
| 46 |
exit $ret |