Bazel: fix non-swift macOS builds #16632
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Now the swift-specific compilation options are contained in a transition applied only to swift targets.
A transition is required for the macOS
-arch
options, because we need all dependencies that are linked into swift targets to have those. While other options (-fno-rtti
and-std=c++20
) could work with a simplecc_{binary,library}
attribute injection, it was preferred to use one mechanism only.This is meant to be cleaned up in a later PR with respect to the TODO: the bazel transition used for Swift is inspired by what we use in the internal repo, but has some differences:
codeql_pkg_runfiles
had a conflict on itcc_library
as wellCcInfo
provider as wellAlso added new triggers to local go CI to detect this kind of problem earlier next time.
One drawback of a transition-based approach is that
bazel build //swift/...
ceases to work, because it picks up the internal transition targets without the proper compile options. This also means thatbazel test //swift/...
now requires--build_tests_only
.