fix(bzlmod): let workspace-invoked python_register_toolchains to register toolchains#2289
Merged
aignas merged 1 commit intobazel-contrib:mainfrom Oct 11, 2024
Merged
Conversation
d3ff7a6 to
0272f6c
Compare
0272f6c to
1a10cfd
Compare
mbland
added a commit
to mbland/rules_scala
that referenced
this pull request
Nov 13, 2024
Resolves the duplicate repo instantiation errors from the previous merge commit. They all had to do with repos that twitter_scrooge and scalafmt have in commmon with scala_proto. Given that, passing the `scala_proto` boolean parameter of `scala_toolchains` into the `twitter_scrooge` and `scalafmt_repositories` functions seemed the easiest workaround for now. I picked up the `**kwargs` + `kwargs.pop()` pattern up from: - bazel-contrib/rules_python#2289 It seems to be a pattern for passing through hidden, purely internal parameters, not to be relied upon by any external users.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
While migrating to bzlmod, users may have a hybrid build where WORKSPACE contains
python_register_toolchain() calls. Because these calls originate from WORKSPACE files,
the
native.register_toolchainAPIs are still available. At the same time, we stilldetect that bzlmod is enabled, and thus disable calling those functions. The net
effect is, users aren't able to register toolchains in such a hybrid setup. At the
same time, because the code path is shared, we can't have the bzlmod toolchain code
try to call them, as it'll fail.
To accomodate both cases, have the bzlmod toolchain code pass a special arg so that
python_register_toolchainsknows to skip parts that don't apply to the bzlmod toolchaininvocation.
This was all unwound by some users and pointed out in a Slack thread. A few people are
manually carrying an equivalent patch for a working hybrid mode.
Fixes #1675