Skip to content

Add a module extension for registering local/remote jdks #312

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
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hvadehra
Copy link
Member

@hvadehra hvadehra commented Aug 6, 2025

No description provided.

@hvadehra hvadehra force-pushed the hvd_java_repos_module_ext branch from 03dd2b2 to 8caea3d Compare August 6, 2025 11:01
)

_local = tag_class(attrs = {
"name": attr.string(mandatory = True),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Module extensions typically don't work well if they accept user-provided names while also collecting tags from transitive deps. There just is no good way to handle collisions.

Since this extension would only wrap simple repos, could use_repo_rule be an alternative? If not because the repo rules really are macros, what's blocking them from being rules?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the heads up. This is just me experimenting for bazelbuild/bazel#26589

If we do go ahead with this, I was imagining only permitting root modules to use this. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only allowing the root module to use the extension is the best way to resolve this issue.

For local_java_repository specifically, we could also just get rid of the macro wrapper. Then it could be used with use_repo_rule as the reporter of that issue attempted to do.

remote_java_repository necessarily creates two repos and the one with the specified name is not the one users usually need to reference, which makes it pretty incompatible with use_repo_rule even if we add support for macros.

@hvadehra hvadehra force-pushed the hvd_java_repos_module_ext branch 4 times, most recently from d104071 to ea47e19 Compare August 7, 2025 10:40
@hvadehra hvadehra force-pushed the hvd_java_repos_module_ext branch from ea47e19 to d11e12e Compare August 7, 2025 10:41
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 this pull request may close these issues.

2 participants