Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
207 changes: 160 additions & 47 deletions Cargo.lock

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,10 @@ pollster = "0.4"
prettyplease = "0.2"
proc-macro2 = { version = "1.0", default-features = false }
profiling = { version = "1.0.12", default-features = false }
prost = "0.13.3"
prost-build = "0.13.3"
prost-types = "0.13.3"
prost-reflect = "0.15.3"
prost = "0.14.1"
prost-build = "0.14.1"
prost-types = "0.14.1"
prost-reflect = "0.16.1"
puffin = "0.19.1"
puffin_http = "0.16"
pyo3 = "0.24.1"
Expand Down Expand Up @@ -344,10 +344,11 @@ tokio = { version = "1.44.2", default-features = false }
tokio-stream = "0.1.16"
tokio-util = { version = "0.7.12", default-features = false }
toml = { version = "0.8.10", default-features = false }
tonic = { version = "0.13.1", default-features = false }
tonic-build = { version = "0.13.1", default-features = false }
tonic-web = "0.13.1"
tonic-web-wasm-client = "0.7.1"
tonic = { version = "0.14.2", default-features = false }
tonic-prost = { version = "0.14.2", default-features = false }
tonic-prost-build = { version = "0.14.2", default-features = false }
tonic-web = "0.14.2"
tonic-web-wasm-client = "0.8.0"
tower = "0.5"
tower-http = "0.6"
tower-service = "0.3"
Expand Down
5 changes: 1 addition & 4 deletions crates/build/re_protos_builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,4 @@ re_log = { workspace = true, features = ["setup"] }

# External
camino.workspace = true
tonic-build = { workspace = true, default-features = false, features = [
"prost",
] }
prost-build = { workspace = true }
tonic-prost-build = { workspace = true, default-features = false }
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ fn main() {
let mut proto_paths = std::fs::read_dir(definitions_dir_path.join(INPUT_V1ALPHA1_DIR))
.unwrap()
.map(|v| {
v.unwrap()
.path()
Utf8Path::from_path(&v.unwrap().path())
.unwrap()
.strip_prefix(&definitions_dir_path)
.unwrap()
.to_owned()
Expand All @@ -50,6 +50,6 @@ fn main() {
re_protos_builder::generate_rust_code(
definitions_dir_path,
&proto_paths,
rust_generated_output_dir_path,
&rust_generated_output_dir_path,
);
}
19 changes: 8 additions & 11 deletions crates/build/re_protos_builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,15 @@

#![allow(clippy::unwrap_used, clippy::exit)]

use std::path::Path;

/// Generate rust from protobuf definitions. We rely on `tonic_build` to do the heavy lifting.
/// `tonic_build` relies on `prost` which itself relies on `protoc`.
///
/// Note: make sure to invoke this via `pixi run codegen-protos` in order to use the right `protoc` version.
pub fn generate_rust_code(
definitions_dir: impl AsRef<Path>,
proto_paths: &[impl AsRef<Path>],
output_dir: impl AsRef<Path>,
) {
let mut prost_config = prost_build::Config::new();
pub fn generate_rust_code<P>(definitions_dir: P, proto_paths: &[P], output_dir: &P)
where
P: AsRef<std::path::Path>,
{
let mut prost_config = tonic_prost_build::Config::new();
prost_config.enable_type_names(); // tonic doesn't expose this option
prost_config.bytes([
".rerun.common.v1alpha1",
Expand All @@ -25,12 +22,12 @@ pub fn generate_rust_code(
".rerun.manifest_registry.v1alpha1",
]);

if let Err(err) = tonic_build::configure()
.out_dir(output_dir.as_ref())
if let Err(err) = tonic_prost_build::configure()
.out_dir(output_dir)
.build_client(true)
.build_server(true)
.build_transport(false) // Small convenience, but doesn't work on web
.compile_protos_with_config(prost_config, proto_paths, &[definitions_dir])
.compile_with_config(prost_config, proto_paths, &[definitions_dir])
{
match err.kind() {
std::io::ErrorKind::Other => {
Expand Down
7 changes: 2 additions & 5 deletions crates/store/re_protos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,19 @@ prost.workspace = true
pyo3 = { workspace = true, optional = true }
serde.workspace = true
thiserror.workspace = true
tonic-prost = { workspace = true, default-features = false }
url = { workspace = true, features = ["serde"] }

# Native dependencies:
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tonic = { workspace = true, default-features = false, features = [
"codegen",
"prost",
"transport",
] }

# Web dependencies:
[target.'cfg(target_arch = "wasm32")'.dependencies]
tonic = { workspace = true, default-features = false, features = [
"codegen",
"prost",
] }
tonic = { workspace = true, default-features = false, features = ["codegen"] }

[lints]
workspace = true
Loading
Loading