-
Notifications
You must be signed in to change notification settings - Fork 15
/
build.rs
37 lines (34 loc) · 1.51 KB
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use std::{env, path::PathBuf};
extern crate tonic_build;
fn main() {
let reflection_descriptor =
PathBuf::from(env::var("OUT_DIR").unwrap()).join("mayastor_reflection.bin");
tonic_build::configure()
.file_descriptor_set_path(&reflection_descriptor)
.build_server(true)
.type_attribute(".", "#[derive(serde::Serialize, serde::Deserialize)]")
.extern_path(".google.protobuf.Timestamp", "::prost_wkt_types::Timestamp")
.compile(&["protobuf/mayastor.proto"], &["protobuf"])
.unwrap_or_else(|e| panic!("mayastor protobuf compilation failed: {}", e));
tonic_build::configure()
.file_descriptor_set_path(&reflection_descriptor)
.build_server(true)
.type_attribute(".", "#[derive(serde::Serialize, serde::Deserialize)]")
.extern_path(".google.protobuf.Timestamp", "::prost_wkt_types::Timestamp")
.extern_path(".google.protobuf.Duration", "::prost_wkt_types::Duration")
.compile(
&[
"protobuf/v1/bdev.proto",
"protobuf/v1/json.proto",
"protobuf/v1/pool.proto",
"protobuf/v1/replica.proto",
"protobuf/v1/host.proto",
"protobuf/v1/nexus.proto",
"protobuf/v1/registration.proto",
"protobuf/v1/snapshot.proto",
"protobuf/v1/test.proto",
],
&["protobuf/v1"],
)
.unwrap_or_else(|e| panic!("mayastor v1 protobuf compilation failed: {}", e));
}