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

Unified Diff: third_party/protobuf/objectivec/DevTools/check_version_stamps.sh

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Make chrome settings proto generated file a component 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 side-by-side diff with in-line comments
Download patch
Index: third_party/protobuf/objectivec/DevTools/check_version_stamps.sh
diff --git a/third_party/protobuf/objectivec/DevTools/check_version_stamps.sh b/third_party/protobuf/objectivec/DevTools/check_version_stamps.sh
index 325b71dd9a296cbd7ac91e5c66cf51f478fdff19..1acbe2a2b7670ef8d47a4bc4ba9a588087bd9ec1 100755
--- a/third_party/protobuf/objectivec/DevTools/check_version_stamps.sh
+++ b/third_party/protobuf/objectivec/DevTools/check_version_stamps.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -eu
# This script checks that the runtime version number constant in the compiler
# source and in the runtime source is the same.
@@ -8,8 +8,6 @@
# builds would break. At the same time, we don't want the runtime source
# depending on the compiler sources; so two copies of the constant are needed.
-set -eu
-
readonly ScriptDir=$(dirname "$(echo $0 | sed -e "s,^\([^/]\),$(pwd)/\1,")")
readonly ProtoRootDir="${ScriptDir}/../.."
@@ -18,39 +16,40 @@ die() {
exit 1
}
-readonly ConstantName=GOOGLE_PROTOBUF_OBJC_GEN_VERSION
-
-# Collect version from plugin sources.
-
-readonly PluginSrc="${ProtoRootDir}/src/google/protobuf/compiler/objectivec/objectivec_file.cc"
-readonly PluginVersion=$( \
- cat "${PluginSrc}" \
- | sed -n -e "s:const int32 ${ConstantName} = \([0-9]*\);:\1:p"
-)
-
-if [[ -z "${PluginVersion}" ]] ; then
- die "Failed to find ${ConstantName} in the plugin source (${PluginSrc})."
-fi
-
-# Collect version from runtime sources.
-
+readonly GeneratorSrc="${ProtoRootDir}/src/google/protobuf/compiler/objectivec/objectivec_file.cc"
readonly RuntimeSrc="${ProtoRootDir}/objectivec/GPBBootstrap.h"
-readonly RuntimeVersion=$( \
- cat "${RuntimeSrc}" \
- | sed -n -e "s:#define ${ConstantName} \([0-9]*\):\1:p"
-)
-
-if [[ -z "${RuntimeVersion}" ]] ; then
- die "Failed to find ${ConstantName} in the runtime source (${RuntimeSrc})."
-fi
-
-# Compare them.
-if [[ "${PluginVersion}" != "${RuntimeVersion}" ]] ; then
- die "Versions don't match!
- Plugin: ${PluginVersion} from ${PluginSrc}
- Runtime: ${RuntimeVersion} from ${RuntimeSrc}
+check_constant() {
+ local ConstantName="$1"
+
+ # Collect version from generator sources.
+ local GeneratorVersion=$( \
+ cat "${GeneratorSrc}" \
+ | sed -n -e "s:const int32 ${ConstantName} = \([0-9]*\);:\1:p"
+ )
+ if [[ -z "${GeneratorVersion}" ]] ; then
+ die "Failed to find ${ConstantName} in the generator source (${GeneratorSrc})."
+ fi
+
+ # Collect version from runtime sources.
+ local RuntimeVersion=$( \
+ cat "${RuntimeSrc}" \
+ | sed -n -e "s:#define ${ConstantName} \([0-9]*\):\1:p"
+ )
+ if [[ -z "${RuntimeVersion}" ]] ; then
+ die "Failed to find ${ConstantName} in the runtime source (${RuntimeSrc})."
+ fi
+
+ # Compare them.
+ if [[ "${GeneratorVersion}" != "${RuntimeVersion}" ]] ; then
+ die "${ConstantName} values don't match!
+ Generator: ${GeneratorVersion} from ${GeneratorSrc}
+ Runtime: ${RuntimeVersion} from ${RuntimeSrc}
"
-fi
+ fi
+}
+
+# Do the check.
+check_constant GOOGLE_PROTOBUF_OBJC_VERSION
# Success
« 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