Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Access custom tool_path from my toolchain in a Starlark rule

38 views
Skip to first unread message

Eric Stoces

unread,
Jan 16, 2025, 4:51:56 AMJan 16
to bazel-discuss
I added a tool_path for tclsh.exe in my toolchain (below), which provided CcToolchainConfigInfo.  I was hoping I could access the path to the tool in a rule using find_cc_toolchain() and simply accessing the value from a tool_paths dictionary. But the attributes of CcToolchainInfo do not have it or any data that helps me get at the tool_paths...

How do I add a custom tool_path to a custom tool_chain and access it in a Starlark rule?

```
def _impl(ctx)
    tool_paths = [
        ...
        tool_path(name = "tclsh", path = "tclsh.exe")
    ]

    ...

    return cc_common.create_cc_toolchain_config_info(
        ...
        tool_paths = tool_paths,
    )

tool = rule(
    implementation = _impl,
    attrs = {},
    provides = [CcToolchainConfigInfo],
)
```



Reply all
Reply to author
Forward
0 new messages