rust-cross / cargo-zigbuild

Compile Cargo project with zig as linker
MIT License
1.35k stars 50 forks source link

feat: Avoid touching wrapper files when content is unchanged #242

Closed breezewish closed 3 months ago

breezewish commented 3 months ago

Fix https://github.com/rust-cross/cargo-zigbuild/issues/239

This PR simply adds a check for most wrapper writes: Try to read first, then write if the content should be changed.

Verified that ccache works across different builds for rust-rocksdb with the default config:

ccache --set-config=compiler_check=mtime # Default
[2024-04-16T13:44:19.059926 67945] Succeeded getting cached result
[2024-04-16T13:44:19.059943 67945] Result: direct_cache_hit
[2024-04-16T13:44:19.059944 67945] Result: local_storage_hit
[2024-04-16T13:44:19.059945 67945] Result: local_storage_read_hit
[2024-04-16T13:44:19.059946 67945] Result: local_storage_read_hit
messense commented 3 months ago

CI failures with zig master or Rust nightly is fine, we'll deal with it when new zig/Rust release is out.