From 8655b0ff41ab2be4ea7cbffe0dcc78952d9be73f Mon Sep 17 00:00:00 2001 From: Liu Jiang Date: Sat, 11 Dec 2021 14:52:21 +0800 Subject: [PATCH] shim-client: make dependency on ttrpc-codegen as optional Now we have feature "generate_bindings" for shim-client, and crate ttrpc-codegen is used only when feature "generate_bindings" is enabled. So mark ttrpc-codegen as optional. Signed-off-by: Liu Jiang --- crates/shim-client/Cargo.toml | 4 ++-- crates/shim-client/build.rs | 1 + crates/shim-client/src/shim/events_ttrpc.rs | 2 +- crates/shim-client/src/shim/shim_ttrpc.rs | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/shim-client/Cargo.toml b/crates/shim-client/Cargo.toml index adbc910..f3ecc83 100644 --- a/crates/shim-client/Cargo.toml +++ b/crates/shim-client/Cargo.toml @@ -15,11 +15,11 @@ protobuf = "2.23.0" ttrpc = "0.5.2" [build-dependencies] -ttrpc-codegen = "0.2" +ttrpc-codegen = { version = "0.2", optional = true } [features] # In current implementation we check in all generated TTRPC code because of the following Rust limitations: # - `include!` doesn't handle well .rs files with attributes: https://github.com/rust-lang/rust/issues/18810 # - `cargo publish` will complain on modified `src` directory if it's modified from `build.rs` - https://github.com/rust-lang/cargo/issues/5073 # - There is now way to include the whole module from `OUT_DIR`, not just individual files. -generate_bindings = [] +generate_bindings = ["ttrpc-codegen"] diff --git a/crates/shim-client/build.rs b/crates/shim-client/build.rs index d2d8b07..dfaa457 100644 --- a/crates/shim-client/build.rs +++ b/crates/shim-client/build.rs @@ -19,6 +19,7 @@ use std::fs; use std::io::Write; use std::path::Path; +#[cfg(feature = "generate_bindings")] use ttrpc_codegen::{Codegen, ProtobufCustomize}; #[cfg(not(feature = "generate_bindings"))] diff --git a/crates/shim-client/src/shim/events_ttrpc.rs b/crates/shim-client/src/shim/events_ttrpc.rs index f7b66a9..ff29cbb 100644 --- a/crates/shim-client/src/shim/events_ttrpc.rs +++ b/crates/shim-client/src/shim/events_ttrpc.rs @@ -1,4 +1,4 @@ -// This file is generated by ttrpc-compiler 0.4.0. Do not edit +// This file is generated by ttrpc-compiler 0.4.1. Do not edit // @generated // https://github.com/Manishearth/rust-clippy/issues/702 diff --git a/crates/shim-client/src/shim/shim_ttrpc.rs b/crates/shim-client/src/shim/shim_ttrpc.rs index d5e0a44..51975de 100644 --- a/crates/shim-client/src/shim/shim_ttrpc.rs +++ b/crates/shim-client/src/shim/shim_ttrpc.rs @@ -1,4 +1,4 @@ -// This file is generated by ttrpc-compiler 0.4.0. Do not edit +// This file is generated by ttrpc-compiler 0.4.1. Do not edit // @generated // https://github.com/Manishearth/rust-clippy/issues/702