-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add extension to allow bazelmod style handling of dependencies #124
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking the time to proposing this upstream!
version = repository.version, | ||
) | ||
|
||
helm_import = module_extension( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider merging this with the module extension above by introducing the repository
tag_class there.
This way, from a user perspective, this is could then be used like
helm = use_extension("@rules_helm//helm:extensions.bzl", "helm")
helm.options(...)
helm.repository(...)
helm.repository(...)
"url": attr.string( | ||
doc = "The url where the chart can be directly downloaded.", | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be a different use case not using a helm repository but downloading a chart directly. Consider making this a separate tag class (for example calling it chart
instead of repository).
def _helm_import_impl(module_ctx): | ||
for mod in module_ctx.modules: | ||
for repository in mod.tags.repository: | ||
helm_import_repository( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider de-duplicating this based on repository. For this to work out well, you could generate the "name" based on the repository URL similar to rules_go. Then you could use a dict to check if this repository was already registered.
Imagine some (transitive) dependency also wants to import the same helm repository. With the current version, the same repository would get imported twice which is undesirable and can lead to conflicts.
If this is out of scope, a common practice is to only allow using this in the root module (if mod.is_root
) and otherwise printing a warning that this is ignored. This makes migration to a more elaborate approach later a lot easier.
"name": attr.string( | ||
doc = "Name for the import dependency", | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider generating the name based on the repository instead of allowing the user to specify this explicitly (see other comment).
No description provided.