Skip to content
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

Cannot use these rules within a module #15

Closed
blaizard opened this issue Jan 9, 2025 · 2 comments · Fixed by #17
Closed

Cannot use these rules within a module #15

blaizard opened this issue Jan 9, 2025 · 2 comments · Fixed by #17

Comments

@blaizard
Copy link

blaizard commented Jan 9, 2025

There are several reason that seems to prevent me to use this module within another module (not the root module).

1.If this dep is instantiated in more than one module, the repository named "doxygen" will be created twice, resulting in a name conflict:

                doxygen_repository(
Error in repository_rule: A repo named doxygen is already generated by this module extension at /home/me/.cache/bazel/_bazel_me/a3aa740f2f5594e9ea9a176330f7930a/external/rules_doxygen+/extensions.bzl:268:27
  1. If I try to instanciate it only in a non-root module, it will complain that the repository @doxygen is not visible from @@//.
(17:58:17) ERROR: no such package '@@[unknown repo 'doxygen' requested from @@]//': The repository '@@[unknown repo 'doxygen' requested from @@]' could not be resolved: No repository visible as '@doxygen' from main repository. Was the repository introduced in WORKSPACE? The WORKSPACE file is disabled by default in Bazel 8 (late 2024) and will be removed in Bazel 9 (late 2025), please migrate to Bzlmod. See https://bazel.build/external/migration

Tested with bazel 8.0.0

@TendTo
Copy link
Owner

TendTo commented Jan 10, 2025

Thanks for the report.
First of all, I would suggest adding dev_dependency = True whenever you import rules_doxygen, unless some of the exposed targets need it. This should immediately solve your issue.
If that is not possible, I am introducing a new repository tag that will allow you to give different names to the @doxygen repository, to ensure no conflicts arise. See #17 for more details and let me know if this works for you.

@blaizard
Copy link
Author

If I use dev_dependency = True within a module (not the root) the dependency will be ignored, so I cannot use rules_doxygen within this module, nor any extension (which is what I am trying to achieve).
You PR (#17) fixes my issue. I think the culprit of the problem was the hard-coded value of the repository name (https://github.com/TendTo/rules_doxygen/pull/17/files#diff-8016140b9d8e7085360481f30c87c1f152e2c4682b1c09ebd16600773a9ebc67L80 and below).
Thanks a lot for addressing this so quick!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants