-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Add some more helpful errors to BevyManifest when it doesn't find Cargo.toml #9207
Add some more helpful errors to BevyManifest when it doesn't find Cargo.toml #9207
Conversation
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
When building Bevy using Bazel, you don't need a 'Cargo.toml'... except Bevy requires it currently. Hopefully this can help illuminate the requirement.
Looks good to me. Looks like this code exists only to make sure macros work with both It was added by #1875 (but the behavior predates it). IMO there are several saner approaches:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll go with the better error messages until we figure something better out.
Thanks for explaining this @nicopap. I was just starting to investigate its intended function to propose an alternative that works with all build systems. |
If you want to experiment, I would suggest:
we can merge this PR soon and you experiment in another, or you can experiment in this one, as you prefer |
Thanks @mockersf I will experiment in another branch and let this branch be merged/closed. 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @nicopap that this does seem like overkill for this particular use case. Though we should temper expectations here: given the status of alternative build systems in the Rust ecosystem, I don't think we should formally support them without including it in our CI in some way and making a commitment to ensuring Bevy's developer experience with them is up to par. With that said, improving compilation errors and accepting PRs for "best effort" support is definitely doable. Approved.
Thanks @james7132! I totally agree with you. My hope is only to address whatever amount of these quality of life issues that I can, within the constraint that it works for Cargo primarily as the defacto build system at the present time. |
When building Bevy using Bazel, you don't need a 'Cargo.toml'... except Bevy requires it currently. Hopefully this can help illuminate the requirement.
Objective
I recently started exploring Bazel and Buck2. Currently Bazel has some great advantages over Cargo for me and I was pretty happy to find that things generally work quite well!
Once I added a target to my test project that depended on bevy but didn't use Cargo, I didn't create a Cargo.toml file for it and things appeared to work, but as soon as I went to derive from Component the build failed with the cryptic error:
Solution
After poking around I realized that the proc macros in Bevy all use bevy_macro_utils::BevyManifest, which was attempting to load a Cargo manifest that doesn't exist.
This PR doesn't address the Cargo requirement (I'd love to see if there was a way to support more than Cargo transparently), but it does replace some calls to unwrap with expect and hopefully the error messages will be more helpful for other folks like me hoping to pat down a new trail: