pin protoc version

This commit is contained in:
Ding Xiang Fei
2018-06-20 11:20:14 +08:00
committed by Romain Ruetschi
parent c0b013b2bf
commit 473ea4001c
4 changed files with 8 additions and 5 deletions

View File

@ -75,4 +75,5 @@ script:
before_install: before_install:
- export PATH=$PATH:$HOME/protobuf/bin - export PATH=$PATH:$HOME/protobuf/bin
- export PROTOC_VERSION=$(cat PROTOC_VERSION)
- bash install_protobuf.sh - bash install_protobuf.sh

1
PROTOC_VERSION Normal file
View File

@ -0,0 +1 @@
libprotoc 3.5.1

View File

@ -15,7 +15,8 @@ fn assert_protobuf_version(version: &str) {
assert!(version_output.status.success()); assert!(version_output.status.success());
assert_eq!( assert_eq!(
String::from_utf8(version_output.stdout).unwrap().trim(), String::from_utf8(version_output.stdout).unwrap().trim(),
version version.to_string().trim(),
"protoc version must be 3.5.1"
); );
} }
@ -32,7 +33,7 @@ fn build_protobuf(out_dir: &str, input: &[&str], includes: &[&str]) {
#[cfg(feature = "serialization-protobuf")] #[cfg(feature = "serialization-protobuf")]
fn build_protobuf_schemata() { fn build_protobuf_schemata() {
assert_protobuf_version("libprotoc 3.5.1"); assert_protobuf_version(env!("PROTOC_VERSION"));
build_protobuf("src/proto", &["protobuf/proof.proto"], &[]); build_protobuf("src/proto", &["protobuf/proof.proto"], &[]);
} }

View File

@ -2,11 +2,11 @@
set -e set -e
check_protoc_version () { check_protoc_version () {
version="libprotoc $1" PROTOC_VERSION=$(cat PROTOC_VERSION)
PROTOC="$HOME/protobuf/bin/protoc" PROTOC="protoc"
if [ -f $PROTOC ]; then if [ -f $PROTOC ]; then
this_version=`$PROTOC --version` this_version=`$PROTOC --version`
return `[ "$version" = "$this_version" ]` return `[ "$PROTOC_VERSION" = "$this_version" ]`
else else
return 1 return 1
fi fi