mirror of
https://github.com/mii443/merkle.rs.git
synced 2025-08-22 16:05:30 +00:00
Fix build
This commit is contained in:
20
build.rs
20
build.rs
@ -2,7 +2,7 @@
|
|||||||
extern crate protoc_rust;
|
extern crate protoc_rust;
|
||||||
|
|
||||||
#[cfg(feature = "serialization-protobuf")]
|
#[cfg(feature = "serialization-protobuf")]
|
||||||
fn assert_protobuf_version(version: String) {
|
fn has_right_protoc_version(version: &str) -> bool {
|
||||||
use std::process::{Command, Stdio};
|
use std::process::{Command, Stdio};
|
||||||
let protoc = Command::new("protoc")
|
let protoc = Command::new("protoc")
|
||||||
.stdin(Stdio::null())
|
.stdin(Stdio::null())
|
||||||
@ -11,12 +11,11 @@ fn assert_protobuf_version(version: String) {
|
|||||||
.args(&["--version"])
|
.args(&["--version"])
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let version_output = protoc.wait_with_output().unwrap();
|
let version_output = protoc.wait_with_output().unwrap();
|
||||||
assert!(version_output.status.success());
|
assert!(version_output.status.success());
|
||||||
assert_eq!(
|
|
||||||
String::from_utf8(version_output.stdout).unwrap().trim(),
|
String::from_utf8(version_output.stdout).unwrap().trim() == version.trim()
|
||||||
version.trim()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "serialization-protobuf")]
|
#[cfg(feature = "serialization-protobuf")]
|
||||||
@ -40,7 +39,16 @@ fn build_protobuf_schemata() {
|
|||||||
version_pin
|
version_pin
|
||||||
.read_to_string(&mut version_string)
|
.read_to_string(&mut version_string)
|
||||||
.expect("cannot read protoc pin file");
|
.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"], &[]);
|
build_protobuf("src/proto", &["protobuf/proof.proto"], &[]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
ignore = [
|
ignore = [
|
||||||
|
"src/proto/mod.rs",
|
||||||
"src/proto/proof.rs",
|
"src/proto/proof.rs",
|
||||||
]
|
]
|
||||||
|
@ -146,7 +146,6 @@ impl<T> Proof<T> {
|
|||||||
|
|
||||||
self.lemma.validate(self.algorithm)
|
self.lemma.validate(self.algorithm)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A `Lemma` holds the hash of a node, the hash of its sibling node,
|
/// A `Lemma` holds the hash of a node, the hash of its sibling node,
|
||||||
|
Reference in New Issue
Block a user