bazelbuild / bazelbuild/bazel

toolchain tool_paths should accept labels

Open
#8,438 23 comments 17 reactions 0 assignees View on GitHub
P3 team-Rules-CPP type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the problem / feature request:

toolchain confiuration `cc_common.create_cc_toolchain_config_info` attributes `tool_paths`/`path` should accept bazel labels.

### Feature requests: what underlying problem are you trying to solve with this feature?

The current status (in bazel 0.25) is that toolchain configuration info attributes for tool paths only accept local or absolute paths, but not bazel label.

That's not convenient if your tools comes from another (possibly repository) rule because you need to generate the path by yourself (I don't even know how bazel correctly knows it had to build the dependent rule before).

Example of what I'd like to do:

```
cc_common.create_cc_toolchain_config_info(
...
tool_paths = [
tool_path(
name = "gcc",
path = "@gcc//:bin/gcc",
...
```

### What operating system are you running Bazel on?

Linux

### What's the output of `bazel info release`?

`release bazel-0.25-2`

Contributor guide

Open the contributing guide

Research direction

Start at the cc_common.create_cc_toolchain_config_info entry point and trace how tool_paths and tool_path.path values are validated and resolved. Check existing toolchain configuration tests, if available, and verify that a label-valued path builds its dependency before the tool is used. Done means tool_paths accepts Bazel labels as well as local and absolute paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.