From 6a254093135efcef2e64c4a77d409deb5113862d Mon Sep 17 00:00:00 2001 From: Niklas Eicker Date: Wed, 1 Oct 2025 22:56:12 +0200 Subject: [PATCH 01/12] Update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31a5fb5..fbc7146 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +- support for Bevy 0.17 +- depend on Bevy subcrates ([@benfrankel](https://github.com/benfrankel) in [#256](https://github.com/NiklasEi/bevy_asset_loader/pull/256)) + ## v0.23.0 - 18.05.2024 - support for Bevy 0.16 - renamed `init_resource` to `finally_init_resource` to emphasize the difference to Bevy's `init_resource` From 071b933744c9efe4026b4d296e2a0ca7ceafdd34 Mon Sep 17 00:00:00 2001 From: Niklas Eicker Date: Thu, 2 Oct 2025 22:23:27 +0200 Subject: [PATCH 02/12] Install components and Bevy deps --- .github/actions/prepare/action.yaml | 7 ++++--- bevy_asset_loader/src/loading_state/config.rs | 12 ++++++------ .../tests/ui_with_2d_3d_features/enum.stderr | 10 +++++----- bevy_asset_loader_derive/src/assets.rs | 2 +- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.github/actions/prepare/action.yaml b/.github/actions/prepare/action.yaml index dfcbc7e..bfe02c2 100644 --- a/.github/actions/prepare/action.yaml +++ b/.github/actions/prepare/action.yaml @@ -20,10 +20,11 @@ runs: ~/.cargo/git/db/ target/ key: ${{inputs.cache-key}} - - uses: dtolnay/rust-toolchain@master + - uses: dtolnay/rust-toolchain@stable with: toolchain: stable - - name: Install alsa and udev + components: rustfmt, clippy + - name: Install Bevy dependencies shell: bash - run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev + run: sudo apt-get update; sudo apt-get install --no-install-recommends g++ pkg-config libx11-dev libasound2-dev libudev-dev libxkbcommon-x11-0 libwayland-dev libxkbcommon-dev if: runner.os == 'linux' diff --git a/bevy_asset_loader/src/loading_state/config.rs b/bevy_asset_loader/src/loading_state/config.rs index b36dae4..37b5989 100644 --- a/bevy_asset_loader/src/loading_state/config.rs +++ b/bevy_asset_loader/src/loading_state/config.rs @@ -66,8 +66,8 @@ pub trait ConfigureLoadingState { fn init_resource(self) -> Self; } -type SchedulConfig = ScheduleConfigs< - Box<(dyn bevy_ecs::system::System> + 'static)>, +type ScheduleConfig = ScheduleConfigs< + Box> + 'static>, >; /// Can be used to add new asset collections or similar configuration to a loading state. @@ -109,10 +109,10 @@ type SchedulConfig = ScheduleConfigs< pub struct LoadingStateConfig { state: S, - on_enter_loading_assets: Vec, - on_enter_loading_dynamic_asset_collections: Vec, - on_update: Vec, - on_enter_finalize: Vec, + on_enter_loading_assets: Vec, + on_enter_loading_dynamic_asset_collections: Vec, + on_update: Vec, + on_enter_finalize: Vec, dynamic_assets: HashMap>, } diff --git a/bevy_asset_loader/tests/ui_with_2d_3d_features/enum.stderr b/bevy_asset_loader/tests/ui_with_2d_3d_features/enum.stderr index 852209a..9ac58be 100644 --- a/bevy_asset_loader/tests/ui_with_2d_3d_features/enum.stderr +++ b/bevy_asset_loader/tests/ui_with_2d_3d_features/enum.stderr @@ -1,8 +1,8 @@ error: AssetCollection can only be derived for a struct - --> $DIR/enum.rs:7:1 - | -7 | / enum Test { -8 | | #[asset(path = "test.ogg")] -9 | | Asset(Handle) + --> tests/ui_with_2d_3d_features/enum.rs:7:1 + | + 7 | / enum Test { + 8 | | #[asset(path = "test.ogg")] + 9 | | Asset(Handle) 10 | | } | |_^ diff --git a/bevy_asset_loader_derive/src/assets.rs b/bevy_asset_loader_derive/src/assets.rs index 8bab34a..8acc74b 100644 --- a/bevy_asset_loader_derive/src/assets.rs +++ b/bevy_asset_loader_derive/src/assets.rs @@ -876,7 +876,7 @@ mod test { ..Default::default() }; - let asset = builder.build().expect_err("Should be pasing error"); + let asset = builder.build().expect_err("Should be parsing error"); assert!(variant_eq( asset.first().unwrap(), &ParseFieldError::PathAndPathsAreExclusive From 958574977cfc899d768ba50ad495aa43293fa54c Mon Sep 17 00:00:00 2001 From: Niklas Eicker Date: Thu, 2 Oct 2025 23:24:14 +0200 Subject: [PATCH 03/12] Fix trybuild output --- bevy_asset_loader/tests/ui_with_2d_3d_features/enum.stderr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bevy_asset_loader/tests/ui_with_2d_3d_features/enum.stderr b/bevy_asset_loader/tests/ui_with_2d_3d_features/enum.stderr index 9ac58be..b14afcd 100644 --- a/bevy_asset_loader/tests/ui_with_2d_3d_features/enum.stderr +++ b/bevy_asset_loader/tests/ui_with_2d_3d_features/enum.stderr @@ -1,6 +1,6 @@ error: AssetCollection can only be derived for a struct - --> tests/ui_with_2d_3d_features/enum.rs:7:1 - | + --> tests/ui_with_2d_3d_features/enum.rs:7:1 + | 7 | / enum Test { 8 | | #[asset(path = "test.ogg")] 9 | | Asset(Handle) From 4678a3f175c89def99357749f5ac6fb37a63dc7e Mon Sep 17 00:00:00 2001 From: mnmaita <47983254+mnmaita@users.noreply.github.com> Date: Fri, 3 Oct 2025 18:29:11 +0200 Subject: [PATCH 04/12] Updates bevy to 0.17.1 --- bevy_asset_loader/Cargo.toml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/bevy_asset_loader/Cargo.toml b/bevy_asset_loader/Cargo.toml index 8dec1f7..a369940 100644 --- a/bevy_asset_loader/Cargo.toml +++ b/bevy_asset_loader/Cargo.toml @@ -33,32 +33,32 @@ standard_dynamic_assets = ["dep:bevy_common_assets", "dep:serde"] progress_tracking = ["dep:iyes_progress"] [dependencies] -bevy_app = { version = "0.16.0", default-features = false } -bevy_asset = { version = "0.16.0", default-features = false } -bevy_ecs = { version = "0.16.0", default-features = false } -bevy_image = { version = "0.16.0", default-features = false, optional = true } -bevy_log = { version = "0.16.0", default-features = false } -bevy_math = { version = "0.16.0", default-features = false, optional = true } -bevy_pbr = { version = "0.16.0", default-features = false, optional = true } -bevy_platform = { version = "0.16.0", default-features = false } -bevy_reflect = { version = "0.16.0", default-features = false } -bevy_render = { version = "0.16.0", default-features = false, optional = true } -bevy_sprite = { version = "0.16.0", default-features = false, optional = true } -bevy_state = { version = "0.16.0", default-features = false } -bevy_utils = { version = "0.16.0", default-features = false } -bevy_asset_loader_derive = { version = "0.23.0", path = "../bevy_asset_loader_derive" } +bevy_app = { version = "0.17.1", default-features = false } +bevy_asset = { version = "0.17.1", default-features = false } +bevy_ecs = { version = "0.17.1", default-features = false } +bevy_image = { version = "0.17.1", default-features = false, optional = true } +bevy_log = { version = "0.17.1", default-features = false } +bevy_math = { version = "0.17.1", default-features = false, optional = true } +bevy_pbr = { version = "0.17.1", default-features = false, optional = true } +bevy_platform = { version = "0.17.1", default-features = false } +bevy_reflect = { version = "0.17.1", default-features = false } +bevy_render = { version = "0.17.1", default-features = false, optional = true } +bevy_sprite = { version = "0.17.1", default-features = false, optional = true } +bevy_state = { version = "0.17.1", default-features = false } +bevy_utils = { version = "0.17.1", default-features = false } +bevy_asset_loader_derive = { version = "0.24.0", path = "../bevy_asset_loader_derive" } anyhow = "1" path-slash = "0.2" -bevy_common_assets = { version = "0.13.0", features = ["ron"], optional = true } +bevy_common_assets = { version = "0.14.0", features = ["ron"], optional = true } serde = { version = "1", optional = true } iyes_progress = { version = "0.14.0", optional = true } [dev-dependencies] -bevy = { version = "0.16.0", features = ["vorbis"] } +bevy = { version = "0.17.1", features = ["vorbis"] } anyhow = "1" iyes_progress = { version = "0.14.0" } -bevy_common_assets = { version = "0.13.0", features = ["ron"] } +bevy_common_assets = { version = "0.14.0", features = ["ron"] } serde = { version = "1" } ron = "0.8.1" trybuild = { version = "1.0" } From 92f69b181bf4257569fb80ef1b40362e282c87da Mon Sep 17 00:00:00 2001 From: mnmaita <47983254+mnmaita@users.noreply.github.com> Date: Fri, 3 Oct 2025 18:29:22 +0200 Subject: [PATCH 05/12] Migrates code --- bevy_asset_loader/examples/asset_maps.rs | 2 +- .../examples/custom_dynamic_assets.rs | 2 +- bevy_asset_loader/examples/failure_state.rs | 2 +- bevy_asset_loader/examples/full_collection.rs | 2 +- .../examples/full_dynamic_collection.rs | 2 +- bevy_asset_loader/examples/progress_tracking.rs | 2 +- bevy_asset_loader/src/loading_state/config.rs | 14 ++++++-------- bevy_asset_loader/tests/can_run_with_sub_states.rs | 2 +- .../tests/can_run_without_next_state.rs | 2 +- .../tests/continues_to_failure_state.rs | 2 +- .../tests/continues_without_collection.rs | 2 +- bevy_asset_loader/tests/finally_init_resource.rs | 2 +- bevy_asset_loader/tests/mapped_path_use_slash.rs | 2 +- .../tests/multiple_asset_collections.rs | 2 +- bevy_asset_loader/tests/multiple_loading_states.rs | 2 +- bevy_asset_loader/tests/multiple_states.rs | 2 +- .../tests/reload_dynamic_asset_files.rs | 4 ++-- .../tests/same_collection_multiple_times.rs | 2 +- 18 files changed, 24 insertions(+), 26 deletions(-) diff --git a/bevy_asset_loader/examples/asset_maps.rs b/bevy_asset_loader/examples/asset_maps.rs index 1c117cc..e2a5dfd 100644 --- a/bevy_asset_loader/examples/asset_maps.rs +++ b/bevy_asset_loader/examples/asset_maps.rs @@ -45,7 +45,7 @@ struct AudioAssets { custom: HashMap>, } -fn use_audio_assets(audio_assets: Res, mut quit: EventWriter) { +fn use_audio_assets(audio_assets: Res, mut quit: MessageWriter) { audio_assets .full_path .get("audio/plop.ogg") diff --git a/bevy_asset_loader/examples/custom_dynamic_assets.rs b/bevy_asset_loader/examples/custom_dynamic_assets.rs index aec544d..d9806a8 100644 --- a/bevy_asset_loader/examples/custom_dynamic_assets.rs +++ b/bevy_asset_loader/examples/custom_dynamic_assets.rs @@ -2,7 +2,7 @@ use bevy::ecs::system::SystemState; use bevy::platform::collections::HashMap; use bevy::prelude::*; use bevy::reflect::TypePath; -use bevy::render::render_asset::RenderAssetUsages; +use bevy_asset::RenderAssetUsages; use bevy_asset_loader::prelude::*; use bevy_common_assets::ron::RonAssetPlugin; diff --git a/bevy_asset_loader/examples/failure_state.rs b/bevy_asset_loader/examples/failure_state.rs index 0ac8d20..35010b3 100644 --- a/bevy_asset_loader/examples/failure_state.rs +++ b/bevy_asset_loader/examples/failure_state.rs @@ -32,7 +32,7 @@ fn fail() { panic!("The library should have switched to the failure state!"); } -fn ok(mut quit: EventWriter) { +fn ok(mut quit: MessageWriter) { info!("As expected, bevy_asset_loader switched to the failure state"); info!("Quitting the application..."); quit.write(AppExit::Success); diff --git a/bevy_asset_loader/examples/full_collection.rs b/bevy_asset_loader/examples/full_collection.rs index 0e9a92b..c3f53f1 100644 --- a/bevy_asset_loader/examples/full_collection.rs +++ b/bevy_asset_loader/examples/full_collection.rs @@ -79,7 +79,7 @@ fn expectations( standard_materials: Res>, texture_atlas_layouts: Res>, images: Res>, - mut quit: EventWriter, + mut quit: MessageWriter, ) { info!("Done loading the collection. Checking expectations..."); diff --git a/bevy_asset_loader/examples/full_dynamic_collection.rs b/bevy_asset_loader/examples/full_dynamic_collection.rs index a0ca7ae..6a0176a 100644 --- a/bevy_asset_loader/examples/full_dynamic_collection.rs +++ b/bevy_asset_loader/examples/full_dynamic_collection.rs @@ -117,7 +117,7 @@ fn expectations( standard_materials: Res>, texture_atlas_layouts: Res>, images: Res>, - mut quit: EventWriter, + mut quit: MessageWriter, ) { info!("Done loading the collection. Checking expectations..."); diff --git a/bevy_asset_loader/examples/progress_tracking.rs b/bevy_asset_loader/examples/progress_tracking.rs index 124201f..87bacf4 100644 --- a/bevy_asset_loader/examples/progress_tracking.rs +++ b/bevy_asset_loader/examples/progress_tracking.rs @@ -91,7 +91,7 @@ fn expect( texture_assets: Res, asset_server: Res, texture_atlas_layouts: Res>, - mut quit: EventWriter, + mut quit: MessageWriter, ) { is_recursively_loaded(&audio_assets.background, &asset_server); is_recursively_loaded(&audio_assets.plop, &asset_server); diff --git a/bevy_asset_loader/src/loading_state/config.rs b/bevy_asset_loader/src/loading_state/config.rs index b36dae4..72e2171 100644 --- a/bevy_asset_loader/src/loading_state/config.rs +++ b/bevy_asset_loader/src/loading_state/config.rs @@ -12,8 +12,8 @@ use crate::loading_state::{ }; use bevy_app::App; use bevy_asset::Asset; +use bevy_ecs::system::BoxedSystem; use bevy_ecs::{ - error::BevyError, resource::Resource, schedule::{IntoScheduleConfigs, ScheduleConfigs}, world::FromWorld, @@ -66,9 +66,7 @@ pub trait ConfigureLoadingState { fn init_resource(self) -> Self; } -type SchedulConfig = ScheduleConfigs< - Box<(dyn bevy_ecs::system::System> + 'static)>, ->; +type ScheduleConfig = ScheduleConfigs; /// Can be used to add new asset collections or similar configuration to a loading state. /// ```edition2021 @@ -109,10 +107,10 @@ type SchedulConfig = ScheduleConfigs< pub struct LoadingStateConfig { state: S, - on_enter_loading_assets: Vec, - on_enter_loading_dynamic_asset_collections: Vec, - on_update: Vec, - on_enter_finalize: Vec, + on_enter_loading_assets: Vec, + on_enter_loading_dynamic_asset_collections: Vec, + on_update: Vec, + on_enter_finalize: Vec, dynamic_assets: HashMap>, } diff --git a/bevy_asset_loader/tests/can_run_with_sub_states.rs b/bevy_asset_loader/tests/can_run_with_sub_states.rs index a34965f..517414c 100644 --- a/bevy_asset_loader/tests/can_run_with_sub_states.rs +++ b/bevy_asset_loader/tests/can_run_with_sub_states.rs @@ -45,7 +45,7 @@ fn timeout(time: Res