diff --git a/.travis.yml b/.travis.yml index 8a9db40..315b140 100644 --- a/.travis.yml +++ b/.travis.yml @@ -75,4 +75,5 @@ script: before_install: - export PATH=$PATH:$HOME/protobuf/bin + - export PROTOC_VERSION=$(cat PROTOC_VERSION) - bash install_protobuf.sh diff --git a/PROTOC_VERSION b/PROTOC_VERSION new file mode 100644 index 0000000..b7708c4 --- /dev/null +++ b/PROTOC_VERSION @@ -0,0 +1 @@ +libprotoc 3.5.1 diff --git a/build.rs b/build.rs index 8bab568..2a54858 100644 --- a/build.rs +++ b/build.rs @@ -15,7 +15,8 @@ fn assert_protobuf_version(version: &str) { assert!(version_output.status.success()); assert_eq!( 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")] fn build_protobuf_schemata() { - assert_protobuf_version("libprotoc 3.5.1"); + assert_protobuf_version(env!("PROTOC_VERSION")); build_protobuf("src/proto", &["protobuf/proof.proto"], &[]); } diff --git a/install_protobuf.sh b/install_protobuf.sh index 0a1432a..8e4dd9f 100644 --- a/install_protobuf.sh +++ b/install_protobuf.sh @@ -2,11 +2,11 @@ set -e check_protoc_version () { - version="libprotoc $1" - PROTOC="$HOME/protobuf/bin/protoc" + PROTOC_VERSION=$(cat PROTOC_VERSION) + PROTOC="protoc" if [ -f $PROTOC ]; then this_version=`$PROTOC --version` - return `[ "$version" = "$this_version" ]` + return `[ "$PROTOC_VERSION" = "$this_version" ]` else return 1 fi