From f85b084d15979ae836775e4e7e90d897b3b04dc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Fri, 26 Apr 2024 12:49:02 +0200 Subject: [PATCH] can depend on subcrates --- Cargo.toml | 9 ++++++++- src/lib.rs | 14 ++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 129f8b0..9e07b0e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,14 @@ license = "MIT OR Apache-2.0" readme = "README.md" categories = ["game-development"] +[features] +default = ["bevy"] +subcrates = ["bevy_app", "bevy_log", "bevy_utils"] + [dependencies] sentry = "0.32.3" sentry-tracing = "0.32.3" -bevy = { version = "0.14.0-dev", git = "https://github.com/bevyengine/bevy", default-features = false } +bevy = { version = "0.14.0-dev", git = "https://github.com/bevyengine/bevy", default-features = false, optional = true } +bevy_app = { version = "0.14.0-dev", git = "https://github.com/bevyengine/bevy", default-features = false, optional = true } +bevy_log = { version = "0.14.0-dev", git = "https://github.com/bevyengine/bevy", default-features = false, optional = true } +bevy_utils = { version = "0.14.0-dev", git = "https://github.com/bevyengine/bevy", default-features = false, optional = true } diff --git a/src/lib.rs b/src/lib.rs index 9feb95f..fdd1337 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,6 +12,7 @@ use std::env; +#[cfg(all(feature = "bevy", not(feature = "subcrates")))] use bevy::{ app::App, log::{ @@ -24,6 +25,19 @@ use bevy::{ utils::tracing::{Event, Level, Subscriber}, }; +#[cfg(feature = "subcrates")] +use bevy_app::App; +#[cfg(feature = "subcrates")] +use bevy_log::{ + tracing_subscriber::{ + layer::{self, SubscriberExt}, + Layer, + }, + BoxedSubscriber, Level, +}; +#[cfg(feature = "subcrates")] +use bevy_utils::tracing::{Event, Subscriber}; + use sentry::ClientInitGuard; struct SentryLayer {