mirror of
https://github.com/mii443/merkle.rs.git
synced 2025-08-22 16:05:30 +00:00
read protoc version pin instead of reading from env vars
This commit is contained in:
committed by
Romain Ruetschi
parent
b4ee79f184
commit
51800be20c
13
build.rs
13
build.rs
@ -2,7 +2,7 @@
|
||||
extern crate protoc_rust;
|
||||
|
||||
#[cfg(feature = "serialization-protobuf")]
|
||||
fn assert_protobuf_version(version: &str) {
|
||||
fn assert_protobuf_version(version: String) {
|
||||
use std::process::{Command, Stdio};
|
||||
let protoc = Command::new("protoc")
|
||||
.stdin(Stdio::null())
|
||||
@ -15,8 +15,7 @@ fn assert_protobuf_version(version: &str) {
|
||||
assert!(version_output.status.success());
|
||||
assert_eq!(
|
||||
String::from_utf8(version_output.stdout).unwrap().trim(),
|
||||
version.to_string().trim(),
|
||||
"protoc version must be 3.5.1"
|
||||
version.trim()
|
||||
);
|
||||
}
|
||||
|
||||
@ -33,7 +32,13 @@ fn build_protobuf(out_dir: &str, input: &[&str], includes: &[&str]) {
|
||||
|
||||
#[cfg(feature = "serialization-protobuf")]
|
||||
fn build_protobuf_schemata() {
|
||||
assert_protobuf_version(env!("PROTOC_VERSION"));
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
let mut version_string = String::new();
|
||||
let mut version_pin =
|
||||
File::open("PROTOC_VERSION").expect("protoc version pin `PROTOC_VERSION` file is missing");
|
||||
version_pin.read_to_string(&mut version_string).expect("cannot read protoc pin file");
|
||||
assert_protobuf_version(version_string);
|
||||
build_protobuf("src/proto", &["protobuf/proof.proto"], &[]);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user