Fix build

This commit is contained in:
Romain Ruetschi
2018-07-19 10:36:04 +01:00
parent c1bb633a8d
commit 0e8450098c
3 changed files with 15 additions and 7 deletions

View File

@ -2,7 +2,7 @@
extern crate protoc_rust;
#[cfg(feature = "serialization-protobuf")]
fn assert_protobuf_version(version: String) {
fn has_right_protoc_version(version: &str) -> bool {
use std::process::{Command, Stdio};
let protoc = Command::new("protoc")
.stdin(Stdio::null())
@ -11,12 +11,11 @@ fn assert_protobuf_version(version: String) {
.args(&["--version"])
.spawn()
.unwrap();
let version_output = protoc.wait_with_output().unwrap();
assert!(version_output.status.success());
assert_eq!(
String::from_utf8(version_output.stdout).unwrap().trim(),
version.trim()
);
String::from_utf8(version_output.stdout).unwrap().trim() == version.trim()
}
#[cfg(feature = "serialization-protobuf")]
@ -40,7 +39,16 @@ fn build_protobuf_schemata() {
version_pin
.read_to_string(&mut version_string)
.expect("cannot read protoc pin file");
assert_protobuf_version(version_string);
if !has_right_protoc_version(&version_string) {
eprintln!(
"Build failed because merkle.rs could not find: {}",
version_string
);
std::process::exit(1);
}
build_protobuf("src/proto", &["protobuf/proof.proto"], &[]);
}

View File

@ -1,3 +1,4 @@
ignore = [
"src/proto/mod.rs",
"src/proto/proof.rs",
]

View File

@ -146,7 +146,6 @@ impl<T> Proof<T> {
self.lemma.validate(self.algorithm)
}
}
/// A `Lemma` holds the hash of a node, the hash of its sibling node,