Skip to content

Conversation

@aaronsky
Copy link
Contributor

@aaronsky aaronsky commented Dec 3, 2025

This is the third in a stack of PRs across three repositories.

It takes the approach suggested in #1119 and applies it in a way that scales better between codebases. By breaking sandboxing rules and remapping a derivable path to the source root, we can to allow Xcode, which book-keeps all code coverage representations in the IDE as absolute paths, to present code coverage information in the gutters and test results. It creates a new config, rules_xcodeproj_coverage, and enables a set of features unconditionally when it is enabled by the scheme setting that controls the ENABLE_CODE_COVERAGE build setting.

This implementation requires #3111 in order for its assumptions to make sense and be testable.


Notes for reviewers, and TODOs:

  • This PR requires the changes in those other PRs to work.
    • I have tested what happens when you try to use this but those features don't exist, and the result was a no-op.
  • This PR does not provide feedback to users that their build will not be well-cached.
    • I have produced a warning diagnostic as part of the build to inform users, if the features are not set.

Signed-off-by: Aaron Sky <aaronsky@skyaaron.com>
@aaronsky aaronsky force-pushed the aaronsky/enable-code-coverage-in-xcode branch from bcbfc88 to a54c242 Compare December 3, 2025 18:49
aaronsky added a commit to bazelbuild/apple_support that referenced this pull request Dec 5, 2025
This is the first in a stack of PRs across three repositories. 

- #491 <-- you are here
- bazelbuild/rules_swift#1623
- MobileNativeFoundation/rules_xcodeproj#3250

It takes the approach suggested in
MobileNativeFoundation/rules_xcodeproj#1119 and applies it to the
xcode-clang toolchain. By breaking sandboxing rules and remapping a
derivable path to the source root, we can to allow Xcode, which
bookkeeps all code coverage representations in the IDE as absolute
paths, to present code coverage information in the gutters and test
results.
aaronsky added a commit to bazelbuild/rules_swift that referenced this pull request Dec 5, 2025
This is the second in a stack of PRs across three repositories.

- bazelbuild/apple_support#491
- #1623 <-- you are here
- MobileNativeFoundation/rules_xcodeproj#3250

It takes the approach suggested in
MobileNativeFoundation/rules_xcodeproj#1119 and applies it to our swift
toolchain. By breaking sandboxing rules and remapping a derivable path
to the source root, we can to allow Xcode, which bookkeeps all code
coverage representations in the IDE as absolute paths, to present code
coverage information in the gutters and test results.
@aaronsky aaronsky marked this pull request as ready for review December 5, 2025 22:28
@aaronsky aaronsky requested review from a team as code owners December 5, 2025 22:28
@chrisballinger
Copy link

Very excited for this!

Signed-off-by: Aaron Sky <aaronsky@skyaaron.com>
…ompromises with this approach to users

Signed-off-by: Aaron Sky <aaronsky@skyaaron.com>
@brentleyjones
Copy link
Contributor

Do we need to mention in the docs the minimum apple_support and rules_swift versions needed to make this work?

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.

4 participants