-
-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
252 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,40 @@ | ||
"Module extensions for use with bzlmod" | ||
|
||
load("@com_grail_bazel_toolchain//toolchain:rules.bzl", "compiler_configuration_attrs", "llvm_repo_attrs", "llvm_toolchain") | ||
load("@com_grail_bazel_toolchain//toolchain:rules.bzl", "llvm_toolchain") | ||
load( | ||
"@com_grail_bazel_toolchain//toolchain/internal:repo.bzl", | ||
_compiler_configuration_attrs = "compiler_configuration_attrs", | ||
_llvm_repo_attrs = "llvm_repo_attrs", | ||
) | ||
|
||
def _llvm_impl_(module_ctx): | ||
for mod in module_ctx.modules: | ||
for toolchain_attr in mod.tags.toolchain: | ||
llvm_toolchain( | ||
name = "llvm_toolchain", | ||
name = toolchain_attr.name, | ||
llvm_version = toolchain_attr.llvm_version, | ||
stdlib = toolchain_attr.stdlib, | ||
sha256 = toolchain_attr.sha256, | ||
strip_prefix = toolchain_attr.strip_prefix, | ||
urls = toolchain_attr.urls, | ||
bzlmod = True, | ||
bzlmod_module_version = module_ctx.modules[0].version, | ||
) | ||
|
||
attrs = dict(llvm_repo_attrs) | ||
attrs.update(compiler_configuration_attrs) | ||
_attrs = { | ||
"name": attr.string( | ||
doc = "Prefix used when registering toolchain repositories", | ||
default = "llvm_toolchain", | ||
), | ||
} | ||
_attrs.update(_llvm_repo_attrs) | ||
_attrs.update(_compiler_configuration_attrs) | ||
|
||
llvm = module_extension( | ||
implementation = _llvm_impl_, | ||
tag_classes = { | ||
"toolchain": tag_class( | ||
attrs = attrs, | ||
attrs = _attrs, | ||
), | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.