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

Add support for bzlmod #1502

Merged
merged 2 commits into from
Jan 13, 2023
Merged

Add support for bzlmod #1502

merged 2 commits into from
Jan 13, 2023

Conversation

BalestraPatrick
Copy link
Contributor

This PR adds initial support for bzlmod. I still have to test it with an example project, but the basic infrastructure should be ready.

bzlmod is only really ready to be used starting in Bazel 6.0. For this reason, the MODULE.bazel depends on rules_apple 2.0.0, which is also the release that requires Bazel 6. I will need to first check the newest version of rules_apple and rules_swift into the Bazel Central Registry, and then we can proceed testing the rules_xcodeproj integration.

@brentleyjones
Copy link
Contributor

FYI: #1503

@brentleyjones
Copy link
Contributor

FYI, the repo now uses Bazel 6.0.

@brentleyjones
Copy link
Contributor

As part of this do we want to enable bzlmod in bazel_6.bazelrc? I think local_provisioning_profile breaks right now, so we might have to disable it for examples/integration/.bazelrc.

@BalestraPatrick
Copy link
Contributor Author

Yeah, I think that's a good idea. We might also need to create a WORKSPACE.bzlmod in order to bring in some of the other dependencies in an easier way, or just try to get everything done in the MODULE.bazel. I can take a look.

@brentleyjones
Copy link
Contributor

We might also need to create a WORKSPACE.bzlmod in order to bring in some of the other dependencies in an easier way

If we can do that instead of disabling bzlmod, I would prefer that.

BalestraPatrick added a commit to bazelbuild/rules_swift that referenced this pull request 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](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
@BalestraPatrick BalestraPatrick force-pushed the pb/bzlmod branch 3 times, most recently from a75dfff to 718391c Compare January 9, 2023 14:26
tools/bazel Outdated Show resolved Hide resolved
examples/cc/MODULE.bazel Outdated Show resolved Hide resolved
xcodeproj/extensions.bzl Outdated Show resolved Hide resolved
@BalestraPatrick BalestraPatrick force-pushed the pb/bzlmod branch 2 times, most recently from 0dc414e to 1ee9b45 Compare January 13, 2023 09:34
brentleyjones pushed a commit that referenced this pull request Jan 13, 2023
Split up the `rules_swift` bump from
#1502.
@BalestraPatrick BalestraPatrick marked this pull request as ready for review January 13, 2023 14:08
@BalestraPatrick BalestraPatrick merged commit 15fb29e into main Jan 13, 2023
@BalestraPatrick BalestraPatrick deleted the pb/bzlmod branch January 13, 2023 14:09
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.

2 participants