Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove extreneous image features and dependencies #1425

Merged
merged 7 commits into from
Feb 28, 2023
Merged
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
22 changes: 20 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,26 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: cargo deny
- name: cargo deny aarch64-apple-darwin check
uses: actions-rs/cargo@v1
with:
command: deny
args: --log-level=error check
args: --log-level=error --all-features --target aarch64-apple-darwin check

- name: cargo deny wasm32-unknown-unknown check
uses: actions-rs/cargo@v1
with:
command: deny
args: --log-level=error --all-features --target wasm32-unknown-unknown check

- name: cargo deny x86_64-pc-windows-msvc
uses: actions-rs/cargo@v1
with:
command: deny
args: --log-level=error --all-features --target x86_64-pc-windows-msvc check

- name: cargo deny x86_64-unknown-linux-musl check
uses: actions-rs/cargo@v1
with:
command: deny
args: --log-level=error --all-features --target x86_64-unknown-linux-musl check
123 changes: 4 additions & 119 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ epaint = "0.21.0"
glam = "0.22"
gltf = "1.1"
half = "2.0"
image = "0.24"
image = { version = "0.24", default-features = false }
lazy_static = "1.4"
macaw = "0.18"
mimalloc = "0.1.29"
Expand Down
56 changes: 2 additions & 54 deletions crates/re_log/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,58 +16,6 @@ pub use tracing::{debug, error, info, trace, warn};
// similar to how the log console in a browser will automatically suppress duplicates.
pub use log_once::{debug_once, error_once, info_once, trace_once, warn_once};

/// Set `RUST_LOG` environment variable to `info`, unless set,
/// and also set some other log levels on crates that are too loud.
#[cfg(not(target_arch = "wasm32"))]
fn set_default_rust_log_env() {
let mut rust_log = std::env::var("RUST_LOG").unwrap_or_else(|_| "info".to_owned());
mod setup;

const LOUD_CRATES: [&str; 7] = [
// wgpu crates spam a lot on info level, which is really annoying
// TODO(emilk): remove once https://github.com/gfx-rs/wgpu/issues/3206 is fixed
"naga",
"wgpu_core",
"wgpu_hal",
// These are quite spammy on debug, drowning out what we care about:
"h2",
"hyper",
"rustls",
"ureq",
];
for loud_crate in LOUD_CRATES {
if !rust_log.contains(&format!("{loud_crate}=")) {
rust_log += &format!(",{loud_crate}=warn");
}
}

std::env::set_var("RUST_LOG", rust_log);

if std::env::var("RUST_BACKTRACE").is_err() {
// Make sure we always produce backtraces for the (hopefully rare) cases when we crash!
std::env::set_var("RUST_BACKTRACE", "1");
}
}

#[cfg(not(target_arch = "wasm32"))]
pub fn setup_native_logging() {
set_default_rust_log_env();
tracing_subscriber::fmt::init(); // log to stdout
}

#[cfg(target_arch = "wasm32")]
fn default_web_log_filter() -> String {
"debug,naga=warn,wgpu_core=warn,wgpu_hal=warn".to_owned()
}

#[cfg(target_arch = "wasm32")]
pub fn setup_web_logging() {
use tracing_subscriber::layer::SubscriberExt as _;
tracing::subscriber::set_global_default(
tracing_subscriber::Registry::default()
.with(tracing_subscriber::EnvFilter::new(default_web_log_filter()))
.with(tracing_wasm::WASMLayer::new(
tracing_wasm::WASMLayerConfig::default(),
)),
)
.expect("Failed to set tracing subscriber.");
}
pub use setup::*;
57 changes: 57 additions & 0 deletions crates/re_log/src/setup.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
//! Function to setup logging in binaries and web apps.

/// Set `RUST_LOG` environment variable to `info`, unless set,
/// and also set some other log levels on crates that are too loud.
#[cfg(not(target_arch = "wasm32"))]
fn set_default_rust_log_env() {
let mut rust_log = std::env::var("RUST_LOG").unwrap_or_else(|_| "info".to_owned());

const LOUD_CRATES: [&str; 7] = [
// wgpu crates spam a lot on info level, which is really annoying
// TODO(emilk): remove once https://github.com/gfx-rs/wgpu/issues/3206 is fixed
"naga",
"wgpu_core",
"wgpu_hal",
// These are quite spammy on debug, drowning out what we care about:
"h2",
"hyper",
"rustls",
"ureq",
];
for loud_crate in LOUD_CRATES {
if !rust_log.contains(&format!("{loud_crate}=")) {
rust_log += &format!(",{loud_crate}=warn");
}
}

std::env::set_var("RUST_LOG", rust_log);

if std::env::var("RUST_BACKTRACE").is_err() {
// Make sure we always produce backtraces for the (hopefully rare) cases when we crash!
std::env::set_var("RUST_BACKTRACE", "1");
}
}

#[cfg(not(target_arch = "wasm32"))]
pub fn setup_native_logging() {
set_default_rust_log_env();
tracing_subscriber::fmt::init(); // log to stdout
}

#[cfg(target_arch = "wasm32")]
fn default_web_log_filter() -> String {
"debug,naga=warn,wgpu_core=warn,wgpu_hal=warn".to_owned()
}

#[cfg(target_arch = "wasm32")]
pub fn setup_web_logging() {
use tracing_subscriber::layer::SubscriberExt as _;
tracing::subscriber::set_global_default(
tracing_subscriber::Registry::default()
.with(tracing_subscriber::EnvFilter::new(default_web_log_filter()))
.with(tracing_wasm::WASMLayer::new(
tracing_wasm::WASMLayerConfig::default(),
)),
)
.expect("Failed to set tracing subscriber.");
}
1 change: 1 addition & 0 deletions crates/re_log_types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ ecolor = { workspace = true, optional = true }
glam = { workspace = true, optional = true }
image = { workspace = true, optional = true, default-features = false, features = [
"jpeg",
# "jpeg_rayon", # TODO(emilk): when https://github.com/rayon-rs/rayon/pull/1019 is released
] }
macaw = { workspace = true, optional = true }
rand = { version = "0.8", optional = true }
Expand Down
Loading