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

Improve module extension #130

Merged
merged 3 commits into from
Jan 7, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Rename helm.options to helm.toolchain
This makes it more obvious to the user what this tag does.
mering committed Jan 7, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit bd012528df352437aa13e3214f3738bb31d9b2d3
20 changes: 13 additions & 7 deletions helm/extensions.bzl
Original file line number Diff line number Diff line change
@@ -22,10 +22,15 @@ exports_files(glob(["**"]))

def _helm_impl(ctx):
module = ctx.modules[0]
options = module.tags.options
version = options[0].version
helm_url_templates = options[0].helm_url_templates
plugins = options[0].plugins
toolchain_options = module.tags.toolchain
if len(module.tags.options) > 0:
if module.is_root:
# TODO Use deprecation tag when available: https://github.com/bazelbuild/bazel/issues/24843
print("helm.options() is deprecated. Use helm.toolchain() instead.") # buildifier: disable=print
toolchain_options += module.tags.options
version = toolchain_options[0].version
helm_url_templates = toolchain_options[0].helm_url_templates
plugins = toolchain_options[0].plugins

_register_toolchains(version, helm_url_templates, plugins)
_register_go_yaml()
@@ -93,8 +98,8 @@ def _register_go_yaml():
build_file = Label("//3rdparty/yaml:BUILD.yaml.bazel"),
)

options = tag_class(
doc = "Options used to configure helm toolchains.",
toolchain = tag_class(
doc = "Configure a helm toolchain.",
attrs = {
"helm_url_templates": attr.string_list(
doc = (
@@ -118,6 +123,7 @@ options = tag_class(
helm = module_extension(
implementation = _helm_impl,
tag_classes = {
"options": options,
"options": toolchain, # deprecated: use toolchain instead and remove in next major version
"toolchain": toolchain,
},
)