-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Allow a build script (build.rs) in a virtual manifest Cargo.toml #8732
Comments
Could you describe more how this might work? When would this be built? What crates would have access to it? (etc) |
I'm looking at this from the user perspective, so I cannot answer these questions to the full extent.
Initially I guess that in addition to Unfortunately I cannot share more details about my use-case. |
This is a feature that I hope workspace could support. I would like to check rustc version in rust way with build.rs in workspace. |
I just ran into this. I have a workspace which includes crates and a ./doc directory. I want My motivations are as follows:
My guess is that this use of Separate from the issue of this ticket, there's a cargo documentation / usability problem here: I quickly skimmed the Cargo Reference Build Scripts section, and created a diagnostic / experiment (Extra detail for my specific project: The docs in |
I'm running into this issue right now. My use case is that I have a large workspace which contains different sets of crates. Some crates compile on systems with configuration Why is this important? Wasted time, and false compilation failures. Based on observation, it appears that If the workspace could have a N.B.: I know I can write a python script, or some other script to handle this outside of cargo, but that really feels counter to the Rust ethos... |
I would say this is correct. From my understanding, Having a “pre-build” hook mechanism looks fine in a locak workspace development. However, looking into it deeper some devils in the details.
These questions are more or less the same — how to verify a package can be built without being a workspace member. To be fair, today people already are able to write a build script that fails to build a package. We discourage this kind of use of build script. However, if there is a workspace-level pre-build hook, the situation might be worse. That being said, discussions about a workspace-level pre-build hook are pretty much welcome. More use cases can lead us to somewhere I believe.
Can
Is it possible to write an xtask as a workspace member, and run it like
Something like #11313 or #9650 might help? Or do you need a runtime detection? Then I'd also recommend xtask at this moment. |
Based on the complexity of the design work, and wanting more use cases, I am going to label them as @rustbot label +S-needs-info +E-hard. |
Describe the problem you are trying to solve
I have a package with several crates and "virtual"
Cargo.toml
(virtual manifest). I would like to execute some code before building this package or any containing crate. Currently it isn't allowed to havebuild.rs
in the virtual manifest.Describe the solution you'd like
Allow the
build
field to appear in the virtual manifest.Notes
As a workaround I have created an empty crate with build.rs and made all other crates depend on it.
The text was updated successfully, but these errors were encountered: