You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace apparent_repo_name with repo rule wrappers
This presents the same API, remains compatible with both `WORKSPACE` and
Bzlmod, and avoids relying on the canonical repository name format at
all. Part of bazel-contrib#1482, and supersedes the addition of `apparent_repo_name`
from bazel-contrib#1621.
Also adds the `_SCALA_IMPORT_RULE_LOAD` constant in
`scala/scala_maven_import_external.bzl`, which also removes
`@io_bazel_rules_scala` from the `load`ed file path. It now generates
the correct path with a `Label` instead.
---
With bazelbuild/bazel-skylib#548 going nowhere, I eventually realized a
macro wrapper could generate a default target name for a repository_rule
by duplicating the `name` attr. This isn't as easy as adding
`apparent_repo_name(repository_ctx.name)` to a repo rule's
implementation, but it's also not that much more work.
One small downside is that the macro can't be imported into a
`MODULE.bazel` file directly via `use_repo_rule`, if one wanted to do
that. If you did, you'd have to add a module extension to call it, or
use `modules.as_extension` from the `bazel_skylib` module. I suppose
that's a small price to pay for squashing a canonical repo name format
dependency forever.
The other small downside may be that the documentation from the original
`repository_rule` doesn't automatically convey to the repo wrapper. In
this case, `_alias_repository` is already internal, and the original
`jvm_import_external` didn't have docstrings to begin with.
0 commit comments