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

Add support for caching target json specs for Rust compilation. #2269

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ColinFinck
Copy link

This has been implemented in a backward-compatible way:

  • --target arguments specifying target names are still passed as arguments just like before.
  • --target arguments specifying a json file path have previously not been cached at all. The json file is now hashed like other external file dependencies.

Fixes #2174

@sylvestre
Copy link
Collaborator

Could you please add a test here to make sure we don't regress?
https://github.com/mozilla/sccache/blob/main/.github/workflows/integration-tests.yml

@codecov-commenter
Copy link

codecov-commenter commented Oct 7, 2024

Codecov Report

Attention: Patch coverage is 68.42105% with 6 lines in your changes missing coverage. Please review.

Project coverage is 40.65%. Comparing base (0cc0c62) to head (2d81c1e).
Report is 81 commits behind head on main.

Files with missing lines Patch % Lines
src/compiler/rust.rs 68.42% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2269      +/-   ##
==========================================
+ Coverage   30.91%   40.65%   +9.73%     
==========================================
  Files          53       54       +1     
  Lines       20112    20767     +655     
  Branches     9755     9654     -101     
==========================================
+ Hits         6217     8442    +2225     
- Misses       7922     8154     +232     
+ Partials     5973     4171    -1802     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ColinFinck
Copy link
Author

Hey @sylvestre, thanks a lot for your quick response! I've checked the integration-tests.yml file you gave me, but it only contains a single test for each platform/compiler, not for individual flags of the Rust compiler. I'm willing to add a test for the newly supported flag, but I need a good example on how sccache currently does per-flag tests.

@sylvestre
Copy link
Collaborator

@ColinFinck ColinFinck force-pushed the feature/cache-target-json-specs branch from bb88bf5 to 616dd8c Compare November 18, 2024 11:57
@ColinFinck
Copy link
Author

@sylvestre I've rebased to latest main and added a test in 616dd8c

@ColinFinck
Copy link
Author

Bump

@sylvestre
Copy link
Collaborator

sorry, i missed your comment. CI started!

@sylvestre sylvestre force-pushed the feature/cache-target-json-specs branch from 616dd8c to 91b7c1c Compare December 3, 2024 10:26
@ColinFinck
Copy link
Author

@sylvestre Thanks for getting back to this PR. However, I'm still seeing "2 workflows awaiting approval" in GitHub.

@sylvestre
Copy link
Collaborator

done
could you please add a test in
https://github.com/mozilla/sccache/blob/main/tests/system.rs
too ?

@ColinFinck
Copy link
Author

could you please add a test in
https://github.com/mozilla/sccache/blob/main/tests/system.rs
too ?

@sylvestre There is currently not a single test in that file which exercises the Rust compiler. This is only done in src/compiler/rust.rs. Which is why I added my test there.
Multiple C compilers are tested in tests/system.rs, but not rustc. Adding a test framework for the Rust compiler to that file exceeds the scope of this PR and goes beyond my limited knowledge of sccache.

I hope we're able to merge the few lines of this PR without requiring an entirely new test framework for the Rust compiler first.

@sylvestre
Copy link
Collaborator

@sylvestre There is currently not a single test in that file which exercises the Rust compiler.

@ColinFinck we have proper Rustc testing:

See:
https://github.com/mozilla/sccache/blob/main/tests/sccache_cargo.rs
and
https://github.com/mozilla/sccache/blob/main/tests/sccache_rustc.rs

@sylvestre sylvestre force-pushed the feature/cache-target-json-specs branch from 91b7c1c to 7e96849 Compare December 12, 2024 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Caching custom Rust targets
3 participants