blob: 2932fb143cefc8ca141b3192f66027158151ba80 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
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 = {},
)
|