Skip to content

Commit a08760b

Browse files
authored
Revert PR #15481 to resolve a regression. (#18567)
# Objective - Fixes #18010. ## Solution - Revert the offending PRs! These are #15481 and #18013. We now no longer get an error if there are duplicate subassets. - In theory we could untangle #18013 from #15481, but that may be tricky, and may still introduce regressions. To avoid this worry (since we're already in RC mode), I am just reverting both. ## Testing - This is just a revert. --- ## Migration Guide <Remove the migration guides for #15481 and #18013> I will make a PR to the bevy_website repo after this is merged.
1 parent 00a84d6 commit a08760b

File tree

11 files changed

+431
-486
lines changed

11 files changed

+431
-486
lines changed

crates/bevy_asset/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ trace = []
2222
bevy_app = { path = "../bevy_app", version = "0.16.0-dev" }
2323
bevy_asset_macros = { path = "macros", version = "0.16.0-dev" }
2424
bevy_ecs = { path = "../bevy_ecs", version = "0.16.0-dev" }
25-
bevy_log = { path = "../bevy_log", version = "0.16.0-dev" }
2625
bevy_reflect = { path = "../bevy_reflect", version = "0.16.0-dev", features = [
2726
"uuid",
2827
] }
@@ -80,6 +79,9 @@ bevy_reflect = { path = "../bevy_reflect", version = "0.16.0-dev", default-featu
8079
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
8180
notify-debouncer-full = { version = "0.5.0", optional = true }
8281

82+
[dev-dependencies]
83+
bevy_log = { path = "../bevy_log", version = "0.16.0-dev" }
84+
8385
[lints]
8486
workspace = true
8587

crates/bevy_asset/src/lib.rs

Lines changed: 3 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ mod tests {
670670
},
671671
loader::{AssetLoader, LoadContext},
672672
Asset, AssetApp, AssetEvent, AssetId, AssetLoadError, AssetLoadFailedEvent, AssetPath,
673-
AssetPlugin, AssetServer, Assets, DuplicateLabelAssetError, LoadState, UnapprovedPathMode,
673+
AssetPlugin, AssetServer, Assets, LoadState, UnapprovedPathMode,
674674
};
675675
use alloc::{
676676
boxed::Box,
@@ -726,8 +726,6 @@ mod tests {
726726
CannotLoadDependency { dependency: AssetPath<'static> },
727727
#[error("A RON error occurred during loading")]
728728
RonSpannedError(#[from] ron::error::SpannedError),
729-
#[error(transparent)]
730-
DuplicateLabelAssetError(#[from] DuplicateLabelAssetError),
731729
#[error("An IO error occurred during loading")]
732730
Io(#[from] std::io::Error),
733731
}
@@ -758,7 +756,7 @@ mod tests {
758756
.map_err(|_| Self::Error::CannotLoadDependency {
759757
dependency: dep.into(),
760758
})?;
761-
let cool = loaded.get_asset().get();
759+
let cool = loaded.get();
762760
embedded.push_str(&cool.text);
763761
}
764762
Ok(CoolText {
@@ -773,7 +771,7 @@ mod tests {
773771
.sub_texts
774772
.drain(..)
775773
.map(|text| load_context.add_labeled_asset(text.clone(), SubText { text }))
776-
.collect::<Result<Vec<_>, _>>()?,
774+
.collect(),
777775
})
778776
}
779777

@@ -1811,49 +1809,6 @@ mod tests {
18111809
app.world_mut().run_schedule(Update);
18121810
}
18131811

1814-
#[test]
1815-
fn fails_to_load_for_duplicate_subasset_labels() {
1816-
let mut app = App::new();
1817-
1818-
let dir = Dir::default();
1819-
dir.insert_asset_text(
1820-
Path::new("a.ron"),
1821-
r#"(
1822-
text: "b",
1823-
dependencies: [],
1824-
embedded_dependencies: [],
1825-
sub_texts: ["A", "A"],
1826-
)"#,
1827-
);
1828-
1829-
app.register_asset_source(
1830-
AssetSourceId::Default,
1831-
AssetSource::build()
1832-
.with_reader(move || Box::new(MemoryAssetReader { root: dir.clone() })),
1833-
)
1834-
.add_plugins((
1835-
TaskPoolPlugin::default(),
1836-
LogPlugin::default(),
1837-
AssetPlugin::default(),
1838-
));
1839-
1840-
app.init_asset::<CoolText>()
1841-
.init_asset::<SubText>()
1842-
.register_asset_loader(CoolTextLoader);
1843-
1844-
let asset_server = app.world().resource::<AssetServer>().clone();
1845-
let handle = asset_server.load::<CoolText>("a.ron");
1846-
1847-
run_app_until(&mut app, |_world| match asset_server.load_state(&handle) {
1848-
LoadState::Loading => None,
1849-
LoadState::Failed(err) => {
1850-
assert!(matches!(*err, AssetLoadError::AssetLoaderError(_)));
1851-
Some(())
1852-
}
1853-
state => panic!("Unexpected asset state: {state:?}"),
1854-
});
1855-
}
1856-
18571812
// This test is not checking a requirement, but documenting a current limitation. We simply are
18581813
// not capable of loading subassets when doing nested immediate loads.
18591814
#[test]

0 commit comments

Comments
 (0)