bolt/deps/llvm-18.1.8/utils/bazel/llvm-project-overlay/workspace_root.bzl
2025-02-14 19:21:04 +01:00

17 lines
520 B
Python

def _workspace_root_impl(ctx):
"""Dynamically determine the workspace root from the current context.
The path is made available as a `WORKSPACE_ROOT` environmment variable and
may for instance be consumed in the `toolchains` attributes for `cc_library`
and `genrule` targets.
"""
return [
platform_common.TemplateVariableInfo({
"WORKSPACE_ROOT": ctx.label.workspace_root,
}),
]
workspace_root = rule(
implementation = _workspace_root_impl,
attrs = {},
)