From 30fdbd2a6a2187beffc1146cbe56ed36ce397ae9 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Wed, 16 Oct 2024 09:14:51 +0200 Subject: [PATCH] Revert "Show list of enabled feature with `rerun --version` (#7744)" This reverts commit 5325fd8d820af0855044d60142c4446004439700. --- Cargo.lock | 2 -- crates/build/re_build_info/src/build_info.rs | 9 ------- crates/build/re_build_info/src/lib.rs | 1 - crates/build/re_build_tools/src/lib.rs | 27 -------------------- crates/store/re_video/Cargo.toml | 4 --- crates/store/re_video/build.rs | 3 --- crates/store/re_video/src/lib.rs | 14 +++++++--- crates/top/rerun/src/commands/entrypoint.rs | 2 +- crates/utils/re_analytics/src/lib.rs | 2 -- crates/viewer/re_viewer/src/ui/rerun_menu.rs | 7 ----- 10 files changed, 12 insertions(+), 59 deletions(-) delete mode 100644 crates/store/re_video/build.rs diff --git a/Cargo.lock b/Cargo.lock index 455c68aa7eb71..ad9be37e7321c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5942,8 +5942,6 @@ dependencies = [ "indicatif", "itertools 0.13.0", "parking_lot", - "re_build_info", - "re_build_tools", "re_log", "re_mp4", "re_rav1d", diff --git a/crates/build/re_build_info/src/build_info.rs b/crates/build/re_build_info/src/build_info.rs index e81cc03dab014..55abb7290e60f 100644 --- a/crates/build/re_build_info/src/build_info.rs +++ b/crates/build/re_build_info/src/build_info.rs @@ -14,9 +14,6 @@ pub struct BuildInfo { /// `CARGO_PKG_NAME` pub crate_name: &'static str, - /// Space-separated names of all features enabled for this crate. - pub features: &'static str, - /// Crate version, parsed from `CARGO_PKG_VERSION`, ignoring any `+metadata` suffix. pub version: super::CrateVersion, @@ -77,7 +74,6 @@ impl std::fmt::Display for BuildInfo { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let Self { crate_name, - features, version, rustc_version, llvm_version, @@ -93,10 +89,6 @@ impl std::fmt::Display for BuildInfo { write!(f, "{crate_name} {version}")?; - if !features.is_empty() { - write!(f, " ({features})")?; - } - if let Some(rustc_version) = rustc_version { write!(f, " [{rustc_version}")?; if let Some(llvm_version) = llvm_version { @@ -155,7 +147,6 @@ impl CrateVersion { fn crate_version_from_build_info_string() { let build_info = BuildInfo { crate_name: "re_build_info", - features: "default extra", version: CrateVersion { major: 0, minor: 10, diff --git a/crates/build/re_build_info/src/lib.rs b/crates/build/re_build_info/src/lib.rs index d7b4208e6a76e..42501cd642438 100644 --- a/crates/build/re_build_info/src/lib.rs +++ b/crates/build/re_build_info/src/lib.rs @@ -15,7 +15,6 @@ macro_rules! build_info { () => { $crate::BuildInfo { crate_name: env!("CARGO_PKG_NAME"), - features: env!("RE_BUILD_FEATURES"), version: $crate::CrateVersion::parse(env!("CARGO_PKG_VERSION")), rustc_version: env!("RE_BUILD_RUSTC_VERSION"), llvm_version: env!("RE_BUILD_LLVM_VERSION"), diff --git a/crates/build/re_build_tools/src/lib.rs b/crates/build/re_build_tools/src/lib.rs index e7bd9f816660c..316e335f58aa8 100644 --- a/crates/build/re_build_tools/src/lib.rs +++ b/crates/build/re_build_tools/src/lib.rs @@ -194,11 +194,6 @@ pub fn export_build_info_vars_for_crate(crate_name: &str) { ); } } - - set_env( - "RE_BUILD_FEATURES", - &enabled_features_of(crate_name).unwrap().join(" "), - ); } /// ISO 8601 / RFC 3339 build time. @@ -278,25 +273,3 @@ fn rust_llvm_versions() -> anyhow::Result<(String, String)> { pub fn cargo_metadata() -> anyhow::Result { Ok(cargo_metadata::MetadataCommand::new().exec()?) } - -/// Returns a list of all the enabled features of the given package. -pub fn enabled_features_of(crate_name: &str) -> anyhow::Result> { - let metadata = cargo_metadata()?; - - let mut features = vec![]; - for package in &metadata.packages { - if package.name == crate_name { - for feature in package.features.keys() { - println!("Checking if feature is enabled: {feature:?}"); - let feature_in_screaming_snake_case = - feature.to_ascii_uppercase().replace('-', "_"); - if std::env::var(format!("CARGO_FEATURE_{feature_in_screaming_snake_case}")).is_ok() - { - features.push(feature.clone()); - } - } - } - } - - Ok(features) -} diff --git a/crates/store/re_video/Cargo.toml b/crates/store/re_video/Cargo.toml index 95d0d3e1d99c9..02035987964ce 100644 --- a/crates/store/re_video/Cargo.toml +++ b/crates/store/re_video/Cargo.toml @@ -37,7 +37,6 @@ nasm = [ [dependencies] -re_build_info.workspace = true re_log.workspace = true re_tracing.workspace = true @@ -62,9 +61,6 @@ dav1d = { workspace = true, optional = true, default-features = false, features [dev-dependencies] indicatif.workspace = true -[build-dependencies] -re_build_tools.workspace = true - [[example]] name = "frames" diff --git a/crates/store/re_video/build.rs b/crates/store/re_video/build.rs deleted file mode 100644 index f023d85ce55e7..0000000000000 --- a/crates/store/re_video/build.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - re_build_tools::export_build_info_vars_for_crate(env!("CARGO_PKG_NAME")); -} diff --git a/crates/store/re_video/src/lib.rs b/crates/store/re_video/src/lib.rs index d38a194da8c99..b007518fb2f48 100644 --- a/crates/store/re_video/src/lib.rs +++ b/crates/store/re_video/src/lib.rs @@ -13,7 +13,15 @@ pub use self::{ time::{Time, Timescale}, }; -/// Returns information about this crate -pub fn build_info() -> re_build_info::BuildInfo { - re_build_info::build_info!() +/// Which features was this crate compiled with? +pub fn features() -> Vec<&'static str> { + // TODO(emilk): is there a helper crate for this? + let mut features = vec![]; + if cfg!(feature = "av1") { + features.push("av1"); + } + if cfg!(feature = "nasm") { + features.push("nasm"); + } + features } diff --git a/crates/top/rerun/src/commands/entrypoint.rs b/crates/top/rerun/src/commands/entrypoint.rs index 029b8f137d1a2..6fe9e16c5b05e 100644 --- a/crates/top/rerun/src/commands/entrypoint.rs +++ b/crates/top/rerun/src/commands/entrypoint.rs @@ -553,7 +553,7 @@ where if args.version { println!("{build_info}"); - println!("Video features: {}", re_video::build_info().features); + println!("Video features: {}", re_video::features().join(" ")); return Ok(0); } diff --git a/crates/utils/re_analytics/src/lib.rs b/crates/utils/re_analytics/src/lib.rs index a0a10c8e7b0df..99dd49fc573bd 100644 --- a/crates/utils/re_analytics/src/lib.rs +++ b/crates/utils/re_analytics/src/lib.rs @@ -345,7 +345,6 @@ impl Properties for re_build_info::BuildInfo { let git_hash = self.git_hash_or_tag(); let Self { crate_name: _, - features, version, rustc_version, llvm_version, @@ -356,7 +355,6 @@ impl Properties for re_build_info::BuildInfo { datetime, } = self; - event.insert("features", features); event.insert("git_hash", git_hash); event.insert("rerun_version", version.to_string()); event.insert("rust_version", rustc_version); diff --git a/crates/viewer/re_viewer/src/ui/rerun_menu.rs b/crates/viewer/re_viewer/src/ui/rerun_menu.rs index 6143c70428e9c..5d75274b4a496 100644 --- a/crates/viewer/re_viewer/src/ui/rerun_menu.rs +++ b/crates/viewer/re_viewer/src/ui/rerun_menu.rs @@ -114,7 +114,6 @@ impl App { fn about_rerun_ui(&self, frame: &eframe::Frame, ui: &mut egui::Ui) { let re_build_info::BuildInfo { crate_name, - features, version, rustc_version, llvm_version, @@ -139,12 +138,6 @@ impl App { {target_triple}" ); - // It is really the features of `rerun-cli` (the `rerun` binary) that are interesting. - // For the web-viewer we get `crate_name: "re_viewer"` here, which is much less interesting. - if crate_name == "rerun-cli" && !features.is_empty() { - label += &format!("\n{crate_name} features: {features}"); - } - if !rustc_version.is_empty() { label += &format!("\nrustc {rustc_version}"); if !llvm_version.is_empty() {