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

Pass cargo subcommand to build scripts #9394

Closed
shlevy opened this issue Apr 23, 2021 · 4 comments
Closed

Pass cargo subcommand to build scripts #9394

shlevy opened this issue Apr 23, 2021 · 4 comments
Labels
A-build-scripts Area: build.rs scripts C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@shlevy
Copy link

shlevy commented Apr 23, 2021

Describe the problem you are trying to solve
I'd like to have build scripts behave differently for different subcommands. For example, I'm using an external tool BNFC to generate a parser, and it has the ability to also generate a nice PDF describing the language, I'd like to generate that PDF only when running cargo doc.

Also would be nice to be able to distinguish cargo build and cargo build --tests
Describe the solution you'd like
Some env var passed from cargo to the build script.

@shlevy shlevy added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Apr 23, 2021
@Eh2406
Copy link
Contributor

Eh2406 commented Apr 27, 2021

In the current model, the build script may not even be rerun when switching between those commands. So it may need more changes than just an env var. On the other hand, your use case makes sense and I don't have a good suggestion for you at this time.

@ehuss ehuss added the A-build-scripts Area: build.rs scripts label May 20, 2021
@aviramha
Copy link
Contributor

aviramha commented Feb 5, 2022

Is it okay if I implement it?

@epage
Copy link
Contributor

epage commented Sep 20, 2023

See also #4001

@epage
Copy link
Contributor

epage commented Nov 1, 2023

Closing in favor of #4001. If there is a reason we should keep this open, let us know!

@epage epage closed this as not planned Won't fix, can't repro, duplicate, stale Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-build-scripts Area: build.rs scripts C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Projects
None yet
Development

No branches or pull requests

5 participants