nabijaczleweli / cargo-update

A cargo subcommand for checking and applying updates to installed executables
MIT License
1.22k stars 42 forks source link

Use `sccache` when available #221

Open LeSnake04 opened 1 year ago

LeSnake04 commented 1 year ago

Sccache speeds up the install process by reusing existing compiled libraries.

I think it would be useful if this plugin checks whether sccache is installed and use it if available.

Using it works by setting RUSTC_WRAPPER=sccache.

nabijaczleweli commented 1 year ago

Sounds like you want to set that in the environment with the appropriate path, then, right? I don't see how cargo-update needs to (or can) be involved?

LeSnake04 commented 1 year ago

Yes, It works by setting the environment variable on each run. But its easy to forget to do that. And I dont want to do it via the global cargo config, since this would affect personal rust coding projects as well, which doesnt make sense IMO.

It would be nice if i could tell cargo-update to use it. And this could allow less expericenced users to make use of it just by installing it. Though maybe it makes sense to make it opt-in by adding cargo install-update-config --enable-sccache and cargo install-update-config --disable-sccache to avoid breaking stuff. Once its clear it doesnt break things make it enable when its available, similar to the cargo-binstall integration.

Also it would help a lot if there was a env vars option. These variable defined via e.g. cargo install-update-config --add-env RUSTC_WRAPPER sccache . This would also be quite useful for other config customizations users only want for updating cargo applications. The counterpart to remove it could look like this: cargo install-update-config --rm-env RUSTC_WRAPPER

alpha-tango-kilo commented 11 months ago

@LeSnake04 cargo install-update respects your ~/.cargo/config.toml, and you can configure sccache to be used in there like so:

[build]
rustc-wrapper = "/path/to/sccache"