1 def _workspace_root_impl(ctx):
2 """Dynamically determine the workspace root from the current context.
4 The path is made available as a `WORKSPACE_ROOT` environmment variable and
5 may for instance be consumed in the `toolchains` attributes for `cc_library`
9 platform_common.TemplateVariableInfo({
10 "WORKSPACE_ROOT": ctx.label.workspace_root,
14 workspace_root = rule(
15 implementation = _workspace_root_impl,