Fix runfiles lookup under bzlmod in Bazel 6 #963
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.
When building Swift code with
--enable_bzlmod
, it currently fails due to the worker failing to find theindex-import
executable in the runfiles. This is because the naming is different under bzlmod and the C++ runfiles library was updated to support this new mapping as described in this talk. Since rules_swift supports both Bazel 5 and 6, we need to checkBAZEL_CURRENT_REPOSITORY
is defined to simply make use of the new constructor which will make it so the runfiles lookup will happen relative to therules_swift
repo under Bazel 6.I tested this locally with a
local_path_override
while iterating on getting therules_xcodeproj
to work under bzlmod (and also continues to work with bzlmod disabled in Bazel 6): MobileNativeFoundation/rules_xcodeproj#1502