rust-lang / cargo

The Rust package manager
https://doc.rust-lang.org/cargo
Apache License 2.0
12.87k stars 2.43k forks source link

Provide a means to know the freshness state of a set of paths from build.rs #8086

Open lu-zero opened 4 years ago

lu-zero commented 4 years ago

build.rs helpers such as cc-rs and nasm-rs get executed every time and that may slow down rebuilding quite a lot depending on the amount of assembly code a project has.

We already have a mean to tell cargo about foreign files, would be great to query back their state so if they are fresh isn't needed to build them again.

epage commented 1 year ago

If I'm understanding this correctly, the request problem is that a cargo detects that a build script needs to be re-run for some reason but the build script fills multiple roles and only part of it needs to be re-evaluated, so how do we do that?

For myself, I feel like providing a way to move away from monolithic build scripts would be a big help. This would also help with #5720 and #12552

lu-zero commented 1 year ago

The perfect solution would be to have a mean to have a mean to give cargo additional custom Units, then build.rs can be used just to declare them and cargo then can put them in the graph and process them accordingly.