Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Side by Side Diff: third_party/protobuf/objectivec/DevTools/check_version_stamps.sh

Issue 2590803003: Revert "third_party/protobuf: Update to HEAD (83d681ee2c)" (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/bin/bash -eu 1 #!/bin/bash
2 2
3 # This script checks that the runtime version number constant in the compiler 3 # This script checks that the runtime version number constant in the compiler
4 # source and in the runtime source is the same. 4 # source and in the runtime source is the same.
5 # 5 #
6 # A distro can be made of the protobuf sources with only a subset of the 6 # A distro can be made of the protobuf sources with only a subset of the
7 # languages, so if the compiler depended on the Objective C runtime, those 7 # languages, so if the compiler depended on the Objective C runtime, those
8 # builds would break. At the same time, we don't want the runtime source 8 # builds would break. At the same time, we don't want the runtime source
9 # depending on the compiler sources; so two copies of the constant are needed. 9 # depending on the compiler sources; so two copies of the constant are needed.
10 10
11 set -eu
12
11 readonly ScriptDir=$(dirname "$(echo $0 | sed -e "s,^\([^/]\),$(pwd)/\1,")") 13 readonly ScriptDir=$(dirname "$(echo $0 | sed -e "s,^\([^/]\),$(pwd)/\1,")")
12 readonly ProtoRootDir="${ScriptDir}/../.." 14 readonly ProtoRootDir="${ScriptDir}/../.."
13 15
14 die() { 16 die() {
15 echo "Error: $1" 17 echo "Error: $1"
16 exit 1 18 exit 1
17 } 19 }
18 20
19 readonly GeneratorSrc="${ProtoRootDir}/src/google/protobuf/compiler/objectivec/o bjectivec_file.cc" 21 readonly ConstantName=GOOGLE_PROTOBUF_OBJC_GEN_VERSION
22
23 # Collect version from plugin sources.
24
25 readonly PluginSrc="${ProtoRootDir}/src/google/protobuf/compiler/objectivec/obje ctivec_file.cc"
26 readonly PluginVersion=$( \
27 cat "${PluginSrc}" \
28 | sed -n -e "s:const int32 ${ConstantName} = \([0-9]*\);:\1:p"
29 )
30
31 if [[ -z "${PluginVersion}" ]] ; then
32 die "Failed to find ${ConstantName} in the plugin source (${PluginSrc})."
33 fi
34
35 # Collect version from runtime sources.
36
20 readonly RuntimeSrc="${ProtoRootDir}/objectivec/GPBBootstrap.h" 37 readonly RuntimeSrc="${ProtoRootDir}/objectivec/GPBBootstrap.h"
38 readonly RuntimeVersion=$( \
39 cat "${RuntimeSrc}" \
40 | sed -n -e "s:#define ${ConstantName} \([0-9]*\):\1:p"
41 )
21 42
22 check_constant() { 43 if [[ -z "${RuntimeVersion}" ]] ; then
23 local ConstantName="$1" 44 die "Failed to find ${ConstantName} in the runtime source (${RuntimeSrc})."
45 fi
24 46
25 # Collect version from generator sources. 47 # Compare them.
26 local GeneratorVersion=$( \
27 cat "${GeneratorSrc}" \
28 | sed -n -e "s:const int32 ${ConstantName} = \([0-9]*\);:\1:p"
29 )
30 if [[ -z "${GeneratorVersion}" ]] ; then
31 die "Failed to find ${ConstantName} in the generator source (${GeneratorSr c})."
32 fi
33 48
34 # Collect version from runtime sources. 49 if [[ "${PluginVersion}" != "${RuntimeVersion}" ]] ; then
35 local RuntimeVersion=$( \ 50 die "Versions don't match!
36 cat "${RuntimeSrc}" \ 51 Plugin: ${PluginVersion} from ${PluginSrc}
37 | sed -n -e "s:#define ${ConstantName} \([0-9]*\):\1:p" 52 Runtime: ${RuntimeVersion} from ${RuntimeSrc}
38 )
39 if [[ -z "${RuntimeVersion}" ]] ; then
40 die "Failed to find ${ConstantName} in the runtime source (${RuntimeSrc}). "
41 fi
42
43 # Compare them.
44 if [[ "${GeneratorVersion}" != "${RuntimeVersion}" ]] ; then
45 die "${ConstantName} values don't match!
46 Generator: ${GeneratorVersion} from ${GeneratorSrc}
47 Runtime: ${RuntimeVersion} from ${RuntimeSrc}
48 " 53 "
49 fi 54 fi
50 }
51
52 # Do the check.
53 check_constant GOOGLE_PROTOBUF_OBJC_VERSION
54 55
55 # Success 56 # Success
OLDNEW
« no previous file with comments | « third_party/protobuf/objectivec/.gitignore ('k') | third_party/protobuf/objectivec/DevTools/compile_testing_protos.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698