5

Stabilize RUSTC_WORKSPACE_WRAPPER

 3 years ago
source link: https://github.com/rust-lang/cargo/pull/8976
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Contributor

ehuss commented 19 days ago

Of course!

Is this the right design?

I cannot think of anything particularly better.

This doesn't help with wrapping only specific crates

This has been resolved by adding CARGO_PRIMARY_PACKAGE in #8758. Wrappers can inspect that environment variable to determine if this is a root package, or some other dependency in the workspace. rust-lang/rust-clippy#6188 added --no-deps for clippy to make the choice explicit. This also resolved by concern about cargo clippy --fix in a large workspace.

RUSTC_WORKSPACE_WRAPPER doesn't currently work with sccache

I just tried, and it seems to work now. I'm not too familiar with sccache, and it has always been kinda flaky for me, so I'm not really sure if it can be used reliably, but it seems ok now.

Some tools may want to use arguments with the wrapper.

Cargo doesn't support passing arguments in any of the other wrapper env vars, so I'm not too concerned here. It would be difficult because otherwise they wouldn't allow spaces in filenames (a generally unsolved problem in Cargo). I think if that seems important, one option is to add some environment variable to detect when in wrapper mode. Another option would be to do something like TOML syntax (similar to -Zadvanced-env) to allow passing arguments with spaces.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK