-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
55 lines (48 loc) · 1.22 KB
/
build.rs
File metadata and controls
55 lines (48 loc) · 1.22 KB
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
fn main() -> Result<(), Box<dyn std::error::Error>> {
let server = cfg!(feature = "server");
let client = cfg!(feature = "client");
let transport = cfg!(any(feature = "server", feature = "client"));
#[allow(unused_mut)]
let mut builder = tonic_prost_build::configure();
#[cfg(feature = "serde")]
{
builder = builder
.type_attribute(".", "#[derive(serde::Serialize, serde::Deserialize)]");
}
#[cfg(feature = "lua")]
{
builder = builder
.message_attribute(".", "#[derive(mlua_serde_derive::LuaSerde)]");
}
#[cfg(feature = "java")]
{
builder = builder
.message_attribute(".", "#[jni_toolbox::jclass(package = \"mp.code.proto\")]");
}
#[cfg(feature = "js")]
{
builder = builder
.enum_attribute(".", "#[napi_derive::napi]")
.message_attribute(".", "#[napi_derive::napi(object)]");
}
#[cfg(feature = "py")]
{
builder = builder
.message_attribute(".", "#[pyo3::pyclass(get_all, from_py_object)]");
}
Ok(builder
.build_server(server)
.build_client(client)
.build_transport(transport)
.compile_protos(
&[
"proto/common.proto",
"proto/cursor.proto",
"proto/auth.proto",
"proto/session.proto",
"proto/workspace.proto",
"proto/buffer.proto",
],
&["proto"],
)?)
}