-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
43 lines (41 loc) · 1.66 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
use std::{env, path::PathBuf};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let descriptor_path = PathBuf::from(env::var("OUT_DIR").unwrap()).join("ganymede.v2.bin");
tonic_build::configure()
.build_client(false)
.build_server(true)
.file_descriptor_set_path(descriptor_path)
.type_attribute(
"ganymede.v2.LightConfig",
"#[derive(serde::Serialize, serde::Deserialize)] #[serde(rename_all = \"camelCase\")]",
)
.type_attribute(
"ganymede.v2.Luminaire",
"#[derive(serde::Serialize, serde::Deserialize)] #[serde(rename_all = \"camelCase\")]",
)
.type_attribute(
"ganymede.v2.Luminaire.DailySchedule",
"#[derive(serde::Serialize, serde::Deserialize)] #[serde(rename_all = \"camelCase\")]",
)
.type_attribute(
"ganymede.v2.Time",
"#[derive(serde::Serialize, serde::Deserialize)] #[serde(rename_all = \"camelCase\")]",
)
.type_attribute(
"ganymede.v2.SensorConfig",
"#[derive(serde::Serialize, serde::Deserialize)] #[serde(rename_all = \"camelCase\")]",
)
.type_attribute(
"ganymede.v2.SensorConfig.sensor",
"#[derive(serde::Serialize, serde::Deserialize)] #[serde(rename_all = \"camelCase\")]",
)
.type_attribute(
"ganymede.v2.Am2320Config",
"#[derive(serde::Serialize, serde::Deserialize)] #[serde(rename_all = \"camelCase\")]",
)
.compile(
&["api/ganymede/v2/device.proto", "api/ganymede/v2/measurements.proto"],
&["api/"],
)?;
Ok(())
}