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

Fix runfiles lookup under bzlmod in Bazel 6 #963

Merged

Conversation

BalestraPatrick
Copy link
Member

@BalestraPatrick BalestraPatrick commented Jan 5, 2023

When building Swift code with --enable_bzlmod, it currently fails due to the worker failing to find the index-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 check BAZEL_CURRENT_REPOSITORY is defined to simply make use of the new constructor which will make it so the runfiles lookup will happen relative to the rules_swift repo under Bazel 6.

I tested this locally with a local_path_override while iterating on getting the rules_xcodeproj to work under bzlmod (and also continues to work with bzlmod disabled in Bazel 6): MobileNativeFoundation/rules_xcodeproj#1502

@BalestraPatrick
Copy link
Member Author

BalestraPatrick commented Jan 5, 2023

Mmh, failure looks related to last-green-bazel using Bazel at 45ca62c042f3679e60664b9ebe6d24239b390e1d which doesn't have this commit: bazelbuild/bazel@d3a92e8

This was because of #918, so maybe we can go back to actually using the last green if fixed.

@BalestraPatrick BalestraPatrick merged commit 134bf5c into bazelbuild:master Jan 5, 2023
@BalestraPatrick BalestraPatrick deleted the fix-bzlmod-runfiles branch January 5, 2023 17:15
tymurmustafaiev pushed a commit to tymurmustafaiev/rules_swift that referenced this pull request Jul 19, 2023
tymurmustafaiev pushed a commit to tymurmustafaiev/rules_swift that referenced this pull request Jul 19, 2023
When building Swift code with `--enable_bzlmod`, it currently fails due
to the worker failing to find the `index-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](https://www.youtube.com/watch?v=5NbgUMH1OGo).
Since rules_swift supports both Bazel 5 and 6, we need to check
`BAZEL_CURRENT_REPOSITORY` is defined to simply make use of the new
constructor which will make it so the runfiles lookup will happen
relative to the `rules_swift` repo under Bazel 6.

I tested this locally with a `local_path_override` while iterating on
getting the `rules_xcodeproj` to work under bzlmod (and also continues
to work with bzlmod disabled in Bazel 6):
MobileNativeFoundation/rules_xcodeproj#1502
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.

None yet

3 participants