2022-04-27 04:07:17 +00:00
|
|
|
"Module extensions for use with bzlmod"
|
|
|
|
|
|
|
|
load(
|
|
|
|
"@aspect_bazel_lib//lib:repositories.bzl",
|
2023-01-17 01:19:13 +00:00
|
|
|
"register_copy_directory_toolchains",
|
2023-01-07 19:26:27 +00:00
|
|
|
"register_copy_to_directory_toolchains",
|
2023-05-16 23:14:50 +00:00
|
|
|
"register_coreutils_toolchains",
|
|
|
|
"register_expand_template_toolchains",
|
2023-06-09 23:22:37 +00:00
|
|
|
"register_jq_toolchains",
|
2023-10-03 20:00:58 +00:00
|
|
|
"register_tar_toolchains",
|
2023-06-09 23:22:37 +00:00
|
|
|
"register_yq_toolchains",
|
2022-04-27 04:07:17 +00:00
|
|
|
)
|
2023-02-19 04:08:12 +00:00
|
|
|
load("//lib/private:host_repo.bzl", "host_repo")
|
2022-04-27 04:07:17 +00:00
|
|
|
|
2023-02-19 04:09:27 +00:00
|
|
|
def _toolchain_extension(mctx):
|
2023-01-17 01:19:13 +00:00
|
|
|
register_copy_directory_toolchains(register = False)
|
2023-01-07 19:26:27 +00:00
|
|
|
register_copy_to_directory_toolchains(register = False)
|
2023-01-17 03:37:36 +00:00
|
|
|
register_jq_toolchains(register = False)
|
|
|
|
register_yq_toolchains(register = False)
|
2023-03-10 17:37:57 +00:00
|
|
|
register_coreutils_toolchains(register = False)
|
2023-10-03 20:00:58 +00:00
|
|
|
register_tar_toolchains(register = False)
|
2023-05-16 23:14:50 +00:00
|
|
|
register_expand_template_toolchains(register = False)
|
2023-06-09 23:22:37 +00:00
|
|
|
|
2023-02-19 04:09:27 +00:00
|
|
|
create_host_repo = False
|
|
|
|
for module in mctx.modules:
|
|
|
|
if len(module.tags.host) > 0:
|
|
|
|
create_host_repo = True
|
|
|
|
|
|
|
|
if create_host_repo:
|
|
|
|
host_repo(name = "aspect_bazel_lib_host")
|
2022-04-27 04:07:17 +00:00
|
|
|
|
|
|
|
# TODO: some way for users to control repo name/version of the tools installed
|
|
|
|
ext = module_extension(
|
|
|
|
implementation = _toolchain_extension,
|
2023-02-19 04:09:27 +00:00
|
|
|
tag_classes = {"host": tag_class(attrs = {})},
|
2022-04-27 04:07:17 +00:00
|
|
|
)
|