-
Notifications
You must be signed in to change notification settings - Fork 278
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
Draft: Add bzlmod minimal support #1541
Draft: Add bzlmod minimal support #1541
Conversation
@@ -85,11 +85,11 @@ def _get_unused_deps_mode(ctx): | |||
|
|||
def _is_target_included(target, includes, excludes): | |||
for exclude in excludes: | |||
if target.startswith(exclude): | |||
if target.startswith(exclude) or target.startswith("@" + exclude): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://bazel.build/external/overview#canonical-repo-name
for blzmod labels can be like "@@..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I don't miss anything, you don't need to do anything here - it'll be easier for users to just specify correct prefix themselves. It's a sloppy implementation to support label prefixes, I think let's not add more logic to it.
@@ -64,7 +64,7 @@ def _jvm_import_external(repository_ctx): | |||
if (repository_ctx.attr.generated_linkable_rule_name and | |||
not repository_ctx.attr.neverlink): | |||
fail("Only use generated_linkable_rule_name if neverlink is set") | |||
name = repository_ctx.attr.generated_rule_name or repository_ctx.name | |||
name = repository_ctx.attr.repo_name or repository_ctx.attr.generated_rule_name or repository_ctx.name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
names of repositories issued by bzlmod module extensions will look like:
_main~non_module_deps~new_repo
this is why I added explicit parameter to achieve: @new_repo
@@ -18,7 +18,7 @@ test_classpath_contains_2_13() { | |||
|
|||
test_scala_config_content() { | |||
bazel build --repo_env=SCALA_VERSION=0.0.0 @io_bazel_rules_scala_config//:all 2> /dev/null | |||
grep "SCALA_MAJOR_VERSION='0.0'" $(bazel info output_base)/external/io_bazel_rules_scala_config/config.bzl | |||
grep "SCALA_MAJOR_VERSION='0.0'" $(bazel info output_base)/external/*/config.bzl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when built with bzlmod target will be in sth like:
/external/~main_non_module_deps~io_bazel_rules_scala_config/config.bzl
@@ -516,4 +516,16 @@ artifacts = { | |||
"artifact": "org.typelevel:kind-projector_%s:0.13.2" % scala_version, | |||
"sha256": "8f7287973f7f8fc9372b59d36120e3fac5839344f65c8f640351794e8907145c", | |||
}, | |||
"io_bazel_rules_scala_scala_interfaces": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks kinda odd, but I couldn't figure out a better solution
the thing is we have to specify all the possible repos in a MODULE.bazel file
there's no access to SCALA_VERSION property from there, so cannot do sth like "use this repo only if scala_version == 3"
I made a doc comment in scala/scala_maven_import_external.bzl repository def which is meant to be used only for bzlmod
I turn into a draft because will surely cause conflicts with these changes:
|
Hi, @mateuszkuta256, thanks for taking this. So as I understand this is somewhat "blocked" by required changes to toolchains and |
Closing in favour of #1482 |
Description
This is the first step of migration to Bzlmod, see https://bazel.build/external/migration
I'm gonna create a few further pull requests to bring all the changes described here: #1482 (comment)
The migration process will finish once WORKSPACE.bzlmod is empty
Motivation
Resolve #1482