From 6b02800e486a46e28d6bec79ba3ba94fe006e8c5 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Tue, 26 Sep 2023 10:30:35 +0300 Subject: [PATCH] chore(tvix/[ca]store): allow building without tonic-reflection - rename the feature to `tonic-reflection` in both tvix-store and tvix- castore. - set it to disabled in tvix-castore by default - enable it in tvix-store, and pull in tvix-castore with the feature enabled. Change-Id: Ie22833d85569502cae55812f6eeb17a9c15b9e2c Reviewed-on: https://cl.tvl.fyi/c/depot/+/9472 Autosubmit: flokli Tested-by: BuildkiteCI Reviewed-by: raitobezarius --- tvix/Cargo.nix | 11 ++++------- tvix/castore/Cargo.toml | 4 ++-- tvix/castore/build.rs | 2 +- tvix/castore/src/proto/mod.rs | 2 +- tvix/store/Cargo.toml | 4 ++-- tvix/store/build.rs | 2 +- tvix/store/src/bin/tvix-store.rs | 6 +++--- tvix/store/src/proto/mod.rs | 2 +- 8 files changed, 15 insertions(+), 18 deletions(-) diff --git a/tvix/Cargo.nix b/tvix/Cargo.nix index 130a89a1a..356c1e992 100644 --- a/tvix/Cargo.nix +++ b/tvix/Cargo.nix @@ -8405,11 +8405,9 @@ rec { } ]; features = { - "default" = [ "reflection" ]; - "reflection" = [ "tonic-reflection" ]; "tonic-reflection" = [ "dep:tonic-reflection" ]; }; - resolvedDefaultFeatures = [ "default" "reflection" "tonic-reflection" ]; + resolvedDefaultFeatures = [ "default" "tonic-reflection" ]; }; "tvix-cli" = rec { crateName = "tvix-cli"; @@ -8882,14 +8880,13 @@ rec { } ]; features = { - "default" = [ "fuse" "virtiofs" "reflection" ]; + "default" = [ "fuse" "virtiofs" "tonic-reflection" ]; "fs" = [ "dep:libc" "dep:fuse-backend-rs" ]; "fuse" = [ "fs" ]; - "reflection" = [ "tonic-reflection" ]; - "tonic-reflection" = [ "dep:tonic-reflection" ]; + "tonic-reflection" = [ "dep:tonic-reflection" "tvix-castore/tonic-reflection" ]; "virtiofs" = [ "fs" "dep:vhost" "dep:vhost-user-backend" "dep:virtio-queue" "dep:vm-memory" "dep:vmm-sys-util" "dep:virtio-bindings" "fuse-backend-rs?/vhost-user-fs" "fuse-backend-rs?/virtiofs" ]; }; - resolvedDefaultFeatures = [ "default" "fs" "fuse" "reflection" "tonic-reflection" "virtiofs" ]; + resolvedDefaultFeatures = [ "default" "fs" "fuse" "tonic-reflection" "virtiofs" ]; }; "typenum" = rec { crateName = "typenum"; diff --git a/tvix/castore/Cargo.toml b/tvix/castore/Cargo.toml index 5ad61d08b..3cf1355e7 100644 --- a/tvix/castore/Cargo.toml +++ b/tvix/castore/Cargo.toml @@ -37,5 +37,5 @@ tempfile = "3.3.0" tonic-mock = { git = "https://github.com/brainrake/tonic-mock", branch = "bump-dependencies" } [features] -default = ["reflection"] -reflection = ["tonic-reflection"] \ No newline at end of file +default = [] +tonic-reflection = ["dep:tonic-reflection"] \ No newline at end of file diff --git a/tvix/castore/build.rs b/tvix/castore/build.rs index 9f06c8833..339ba867d 100644 --- a/tvix/castore/build.rs +++ b/tvix/castore/build.rs @@ -4,7 +4,7 @@ fn main() -> Result<()> { #[allow(unused_mut)] let mut builder = tonic_build::configure(); - #[cfg(feature = "reflection")] + #[cfg(feature = "tonic-reflection")] { let out_dir = std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap()); let descriptor_path = out_dir.join("tvix.castore.v1.bin"); diff --git a/tvix/castore/src/proto/mod.rs b/tvix/castore/src/proto/mod.rs index 2a44383fd..0737f3f08 100644 --- a/tvix/castore/src/proto/mod.rs +++ b/tvix/castore/src/proto/mod.rs @@ -16,7 +16,7 @@ use crate::B3Digest; tonic::include_proto!("tvix.castore.v1"); -#[cfg(feature = "reflection")] +#[cfg(feature = "tonic-reflection")] /// Compiled file descriptors for implementing [gRPC /// reflection](https://github.com/grpc/grpc/blob/master/doc/server-reflection.md) with e.g. /// [`tonic_reflection`](https://docs.rs/tonic-reflection). diff --git a/tvix/store/Cargo.toml b/tvix/store/Cargo.toml index 202bae185..da3d23cb3 100644 --- a/tvix/store/Cargo.toml +++ b/tvix/store/Cargo.toml @@ -80,7 +80,7 @@ tempfile = "3.3.0" tonic-mock = { git = "https://github.com/brainrake/tonic-mock", branch = "bump-dependencies" } [features] -default = ["fuse", "virtiofs", "reflection"] +default = ["fuse", "virtiofs", "tonic-reflection"] fs = ["dep:libc", "dep:fuse-backend-rs"] virtiofs = [ "fs", @@ -94,4 +94,4 @@ virtiofs = [ "fuse-backend-rs?/virtiofs", ] fuse = ["fs"] -reflection = ["tonic-reflection"] +tonic-reflection = ["dep:tonic-reflection", "tvix-castore/tonic-reflection"] diff --git a/tvix/store/build.rs b/tvix/store/build.rs index 9a7356f84..cfeda5969 100644 --- a/tvix/store/build.rs +++ b/tvix/store/build.rs @@ -4,7 +4,7 @@ fn main() -> Result<()> { #[allow(unused_mut)] let mut builder = tonic_build::configure(); - #[cfg(feature = "reflection")] + #[cfg(feature = "tonic-reflection")] { let out_dir = std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap()); let descriptor_path = out_dir.join("tvix.store.v1.bin"); diff --git a/tvix/store/src/bin/tvix-store.rs b/tvix/store/src/bin/tvix-store.rs index e80014047..14b38da0a 100644 --- a/tvix/store/src/bin/tvix-store.rs +++ b/tvix/store/src/bin/tvix-store.rs @@ -33,9 +33,9 @@ use tvix_store::fs::fuse::FuseDaemon; #[cfg(feature = "virtiofs")] use tvix_store::fs::virtiofs::start_virtiofs_daemon; -#[cfg(feature = "reflection")] +#[cfg(feature = "tonic-reflection")] use tvix_castore::proto::FILE_DESCRIPTOR_SET as CASTORE_FILE_DESCRIPTOR_SET; -#[cfg(feature = "reflection")] +#[cfg(feature = "tonic-reflection")] use tvix_store::proto::FILE_DESCRIPTOR_SET; use clap::Parser; @@ -210,7 +210,7 @@ async fn main() -> Result<(), Box> { GRPCPathInfoServiceWrapper::from(path_info_service), )); - #[cfg(feature = "reflection")] + #[cfg(feature = "tonic-reflection")] { let reflection_svc = tonic_reflection::server::Builder::configure() .register_encoded_file_descriptor_set(CASTORE_FILE_DESCRIPTOR_SET) diff --git a/tvix/store/src/proto/mod.rs b/tvix/store/src/proto/mod.rs index 6924b023c..f2bec10f1 100644 --- a/tvix/store/src/proto/mod.rs +++ b/tvix/store/src/proto/mod.rs @@ -10,7 +10,7 @@ pub use grpc_pathinfoservice_wrapper::GRPCPathInfoServiceWrapper; tonic::include_proto!("tvix.store.v1"); -#[cfg(feature = "reflection")] +#[cfg(feature = "tonic-reflection")] /// Compiled file descriptors for implementing [gRPC /// reflection](https://github.com/grpc/grpc/blob/master/doc/server-reflection.md) with e.g. /// [`tonic_reflection`](https://docs.rs/tonic-reflection).