Open brocollie08 opened 2 months ago
I could be wrong but I think this is a WORKSPACE error and not a Bzlmod error. At least I'm yet to see this one from Bzlmod. Do you have an example workspace and module file that can be used to repro this?
Yea! You should be able to see it here if you remove the declaration chunk from WORKSPACE.bzlmod and put the equivalent bazel_dep
in MODULE.bazel
I was just about to try to fork the rules kotlin repo and use git override to see if I can do something about this locally, but please let me know if I've missed something in my set up
This seems to be only a problem with my existing WORKSPACE.bzlmod, which I think is necessary since it loads in things that are non-bzlmod dependencies as a means to support incremental upgrades alongside bzlmod..
okay 1 more update on this, I don't actually think this is a general problem for Kotlin rules and WORKSPACE.bzlmod, I was able to load some other stuff through WORKSPACE.bzlmod okay.
This problem came up with the content in that WORKSPACE.bzlmod file at that commit, which, all it was doing was trying to download things from Maven.
I've moved those to maven.install
in the MODULE.bazel and deleted the lines in WORKSPACE.bzlmod, so I've worked around it for now.
So the current conclusion is that Kotlin rules error out with its deps when I try to download other maven deps in WORKSPACE.bzlmod? Weird edge case behaviour
I'm not surerules_kotlin
is a necessary part of reporudcing this bug. Can you try it with another rule set?
The current rule implementation does not special rules_jvm_external
-- all the interaction is done via providers.
I'm in the middle of migrating a repo full of rules and macros from bazel 5 to 6, and I noticed that there are some problems pulling in
rules_kotlin
via bzlmodIf I just have the following:
I notice that the first error I get is this
I tried to include that as well manually
I get another similar error
I believe both of these are from the
rules_kotlin
repo.The behaviour can be observed here by running
bazel build //kotlin/...
However, I've found that the
WORKSPACE.bzlmod
works just fine, but I noticed that bazel 6 seems to have issues with non-module dependencies being used transitively. e.g. repoA
uses the macros defined inB
, butB
usesrules_kotlin
throughWORKSPACE.bzlmod
instead ofMODULE.bazel
, thenA
will error with@rules_kotlin
not being defined in the context ofB
upon trying to execute the macro.I've verified that this doesn't seem to be a problem with module deps (tested with
rules_jvm_external
), which suggests incremental adoption isn't really an option for kotlin rules, forcing me pull it through bzlmod and leading me to the issue in description.