From 02b8516de03c3dc62922792bd45bd90b932215b1 Mon Sep 17 00:00:00 2001 From: jprochazk Date: Tue, 3 Dec 2024 14:04:39 +0100 Subject: [PATCH 1/9] pass through `--no-default-features` --- crates/build/re_dev_tools/src/build_web_viewer/lib.rs | 7 ++++++- crates/build/re_dev_tools/src/build_web_viewer/mod.rs | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/crates/build/re_dev_tools/src/build_web_viewer/lib.rs b/crates/build/re_dev_tools/src/build_web_viewer/lib.rs index 5014bb59fe01..3e33ca84d96e 100644 --- a/crates/build/re_dev_tools/src/build_web_viewer/lib.rs +++ b/crates/build/re_dev_tools/src/build_web_viewer/lib.rs @@ -74,6 +74,7 @@ pub fn build( debug_symbols: bool, target: Target, build_dir: &Utf8Path, + no_default_features: bool, features: &String, ) -> anyhow::Result<()> { std::env::set_current_dir(workspace_root())?; @@ -118,7 +119,11 @@ pub fn build( "--lib", "--target=wasm32-unknown-unknown", &format!("--target-dir={}", target_wasm_dir.as_str()), - "--no-default-features", + if no_default_features { + "--no-default-features" + } else { + "" + }, &format!("--features={features}"), ]); if profile == Profile::Release { diff --git a/crates/build/re_dev_tools/src/build_web_viewer/mod.rs b/crates/build/re_dev_tools/src/build_web_viewer/mod.rs index 1a1484c05e5f..1f4116066c4d 100644 --- a/crates/build/re_dev_tools/src/build_web_viewer/mod.rs +++ b/crates/build/re_dev_tools/src/build_web_viewer/mod.rs @@ -38,6 +38,10 @@ pub struct Args { /// comma-separated list of features to pass on to `re_viewer` #[argh(option, short = 'F', long = "features", default = "default_features()")] features: String, + + /// whether to exclude defualt features from `re_viewer` wasm build + #[argh(option, long = "no-default-features", default = "false")] + no_default_features: bool, } fn default_features() -> String { @@ -62,6 +66,7 @@ pub fn main(args: Args) -> anyhow::Result<()> { args.debug_symbols, args.target, &build_dir, + args.no_default_features, &args.features, ) } From 805465b176c79e32ba913389697a3faee29edc65 Mon Sep 17 00:00:00 2001 From: jprochazk Date: Tue, 3 Dec 2024 14:12:31 +0100 Subject: [PATCH 2/9] re-enable `map_view` feature for web viewer builds --- pixi.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pixi.toml b/pixi.toml index 703dce9c25e3..959014cf4273 100644 --- a/pixi.toml +++ b/pixi.toml @@ -175,13 +175,13 @@ rerun-web = { cmd = "cargo run --package rerun-cli --no-default-features --featu # # This installs the `wasm32-unknown-unknown` rust target if it's not already installed. # (this looks heavy but takes typically below 0.1s!) -rerun-build-web = "rustup target add wasm32-unknown-unknown && cargo run -p re_dev_tools -- build-web-viewer --features analytics,grpc --debug" +rerun-build-web = "rustup target add wasm32-unknown-unknown && cargo run -p re_dev_tools -- build-web-viewer --features analytics,grpc,map_view --debug" # Compile the web-viewer wasm and the cli. # # This installs the `wasm32-unknown-unknown` rust target if it's not already installed. # (this looks heavy but takes typically below 0.1s!) -rerun-build-web-cli = "rustup target add wasm32-unknown-unknown && cargo run -p re_dev_tools -- build-web-viewer --features analytics,grpc --debug && cargo build --package rerun-cli --no-default-features --features web_viewer" +rerun-build-web-cli = "rustup target add wasm32-unknown-unknown && cargo run -p re_dev_tools -- build-web-viewer --features analytics,grpc,map_view --debug && cargo build --package rerun-cli --no-default-features --features web_viewer" # Compile and run the web-viewer in release mode via rerun-cli. # @@ -197,7 +197,7 @@ rerun-web-release = { cmd = "cargo run --package rerun-cli --no-default-features # # This installs the `wasm32-unknown-unknown` rust target if it's not already installed. # (this looks heavy but takes typically below 0.1s!) -rerun-build-web-release = "rustup target add wasm32-unknown-unknown && cargo run -p re_dev_tools -- build-web-viewer --features analytics,grpc --release -g" +rerun-build-web-release = "rustup target add wasm32-unknown-unknown && cargo run -p re_dev_tools -- build-web-viewer --features analytics,grpc,map_view --release -g" rs-check = { cmd = "rustup target add wasm32-unknown-unknown && python scripts/ci/rust_checks.py", depends_on = [ "rerun-build-web", # The checks require the web viewer wasm to be around. From be4c4b9b88aeac049aedb57b765e9075f1ef15c5 Mon Sep 17 00:00:00 2001 From: jprochazk Date: Tue, 3 Dec 2024 14:14:00 +0100 Subject: [PATCH 3/9] add `map_view` back to js package --- rerun_js/web-viewer/build-wasm.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rerun_js/web-viewer/build-wasm.mjs b/rerun_js/web-viewer/build-wasm.mjs index 3e54e5020119..29b24f6be8a0 100644 --- a/rerun_js/web-viewer/build-wasm.mjs +++ b/rerun_js/web-viewer/build-wasm.mjs @@ -31,7 +31,8 @@ function buildWebViewer(mode) { "cargo run -p re_dev_tools -- build-web-viewer", modeFlags, "--target no-modules-base", - "--features grpc", + "--no-default-features", + "--features grpc,map_view", "-o rerun_js/web-viewer", ].join(" "), ); From 315790d30ffe04312dd4785ae51274de2bcc8152 Mon Sep 17 00:00:00 2001 From: jprochazk Date: Tue, 3 Dec 2024 14:15:35 +0100 Subject: [PATCH 4/9] oops --- crates/build/re_dev_tools/src/build_web_viewer/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/build/re_dev_tools/src/build_web_viewer/mod.rs b/crates/build/re_dev_tools/src/build_web_viewer/mod.rs index 1f4116066c4d..1ac616099902 100644 --- a/crates/build/re_dev_tools/src/build_web_viewer/mod.rs +++ b/crates/build/re_dev_tools/src/build_web_viewer/mod.rs @@ -39,7 +39,7 @@ pub struct Args { #[argh(option, short = 'F', long = "features", default = "default_features()")] features: String, - /// whether to exclude defualt features from `re_viewer` wasm build + /// whether to exclude default features from `re_viewer` wasm build #[argh(option, long = "no-default-features", default = "false")] no_default_features: bool, } From a6d963790cba6893ad71fe5f214b7caef84a97f1 Mon Sep 17 00:00:00 2001 From: jprochazk Date: Tue, 3 Dec 2024 14:20:24 +0100 Subject: [PATCH 5/9] fix arg passing --- .../build/re_dev_tools/src/build_web_viewer/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/build/re_dev_tools/src/build_web_viewer/lib.rs b/crates/build/re_dev_tools/src/build_web_viewer/lib.rs index 3e33ca84d96e..3a0973bc56bc 100644 --- a/crates/build/re_dev_tools/src/build_web_viewer/lib.rs +++ b/crates/build/re_dev_tools/src/build_web_viewer/lib.rs @@ -119,13 +119,13 @@ pub fn build( "--lib", "--target=wasm32-unknown-unknown", &format!("--target-dir={}", target_wasm_dir.as_str()), - if no_default_features { - "--no-default-features" - } else { - "" - }, - &format!("--features={features}"), ]); + if no_default_features { + cmd.arg("--no-default-features"); + } + if !features.is_empty() { + cmd.arg(&format!("--features={features}")); + } if profile == Profile::Release { cmd.arg("--release"); } From 37cd2dd60f00e5559584758d267344ac5fbff095 Mon Sep 17 00:00:00 2001 From: jprochazk Date: Tue, 3 Dec 2024 14:20:35 +0100 Subject: [PATCH 6/9] make `map_view` a default feature for `re_viewer` --- crates/viewer/re_viewer/Cargo.toml | 2 +- pixi.toml | 6 +++--- rerun_js/web-viewer/build-wasm.mjs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/viewer/re_viewer/Cargo.toml b/crates/viewer/re_viewer/Cargo.toml index c6783b229fb0..242e8d6a4c65 100644 --- a/crates/viewer/re_viewer/Cargo.toml +++ b/crates/viewer/re_viewer/Cargo.toml @@ -32,7 +32,7 @@ crate-type = ["cdylib", "rlib"] [features] -default = ["analytics"] +default = ["analytics", "map_view"] ## Enable telemetry using our analytics SDK. analytics = ["dep:re_analytics"] diff --git a/pixi.toml b/pixi.toml index 959014cf4273..703dce9c25e3 100644 --- a/pixi.toml +++ b/pixi.toml @@ -175,13 +175,13 @@ rerun-web = { cmd = "cargo run --package rerun-cli --no-default-features --featu # # This installs the `wasm32-unknown-unknown` rust target if it's not already installed. # (this looks heavy but takes typically below 0.1s!) -rerun-build-web = "rustup target add wasm32-unknown-unknown && cargo run -p re_dev_tools -- build-web-viewer --features analytics,grpc,map_view --debug" +rerun-build-web = "rustup target add wasm32-unknown-unknown && cargo run -p re_dev_tools -- build-web-viewer --features analytics,grpc --debug" # Compile the web-viewer wasm and the cli. # # This installs the `wasm32-unknown-unknown` rust target if it's not already installed. # (this looks heavy but takes typically below 0.1s!) -rerun-build-web-cli = "rustup target add wasm32-unknown-unknown && cargo run -p re_dev_tools -- build-web-viewer --features analytics,grpc,map_view --debug && cargo build --package rerun-cli --no-default-features --features web_viewer" +rerun-build-web-cli = "rustup target add wasm32-unknown-unknown && cargo run -p re_dev_tools -- build-web-viewer --features analytics,grpc --debug && cargo build --package rerun-cli --no-default-features --features web_viewer" # Compile and run the web-viewer in release mode via rerun-cli. # @@ -197,7 +197,7 @@ rerun-web-release = { cmd = "cargo run --package rerun-cli --no-default-features # # This installs the `wasm32-unknown-unknown` rust target if it's not already installed. # (this looks heavy but takes typically below 0.1s!) -rerun-build-web-release = "rustup target add wasm32-unknown-unknown && cargo run -p re_dev_tools -- build-web-viewer --features analytics,grpc,map_view --release -g" +rerun-build-web-release = "rustup target add wasm32-unknown-unknown && cargo run -p re_dev_tools -- build-web-viewer --features analytics,grpc --release -g" rs-check = { cmd = "rustup target add wasm32-unknown-unknown && python scripts/ci/rust_checks.py", depends_on = [ "rerun-build-web", # The checks require the web viewer wasm to be around. diff --git a/rerun_js/web-viewer/build-wasm.mjs b/rerun_js/web-viewer/build-wasm.mjs index 29b24f6be8a0..d96bf61068ca 100644 --- a/rerun_js/web-viewer/build-wasm.mjs +++ b/rerun_js/web-viewer/build-wasm.mjs @@ -32,7 +32,7 @@ function buildWebViewer(mode) { modeFlags, "--target no-modules-base", "--no-default-features", - "--features grpc,map_view", + "--features grpc", "-o rerun_js/web-viewer", ].join(" "), ); From d4de72d6ef8f833ae42d8b8488f39c8ba4b671b2 Mon Sep 17 00:00:00 2001 From: jprochazk Date: Tue, 3 Dec 2024 14:24:46 +0100 Subject: [PATCH 7/9] fix `no-default-features` arg --- crates/build/re_dev_tools/src/build_web_viewer/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/build/re_dev_tools/src/build_web_viewer/mod.rs b/crates/build/re_dev_tools/src/build_web_viewer/mod.rs index 1ac616099902..614f09f04d2f 100644 --- a/crates/build/re_dev_tools/src/build_web_viewer/mod.rs +++ b/crates/build/re_dev_tools/src/build_web_viewer/mod.rs @@ -40,7 +40,7 @@ pub struct Args { features: String, /// whether to exclude default features from `re_viewer` wasm build - #[argh(option, long = "no-default-features", default = "false")] + #[argh(switch, long = "no-default-features")] no_default_features: bool, } From 6d1b44b5ac08ced18562937eced61012f8f44841 Mon Sep 17 00:00:00 2001 From: jprochazk Date: Tue, 3 Dec 2024 14:26:58 +0100 Subject: [PATCH 8/9] add some missing features --- pixi.toml | 8 ++++---- rerun_js/web-viewer/build-wasm.mjs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pixi.toml b/pixi.toml index 703dce9c25e3..93d423976d6e 100644 --- a/pixi.toml +++ b/pixi.toml @@ -175,13 +175,13 @@ rerun-web = { cmd = "cargo run --package rerun-cli --no-default-features --featu # # This installs the `wasm32-unknown-unknown` rust target if it's not already installed. # (this looks heavy but takes typically below 0.1s!) -rerun-build-web = "rustup target add wasm32-unknown-unknown && cargo run -p re_dev_tools -- build-web-viewer --features analytics,grpc --debug" +rerun-build-web = "rustup target add wasm32-unknown-unknown && cargo run -p re_dev_tools -- build-web-viewer --no-default-features --features analytics,grpc,map_view --debug" # Compile the web-viewer wasm and the cli. # # This installs the `wasm32-unknown-unknown` rust target if it's not already installed. # (this looks heavy but takes typically below 0.1s!) -rerun-build-web-cli = "rustup target add wasm32-unknown-unknown && cargo run -p re_dev_tools -- build-web-viewer --features analytics,grpc --debug && cargo build --package rerun-cli --no-default-features --features web_viewer" +rerun-build-web-cli = "rustup target add wasm32-unknown-unknown && cargo run -p re_dev_tools -- build-web-viewer --no-default-features --features analytics,grpc,map_view --debug && cargo build --package rerun-cli --no-default-features --features web_viewer" # Compile and run the web-viewer in release mode via rerun-cli. # @@ -189,7 +189,7 @@ rerun-build-web-cli = "rustup target add wasm32-unknown-unknown && cargo run -p # # This installs the `wasm32-unknown-unknown` rust target if it's not already installed. # (this looks heavy but takes typically below 0.1s!) -rerun-web-release = { cmd = "cargo run --package rerun-cli --no-default-features --features web_viewer --release -- --web-viewer", depends_on = [ +rerun-web-release = { cmd = "cargo run --package rerun-cli --no-default-features --features web_viewer,map_view,grpc --release -- --web-viewer", depends_on = [ "rerun-build-web-release", ] } @@ -197,7 +197,7 @@ rerun-web-release = { cmd = "cargo run --package rerun-cli --no-default-features # # This installs the `wasm32-unknown-unknown` rust target if it's not already installed. # (this looks heavy but takes typically below 0.1s!) -rerun-build-web-release = "rustup target add wasm32-unknown-unknown && cargo run -p re_dev_tools -- build-web-viewer --features analytics,grpc --release -g" +rerun-build-web-release = "rustup target add wasm32-unknown-unknown && cargo run -p re_dev_tools -- build-web-viewer --no-default-features --features analytics,grpc,map_view --release -g" rs-check = { cmd = "rustup target add wasm32-unknown-unknown && python scripts/ci/rust_checks.py", depends_on = [ "rerun-build-web", # The checks require the web viewer wasm to be around. diff --git a/rerun_js/web-viewer/build-wasm.mjs b/rerun_js/web-viewer/build-wasm.mjs index d96bf61068ca..29b24f6be8a0 100644 --- a/rerun_js/web-viewer/build-wasm.mjs +++ b/rerun_js/web-viewer/build-wasm.mjs @@ -32,7 +32,7 @@ function buildWebViewer(mode) { modeFlags, "--target no-modules-base", "--no-default-features", - "--features grpc", + "--features grpc,map_view", "-o rerun_js/web-viewer", ].join(" "), ); From b7e8d58a4c95e438ca87839352865a1d73d8695c Mon Sep 17 00:00:00 2001 From: jprochazk Date: Tue, 3 Dec 2024 14:29:22 +0100 Subject: [PATCH 9/9] no analytics in npm package --- rerun_js/web-viewer/build-wasm.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rerun_js/web-viewer/build-wasm.mjs b/rerun_js/web-viewer/build-wasm.mjs index 29b24f6be8a0..f82292d847f5 100644 --- a/rerun_js/web-viewer/build-wasm.mjs +++ b/rerun_js/web-viewer/build-wasm.mjs @@ -32,7 +32,7 @@ function buildWebViewer(mode) { modeFlags, "--target no-modules-base", "--no-default-features", - "--features grpc,map_view", + "--features grpc,map_view", // no `analytics` "-o rerun_js/web-viewer", ].join(" "), );