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

Implement features required by Xcode #2257

Merged
merged 7 commits into from
Oct 2, 2024
Merged

Conversation

scoopr
Copy link
Contributor

@scoopr scoopr commented Sep 11, 2024

These commits allow me to use sccache with Xcode.

Firstly, I just mark -index-store-path as Hard, as it is easy to configure Xcode not to use that. Not sure how impossible that would be to implement otherwise, didn't look in to it.

And secondly, I'm artifacting the dep (.d) files and the -serialize-diagnostics (.dia) files, as Xcode seems to always request them, and the build will fail without them.

When using it, I need to run the sccache server outside of Xcode, as otherwise it seems that Xcode will keep waiting for the daemon to timeout.

Then I have configured in Xcode build settings the CC/CXX variables, currently to a launcher script that sets the env variables and calls sccache with the right arguments (I am using it through cmake though). The setup might be improved now that I got it to work.

@sylvestre
Copy link
Collaborator

thanks
it would be nice to add some docs + add a test if possible
thanks

@scoopr
Copy link
Contributor Author

scoopr commented Sep 12, 2024

Updated the tests and added some docs.

If there are additional concerns, it might be few weeks until I can get back to this.

@codecov-commenter
Copy link

codecov-commenter commented Sep 12, 2024

Codecov Report

Attention: Patch coverage is 51.61290% with 15 lines in your changes missing coverage. Please review.

Project coverage is 40.68%. Comparing base (0cc0c62) to head (0c8a7e2).
Report is 78 commits behind head on main.

Files with missing lines Patch % Lines
src/compiler/gcc.rs 53.33% 8 Missing and 6 partials ⚠️
src/compiler/msvc.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2257      +/-   ##
==========================================
+ Coverage   30.91%   40.68%   +9.77%     
==========================================
  Files          53       54       +1     
  Lines       20112    20732     +620     
  Branches     9755     9636     -119     
==========================================
+ Hits         6217     8435    +2218     
- Misses       7922     8150     +228     
+ Partials     5973     4147    -1826     

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

@sylvestre
Copy link
Collaborator

About test, I was thinking about something like in https://github.com/mozilla/sccache/blob/main/.github/workflows/integration-tests.yml

scoopr added 5 commits October 1, 2024 12:31
Xcode sets it by default, but it can be disabled with
`COMPILER_INDEX_STORE_ENABLE=NO` Xcode build setting.
Xcode requires these files to be present after compiling, so they need
to be stored and restored for the build to complete.
@scoopr scoopr force-pushed the xcode-fix branch 2 times, most recently from 075d25b to 4b0d34b Compare October 1, 2024 09:36
@scoopr
Copy link
Contributor Author

scoopr commented Oct 1, 2024

Sorry about the churn for getting that integration test running, I don't think I have a good way to test it locally, so I'm developing it a bit blind.

@sylvestre
Copy link
Collaborator

no worries. Could you please write a tiny PR that I could merge quickly so that you get the CI without approval?

@sylvestre
Copy link
Collaborator

for example, typo fix like:
src/lru_disk_cache/mod.rs:142: maintence ==> maintenance

@sylvestre
Copy link
Collaborator

well, looks like it worked :)

@scoopr
Copy link
Contributor Author

scoopr commented Oct 1, 2024

Yep, the output now looks like what I expected. I don't think I have anything to add it, so on my side its ready, if no other concerns arise.

run: |
cargo build

- name: Create wrapper script
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please add a comment explaining why a wrapper script is needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its actually explained in the docs (dfe8c5b#diff-8f7ae669918b1de5a217f0f28f8becd7d0f92625c4b8334b733315b8199dd102R47), but I guess I could add a comment here.

The issue is that I can't just set CC="sccache clang++", because it interprets the whole CC variable as a command, so its searching for a file called sccache clang++ (so space is part of the command name). If you have other ideas for a workaround, I'm all ears.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah but i would prefer to have it next to the code :)

@sylvestre sylvestre merged commit 2debbfc into mozilla:main Oct 2, 2024
56 checks passed
@scoopr scoopr deleted the xcode-fix branch October 2, 2024 07:54
@scoopr
Copy link
Contributor Author

scoopr commented Oct 2, 2024

It seems the continuous job failed, is it due to something I did, or is it something else?

@sylvestre
Copy link
Collaborator

nope, we have some intermittent sometimes (when the cache is full i guess)

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.

3 participants