-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
100 lines (86 loc) · 3.02 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
extern crate tonic_build;
use std::fs;
fn main() {
let mut protos: Vec<String> = Vec::new();
let service_entries = fs::read_dir("./src/protos/aruna/api/storage/services/v2/").unwrap();
for entry in service_entries {
let dir = entry.unwrap();
let rel_path = format!(
"{}{}",
"./src/protos/aruna/api/storage/services/v2/",
dir.file_name().to_str().unwrap()
);
protos.push(rel_path);
}
let service_entries = fs::read_dir("./src/protos/aruna/api/notification/services/v2/").unwrap();
for entry in service_entries {
let dir = entry.unwrap();
let rel_path = format!(
"{}{}",
"./src/protos/aruna/api/notification/services/v2/",
dir.file_name().to_str().unwrap()
);
protos.push(rel_path);
}
let service_entries = fs::read_dir("./src/protos/aruna/api/dataproxy/services/v2/").unwrap();
for entry in service_entries {
let dir = entry.unwrap();
let rel_path = format!(
"{}{}",
"./src/protos/aruna/api/dataproxy/services/v2/",
dir.file_name().to_str().unwrap()
);
protos.push(rel_path);
}
let service_entries = fs::read_dir("./src/protos/aruna/api/hooks/services/v2/").unwrap();
for entry in service_entries {
let dir = entry.unwrap();
let rel_path = format!(
"{}{}",
"./src/protos/aruna/api/hooks/services/v2/",
dir.file_name().to_str().unwrap()
);
protos.push(rel_path);
}
let service_entries = fs::read_dir("./src/protos/aruna/api/health/v2/").unwrap();
for entry in service_entries {
let dir = entry.unwrap();
let rel_path = format!(
"{}{}",
"./src/protos/aruna/api/health/v2/",
dir.file_name().to_str().unwrap()
);
protos.push(rel_path);
}
tonic_build::configure()
.type_attribute(".", "#[derive(serde::Deserialize, serde::Serialize)]")
.compile_well_known_types(true)
.extern_path(".google.protobuf", "::prost_wkt_types")
.build_server(true)
.out_dir("./src/aruna")
.compile(
&protos,
&[
"./src/protos".to_string(),
"./src/protos/aruna/api/google".to_string(),
"./src/protos/aruna/api/protoc-gen-openapiv2".to_string(),
],
)
.unwrap();
tonic_build::configure()
.type_attribute(".", "#[derive(serde::Deserialize, serde::Serialize)]")
.compile_well_known_types(true)
.extern_path(".google.protobuf", "::prost_wkt_types")
.build_server(true)
.build_transport(false)
.out_dir("./src/aruna_no_transport")
.compile(
&protos,
&[
"./src/protos".to_string(),
"./src/protos/aruna/api/google".to_string(),
"./src/protos/aruna/api/protoc-gen-openapiv2".to_string(),
],
)
.unwrap();
}