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 <gerry@linux.alibaba.com>
This commit is contained in:
Liu Jiang 2021-12-11 14:52:21 +08:00
parent 9d66917ce1
commit 8655b0ff41
4 changed files with 5 additions and 4 deletions

View File

@ -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"]

View File

@ -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"))]

View File

@ -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

View File

@ -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