Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check dev-dependencies for bevy/bevy-internal only in test builds #2262

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions crates/bevy_macro_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,17 @@ impl BevyManifest {
};

let deps = self.manifest.dependencies.as_ref();
let deps_dev = self.manifest.dev_dependencies.as_ref();

deps.and_then(find_in_deps)
.or_else(|| deps_dev.and_then(find_in_deps))
.unwrap_or_else(|| get_path(name))
let path = deps.and_then(find_in_deps);
Waridley marked this conversation as resolved.
Show resolved Hide resolved
#[cfg(test)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#[cfg(test)] is only set when the current crate is itself tested, not when any dependent crate is being tested.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RIP... I knew something had to be wrong with this approach. Any idea how to make this work, then?

Admittedly my specific use case is a bit of laziness, and not depending on bevy is saving me less as time goes on and I decide I want to use more of bevy's features... but this seems like something that might surprise other users...

let path = path.or_else(|| {
self.manifest
.dev_dependencies
.as_ref()
.and_then(find_in_deps)
});

path.unwrap_or_else(|| get_path(name))
}
}

Expand Down