Skip to content

Commit 2fb33ee

Browse files
authored
Fix: enabling auth should not pull in all of re_viewer (#11350)
1 parent b7feaa7 commit 2fb33ee

File tree

4 files changed

+23
-29
lines changed

4 files changed

+23
-29
lines changed

crates/top/rerun/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ default = [
3636
]
3737

3838
## Support the `rerun auth` command
39-
auth = ["dep:re_viewer", "re_auth/cli"]
39+
auth = ["re_auth/cli"]
4040

4141
## Enable anonymized telemetry using our analytics SDK.
4242
analytics = [
@@ -105,6 +105,7 @@ perf_telemetry = [
105105
## Add support for the [`run()`] function, which acts like a main-function for a CLI,
106106
## acting the same as [the `rerun` binary](https://crates.io/crates/rerun-cli).
107107
run = [
108+
"auth",
108109
"clap",
109110
"dep:re_chunk_store",
110111
"dep:re_crash_handler",
@@ -113,7 +114,6 @@ run = [
113114
"re_log_encoding/encoder",
114115
"sdk",
115116
"unindent",
116-
"auth",
117117
]
118118

119119
## Embed the Rerun SDK & built-in types and re-export all of their public symbols.

crates/top/rerun/src/commands/auth.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use clap::{Parser, Subcommand};
2-
use re_viewer::AsyncRuntimeHandle;
32

43
#[derive(Debug, Clone, Subcommand)]
54
pub enum AuthCommands {
@@ -39,10 +38,8 @@ pub struct LoginCommand {
3938
pub struct TokenCommand {}
4039

4140
impl AuthCommands {
42-
pub fn run(&self, runtime: &AsyncRuntimeHandle) -> Result<(), re_auth::cli::Error> {
43-
let context = runtime
44-
.inner()
45-
.block_on(re_auth::workos::AuthContext::load())?;
41+
pub fn run(&self, runtime: &tokio::runtime::Handle) -> Result<(), re_auth::cli::Error> {
42+
let context = runtime.block_on(re_auth::workos::AuthContext::load())?;
4643

4744
match self {
4845
Self::Login(args) => {
@@ -51,12 +48,10 @@ impl AuthCommands {
5148
open_browser: !args.no_open_browser,
5249
force_login: args.force,
5350
};
54-
runtime
55-
.inner()
56-
.block_on(re_auth::cli::login(&context, options))
51+
runtime.block_on(re_auth::cli::login(&context, options))
5752
}
5853

59-
Self::Token(_) => runtime.inner().block_on(re_auth::cli::token(&context)),
54+
Self::Token(_) => runtime.block_on(re_auth::cli::token(&context)),
6055
}
6156
}
6257
}

crates/top/rerun/src/commands/entrypoint.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -627,11 +627,7 @@ where
627627
let res = if let Some(command) = args.command {
628628
match command {
629629
#[cfg(feature = "auth")]
630-
Command::Auth(cmd) => {
631-
let runtime =
632-
re_viewer::AsyncRuntimeHandle::new_native(tokio_runtime.handle().clone());
633-
cmd.run(&runtime).map_err(Into::into)
634-
}
630+
Command::Auth(cmd) => cmd.run(tokio_runtime.handle()).map_err(Into::into),
635631

636632
#[cfg(feature = "analytics")]
637633
Command::Analytics(analytics) => analytics.run().map_err(Into::into),

scripts/ci/rust_checks.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import subprocess
2929
import sys
3030
import time
31+
from functools import partial
3132
from glob import glob
3233
from typing import Callable
3334

@@ -262,6 +263,7 @@ def denied_sdk_deps(results: list[Result]) -> None:
262263
# They are ordered from "big to small" to make sure the bigger leaks are caught & reported first.
263264
# (e.g. `re_viewer` depends on `rfd` which is also disallowed, but if re_viewer is leaking, only report `re_viewer`)
264265
disallowed_dependencies = [
266+
"eframe",
265267
"re_viewer",
266268
"wgpu",
267269
"egui",
@@ -272,27 +274,28 @@ def denied_sdk_deps(results: list[Result]) -> None:
272274
"wayland-sys", # Linux windowing.
273275
]
274276

275-
def check_sdk_tree_with_default_features(tree_output: str) -> str | None:
277+
def check_sdk_tree_with_default_features(tree_output: str, features: str) -> str | None:
276278
for disallowed_dependency in disallowed_dependencies:
277279
if disallowed_dependency in tree_output:
278280
return (
279-
f"{disallowed_dependency} showed up in the SDK's dependency tree when building with default features. "
280-
"This dependency should only ever show up if the `run` feature is enabled. "
281+
f"{disallowed_dependency} showed up in the SDK's dependency tree when building with features={features}"
282+
"This dependency should only ever show up if the `native_viewer` feature is enabled. "
281283
f"Full dependency tree:\n{tree_output}"
282284
)
283285

284286
return None
285287

286-
for target in deny_targets:
287-
result = run_cargo(
288-
"tree",
289-
# -f '{lib}' is used here because otherwise cargo tree would print links to repositories of patched crates
290-
# which would cause false positives e.g. when checking for egui.
291-
f"-p rerun --target {target} -f '{{lib}}'",
292-
output_checks=check_sdk_tree_with_default_features,
293-
)
294-
result.command = f"Check dependencies in `{result.command}`"
295-
results.append(result)
288+
for features in ["default", "default,auth,oss_server,perf_telemetry,web_viewer"]:
289+
for target in deny_targets:
290+
result = run_cargo(
291+
"tree",
292+
# -f '{lib}' is used here because otherwise cargo tree would print links to repositories of patched crates
293+
# which would cause false positives e.g. when checking for egui.
294+
f"-p rerun --target {target} -f '{{lib}}' -F {features}",
295+
output_checks=partial(check_sdk_tree_with_default_features, features=features),
296+
)
297+
result.command = f"Check dependencies in `{result.command}`"
298+
results.append(result)
296299

297300

298301
def wasm(results: list[Result]) -> None:

0 commit comments

Comments
 (0)