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
Then, from the internal/test/bcr directory: bazel build ... yields
❯ bazel build ...
ERROR: /home/user/.cache/bazel/_bazel_user/bd3dd79c0d936347dcd08a9f7a9427e7/external/bazel_tools/tools/build_defs/repo/jvm.bzl:306:24: Traceback (most recent call last):
File "/home/user/.cache/bazel/_bazel_user/bd3dd79c0d936347dcd08a9f7a9427e7/external/openapi_tools_generator_bazel+/extension.bzl", line 7, column 38, in _openapi_generator_impl
jvm_maven_import_external(
File "/home/user/.cache/bazel/_bazel_user/bd3dd79c0d936347dcd08a9f7a9427e7/external/bazel_tools/tools/build_defs/repo/jvm.bzl", line 306, column 24, in jvm_maven_import_external
jvm_import_external(
Error in repository_rule: A repo named openapi_tools_generator_bazel_cli is already generated by this module extension at /home/user/.cache/bazel/_bazel_user/bd3dd79c0d936347dcd08a9f7a9427e7/external/bazel_tools/tools/build_defs/repo/jvm.bzl:306:24
ERROR: Analysis of target '//:pylib' failed; build aborted: error evaluating module extension @@openapi_tools_generator_bazel+//:extension.bzl%openapi_gen
INFO: Elapsed time: 0.405s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully
This is because this nested for loop is adding duplicated repos with the name openapi_tools_generator_bazel_cli. I'm not 100% sure how the resolution should be done. The names of the repos can either be adjusted to include the version (which would then require users to always specify the openapi_generator_cli attribute to the openapi_generator rule), or there can be some logic to decide which version should be used (max version?).
Temporarily we are resolving it by applying a patch which modifies the default value to what we need it to be, but I'd love to have this fixed properly. I can contribute, but I don't know the best practices for bazel module extensions well enough to know what the solution should be.
The text was updated successfully, but these errors were encountered:
Thank you for the report, and I would like to get this fixed before we release to the bazel central registry.
I'm not yet sure the best way to solve it. I got some feedback from bzlmod experts to consider either a toolchain or to somehow let users declare their own tool. I hope to work on that the next few days.
The way the module extension is implemented doesn't actually allow you to override client versions because there will then be a name collision.
To reproduce, edit
internal/test/bcr/MODULE.bazel
. Notice, I haven't even tried to change versions yet, just re-use the defaults.Then, from the
internal/test/bcr
directory:bazel build ...
yieldsThis is because this nested for loop is adding duplicated repos with the name
openapi_tools_generator_bazel_cli
. I'm not 100% sure how the resolution should be done. The names of the repos can either be adjusted to include the version (which would then require users to always specify theopenapi_generator_cli
attribute to the openapi_generator rule), or there can be some logic to decide which version should be used (max version?).Temporarily we are resolving it by applying a patch which modifies the default value to what we need it to be, but I'd love to have this fixed properly. I can contribute, but I don't know the best practices for bazel module extensions well enough to know what the solution should be.
The text was updated successfully, but these errors were encountered: