changed build method for proto and lib proto includes

This commit is contained in:
frelodev 2023-12-28 22:04:40 +01:00
parent b78775239f
commit ab982f4882
6 changed files with 23 additions and 17 deletions

View file

@ -1,8 +1,15 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
tonic_build::compile_protos("proto/model/cursor.proto")?;
tonic_build::compile_protos("proto/model/user.proto")?;
tonic_build::compile_protos("proto/buffer_service.proto")?;
tonic_build::compile_protos("proto/cursor_service.proto")?;
tonic_build::compile_protos("proto/workspace_service.proto")?;
tonic_build::configure()
.build_server(false)
.compile(
&[
"proto/model/cursor.proto",
"proto/model/user.proto",
"proto/buffer_service.proto",
"proto/cursor_service.proto",
"proto/workspace_service.proto"
],
&["proto", "proto", "proto","proto", "proto"]
)?;
Ok(())
}
}

View file

@ -1,8 +1,8 @@
syntax = "proto2";
package codemp.cursor_service;
import "proto/model/cursor.proto";
import "proto/model/user.proto";
import "model/cursor.proto";
import "model/user.proto";
// handle cursor events and broadcast to all users
service Cursor {

View file

@ -2,7 +2,7 @@ syntax = "proto2";
package codemp.model.cursor;
import "proto/model/user.proto";
import "model/user.proto";
// empty request
message MovedResponse {}

View file

@ -4,11 +4,7 @@ package codemp.model.user;
// payload identifying user
message UserIdentity {
message UserIdentity{
// user identifier
required string id = 1;
}
service User{
}

View file

@ -25,7 +25,7 @@
syntax = "proto2";
package codemp.workspace_service;
import "proto/model/user.proto";
import "model/user.proto";
message Empty {}

View file

@ -165,8 +165,11 @@ pub use woot;
#[cfg(feature = "proto")]
#[allow(non_snake_case)]
pub mod proto {
tonic::include_proto!("codemp.buffer");
tonic::include_proto!("codemp.cursor");
tonic::include_proto!("codemp.model.cursor");
tonic::include_proto!("codemp.model.user");
tonic::include_proto!("codemp.buffer_service");
tonic::include_proto!("codemp.cursor_service");
tonic::include_proto!("codemp.workspace_service");
}