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