Skip to content

Commit fb0e5c4

Browse files
authored
Fix failing proc macros when depending on bevy through dev and normal dependencies. (#17795)
This is a follow up fix for #17330 and fixes #17780. There was a logic error in the ambiguity detection of `cargo-manifest-proc-macros`. `cargo-manifest-proc-macros` now has a test for this case to prevent the issue in the future. I also opted to hard fail if the `cargo-manifest-proc-macros` crate fails. That way the error is more obvious and easier to fix and diagnose. ## Testing - The reproducer: bevyengine/bevy_editor_prototypes#178 works for me using these fixes.
1 parent fcc77fe commit fb0e5c4

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

crates/bevy_macro_utils/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ keywords = ["bevy"]
1212
syn = "2.0"
1313
quote = "1.0"
1414
proc-macro2 = "1.0"
15-
cargo-manifest-proc-macros = "0.3.3"
15+
cargo-manifest-proc-macros = "0.3.4"
1616

1717
[lints]
1818
workspace = true

crates/bevy_macro_utils/src/bevy_manifest.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ impl BevyManifest {
4848
/// Returns the path for the crate with the given name.
4949
pub fn get_path(&self, name: &str) -> syn::Path {
5050
self.maybe_get_path(name)
51-
//.expect("Failed to get path for crate")
52-
.unwrap_or_else(|_err| Self::parse_str(name))
51+
.expect("Failed to get path for crate")
5352
}
5453

5554
/// Attempt to parse the provided [path](str) as a [syntax tree node](syn::parse::Parse)

tests-integration/simple-ecs-test/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,10 @@
22
name = "simple-ecs-test"
33
edition = "2021"
44

5+
# We depend on bevy in both normal and dev dependencies to verify that the proc macros still work.
6+
57
[dependencies]
68
bevy = { path = "../../" }
9+
10+
[dev-dependencies]
11+
bevy = { path = "../../" }

0 commit comments

Comments
 (0)