bazelbuild / bazelbuild/bazel

Allow getting the config ID / hash of a target with `bazel cquery --output=starlark`

Open
#20,051 11 comments 1 reaction 0 assignees View on GitHub
not stale P3 team-Configurability type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the feature request:

`bazel cquery --output=starlark` is very useful to get specific information about some targets and this is working very nicely.

Sometimes, however, the queried target has multiple configurations and in these cases, it would be very useful to prit the configuration ID of the target. This will be useful to distinguish these configured targets, and also to further query about these specific configuration IDs as needed (e.g. using `bazel config the-id`).

Unfortunately the API doesn't seem to offer a way to access the current configuration ID. It would be great to add it to the cquery starlark API.

### Which category does this issue belong to?

Starlark Integration

### What underlying problem are you trying to solve with this feature?

I want to display the config ID of configured targets to understand when transitions happen, and also to query about specific configurations as needed.

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

Macos and Linux

Contributor guide

Open the contributing guide

Research direction

Start at the `bazel cquery --output=starlark` entry point and trace how configured targets are exposed through the Starlark API. Compare the requested value with the existing `bazel config the-id` behavior, then identify the relevant tests and update them so configured targets expose a distinguishable configuration ID.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.