bazelbuild / bazelbuild/bazel

Can not manipulate select statement in macros

Open
#8,419 15 comments 2 reactions 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:

The rules_k8s have a rule `k8s_objects` which takes a list of labels (`k8s_object` targets) and creates multiple targets with these labels, with custom endings, that it knows have been created from the underlying `k8s_object`. So there is code like `[x + ".create" for x in objects]` If objects is now a `select` statement that fails with something like: select is not iterable. IT would be nice if I could still iterate over a `select` statement similar to a dict, so I could manipulate the labels in the macro.

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

Now I have to use a normal `dict` as a workaround which the macro then converts into a `select` statement. I think this ends up being confusing for the end-user as that is not usual

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

0.25.2

### Have you found anything relevant by searching the web?

https://github.com/bazelbuild/bazel/issues/8171 but seems not directly related

### Any other information, logs, or outputs that you want to share?

For the exact use of this see PR: https://github.com/bazelbuild/rules_k8s/pull/342

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the exact use case in rules_k8s PR 342 and compare it with Bazel issue 8171. Determine how macros should iterate over a select statement and identify the relevant Bazel tests; done means the k8s_objects-style label manipulation works without converting through a dict.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.