Use Separate Cargo Features for Debug 2D and 3D #118
Use Separate Cargo Features for Debug 2D and 3D #118
Conversation
Good catch, thanks. I realized recently that the model I use for cargo feature doesn't fly. And it especially bothers me that heron violates recomandations of the official cargo book: "features should be additive" and "Enabling a feature should not introduce a SemVer-incompatible change". I want to rework the features of heron to have only 2 features:
There wouldn't be any That means the usage will be as following:
That's the best slution I can propose so far. If you want to try it yourself in this PR you can. But you don't have to ;-). I'll try to find time this week to do this change. |
I think that sounds like a reasonable solution and much nicer. I might get to trying to do that, but I might not. Depends on what I get time for so if you beat me to it then I'll just let you do it. :) |
After some digging, I found that to achieve my vision I need a rust feature that isn't stable yet: https://doc.rust-lang.org/cargo/reference/unstable.html#weak-dependency-features For the time being it looks like we must indeed introduce I'll do some adjustements to your work and merge this PR. Thanks @zicklag ;-) |
@zicklag can you rebase your branch on my version of If the build pass with these changes, it'll be ready for merge :-) |
Sweet! Rebased and pushed. |
Head branch was pushed to by a user without write access
2ed5307
to
379db4e
Compare
Just pushed a commit to fix the clippy lint name that broke CI. |
Just pushed a change that further modifies the way features are handled so that none are default, 2d and 3d features must be enabled to pick one, but you can enable both ( aka. additive ) and it will just treat it as 3D and will compile and run fine. If you enable both, due to stable cargo limitations, it will still include the Not fully tested, but compiles and tests will run. Will test the demos tomorrow. |
Thanks @zicklag . I din't know |
9af5b5f
to
cf9b837
Compare
I had a bug in there that failed to enable debug rendering when the feature was supplied, just pushed a fix for that. All of the examples and tests should be working and passing now. |
cf9b837
to
4a00a35
Compare
Pushed a commit that should fix CI's complaints. |
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.
Looks good to me. Thank you very much @zicklag!
Yay! Thank you for heron! It's doing a great job so far. |
Currently, the heron crate doesn't expose anything unless either the 2D or 3D features are enabled, but enabling either of those features also enables the debug renderer. This makes it impossible to use heron without enabling the debug rendering crates.
My projects use Bevy Retrograde, which uses a custom renderer on top of Bevy that won't compile when bevy's rendering features are enabled. Because the debug crates require Bevy's rendering features, there's no combination of features under which I can compile heron for use in Bevy Retrograde.
This change makes it required to pass in the
debug-2d
ordebug-3d
features in order to actually include theheron_debug
. This allows me to run my project without including bevy's rendering features.I'm not sure this is the best way to do it and I'm totally open to any other options, as long as there is some way to compile without needing
heron_debug
.