Skip to content

Commit

Permalink
fix ambiguity between makefile tasks.
Browse files Browse the repository at this point in the history
fix log layer again
  • Loading branch information
Hellzbellz123 committed Nov 2, 2024
1 parent cd12438 commit bc0aa0f
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 16 deletions.
8 changes: 4 additions & 4 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,31 +41,31 @@ script.main = '''
'''

[tasks.run-native]
dependencies = ["copy-assets"]
dependencies = ["copy-crate-assets"]
cwd = "crates/desktop/"
workspace = false
description = ""
command = "cargo"
args = ["run", "--features=develop,dynamic"]

[tasks.run-web]
dependencies = ["copy-assets"]
dependencies = ["copy-crate-assets"]
cwd = "crates/wasm/"
workspace = false
description = ""
command = "trunk"
args = ["serve", "--open", "--features", "develop"]

[tasks.run-mobile]
dependencies = ["copy-assets"]
dependencies = ["copy-crate-assets"]
cwd = "crates/mobile/"
workspace = false
description = ""
condition.env_set = ["BUNDLETOOL_PATH", "ANDROID_NDK_ROOT", "JAVA_HOME"]
command = "cargo"
args = ["apk", "run", "--package=aspen_halls_mobile", "--features=develop"]

[tasks.copy-assets]
[tasks.copy-crate-assets]
workspace = false
script_runner = "@shell"
script.main = "echo 'refreshing desktop assets' && rm -rf crates/desktop/assets && cp -r assets crates/desktop/assets"
Expand Down
1 change: 1 addition & 0 deletions crates/aspenlib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,4 @@ bevy_mod_picking = { path = "../../deps/bevy_mod_picking/", default-features = f
"selection",
"highlight",
] }
tracing-subscriber = "0.3.18"
21 changes: 15 additions & 6 deletions crates/aspenlib/src/dev_tools/console/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use bevy::prelude::*;
use bevy_console::{AddConsoleCommand, ConsoleConfiguration, ConsolePlugin};
use bevy_console::{
AddConsoleCommand, ConsoleConfiguration, ConsolePlugin,
};
use tracing_subscriber::Registry;

/// holds definitions of commands
mod commands;
Expand Down Expand Up @@ -30,8 +33,14 @@ impl Plugin for QuakeConPlugin {
}
}

// TODO make a global subscriber that takes this line and prints it
// too a tab in the console page, 3 tabs, a repl like tab, cmds tab, and a log tab
// fn write_to_console(mut console_line: EventWriter<PrintConsoleLine>) {
// console_line.send(PrintConsoleLine::new("Hello".to_string()));
// }
/// initializes log capture too ingame console unless your on a wasm target
/// wasm doesnt support std:time and somewhere in the log chain its used, causing a crash.
pub fn init_log_layers(
app: &mut App,
) -> Option<Box<dyn tracing_subscriber::Layer<Registry> + Send + Sync>> {
if cfg!(not(target_family = "wasm")) {
bevy_console::make_layer(app)
} else {
None
}
}
9 changes: 5 additions & 4 deletions crates/aspenlib/src/loading/config/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
use std::sync::{Arc, Mutex};

use bevy_console::BevyLogBuffer;
use serde::{Deserialize, Serialize};

use bevy::{
Expand All @@ -10,6 +13,7 @@ use bevy_ecs_ldtk::assets::LdtkProject;
use bevy_framepace::{FramepaceSettings, Limiter};
use bevy_inspector_egui::prelude::*;
use bevy_kira_audio::{AudioChannel, AudioControl};
use tracing_subscriber::Registry;

use crate::{
game::audio::{AmbienceSoundChannel, GameSoundChannel, MusicSoundChannel},
Expand Down Expand Up @@ -232,10 +236,7 @@ pub fn create_configured_app(cfg_file: ConfigFile) -> App {
cfg_file.log_filter.unwrap_or_default()
},
level: bevy::log::Level::TRACE,
#[cfg(target_family = "wasm")]
custom_layer: None,
#[cfg(not(target_family = "wasm"))]
custom_layer: bevy_console::make_layer,
custom_layer: crate::dev_tools::console::init_log_layers
},
AssetPlugin {
file_path: "assets".to_string(),
Expand Down
4 changes: 2 additions & 2 deletions crates/desktop/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ run_task = { name = ["package-artifacts"] }

[tasks.package-artifacts]
private = true
dependencies = ["copy-assets", "copy-bin-windows", "copy-bin-linux"]
dependencies = ["copy-package-assets", "copy-bin-windows", "copy-bin-linux"]
workspace = false
run_task = { name = ["zip-artifacts"] }

Expand Down Expand Up @@ -49,7 +49,7 @@ script_runner = "@shell"
script.pre = "echo 'copying linux binary too package directory and stripping symbols'"
script.main = "cp ../../target/x86_64-unknown-linux-gnu/release/aspen_halls_desktop ../../package/desktop && strip ../../package/desktop/aspen_halls_desktop"

[tasks.copy-assets]
[tasks.copy-package-assets]
private = true
script_runner = "@shell"
script.pre = "echo 'copying game assets too package directory'"
Expand Down

0 comments on commit bc0aa0f

Please sign in to comment.