From fa63b38a1e0174f1ed3859fe1290f690e9b965ab Mon Sep 17 00:00:00 2001 From: Spencer Judge Date: Thu, 14 Jan 2021 18:42:41 -0800 Subject: [PATCH 1/2] Make autocomplete work with proto generated sources --- .gitignore | 4 ++++ build.rs | 1 + src/protos/mod.rs | 30 ++++++++++++++---------------- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index b20e1b0fc..e8609ab8c 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,7 @@ Cargo.lock /.idea/ *.iml + +# Ignore generated protobuf files +src/protos/*.rs +!src/protos/mod.rs diff --git a/build.rs b/build.rs index fedb297a6..750b9c8f5 100644 --- a/build.rs +++ b/build.rs @@ -4,6 +4,7 @@ fn main() -> Result<(), Box> { // Just build the message structs. .build_server(false) .build_client(false) + .out_dir("src/protos") .compile( &["protos/local/core_interface.proto"], &["protos/api_upstream", "protos/local"], diff --git a/src/protos/mod.rs b/src/protos/mod.rs index 63e376fc5..20404ce00 100644 --- a/src/protos/mod.rs +++ b/src/protos/mod.rs @@ -1,6 +1,4 @@ -pub mod coresdk { - tonic::include_proto!("coresdk"); -} +pub mod coresdk; // No need to lint these #[allow(clippy::all)] @@ -9,67 +7,67 @@ pub mod temporal { pub mod api { pub mod command { pub mod v1 { - tonic::include_proto!("temporal.api.command.v1"); + include!("temporal.api.command.v1.rs"); } } pub mod enums { pub mod v1 { - tonic::include_proto!("temporal.api.enums.v1"); + include!("temporal.api.enums.v1.rs"); } } pub mod failure { pub mod v1 { - tonic::include_proto!("temporal.api.failure.v1"); + include!("temporal.api.failure.v1.rs"); } } pub mod filter { pub mod v1 { - tonic::include_proto!("temporal.api.filter.v1"); + include!("temporal.api.filter.v1.rs"); } } pub mod common { pub mod v1 { - tonic::include_proto!("temporal.api.common.v1"); + include!("temporal.api.common.v1.rs"); } } pub mod history { pub mod v1 { - tonic::include_proto!("temporal.api.history.v1"); + include!("temporal.api.history.v1.rs"); } } pub mod namespace { pub mod v1 { - tonic::include_proto!("temporal.api.namespace.v1"); + include!("temporal.api.namespace.v1.rs"); } } pub mod query { pub mod v1 { - tonic::include_proto!("temporal.api.query.v1"); + include!("temporal.api.query.v1.rs"); } } pub mod replication { pub mod v1 { - tonic::include_proto!("temporal.api.replication.v1"); + include!("temporal.api.replication.v1.rs"); } } pub mod taskqueue { pub mod v1 { - tonic::include_proto!("temporal.api.taskqueue.v1"); + include!("temporal.api.taskqueue.v1.rs"); } } pub mod version { pub mod v1 { - tonic::include_proto!("temporal.api.version.v1"); + include!("temporal.api.version.v1.rs"); } } pub mod workflow { pub mod v1 { - tonic::include_proto!("temporal.api.workflow.v1"); + include!("temporal.api.workflow.v1.rs"); } } pub mod workflowservice { pub mod v1 { - tonic::include_proto!("temporal.api.workflowservice.v1"); + include!("temporal.api.workflowservice.v1.rs"); } } } From 93b000bd4ddf2afd67bfd04b03be80cefd04f857 Mon Sep 17 00:00:00 2001 From: Spencer Judge Date: Thu, 14 Jan 2021 18:52:53 -0800 Subject: [PATCH 2/2] Make cargo fmt happy --- src/protos/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/protos/mod.rs b/src/protos/mod.rs index 20404ce00..6b6014fea 100644 --- a/src/protos/mod.rs +++ b/src/protos/mod.rs @@ -1,4 +1,6 @@ -pub mod coresdk; +pub mod coresdk { + include!("coresdk.rs"); +} // No need to lint these #[allow(clippy::all)]