bazelbuild / bazelbuild/bazel

Allow to filter lists of targets by the platform compatibility.

Open
#12,412 28 comments 0 reactions 1 assignee Claimed by @philsc View on GitHub
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 problem / feature request:

Newly introduced [feature](https://github.com/bazelbuild/bazel/issues/3780) allows filtering the requested targets and gracefully removes those incompatible with the requested platform. All targets which depend on incompatible targets also considered incompatible and excluded from the build.
In case we have `filegroup` or another rule which accepts the list of targets we don't want to invalidate it only because one of the targets in the list appeared to be incompatible. We want to skip incompatible targets, but let the rest of the list proceed with the build.

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

To build specific category of artifacts (like "binaries") we have something like the following in our root BUILD file:
```
filegroup(
name = "binaries",
srcs = [
"@lego//:binaries",
"@atrclient//:binaries",
"@tablicense//:binaries",
"@art-cpp//:binaries",
],
)
```
Each item in the list is defined in a corresponding external workspace as a filegroup which may pull in direct targets and more transitive filegroups. The problem is that not all targets are suitable for all possible target platforms although each target knows what platforms it is compatible with.
`target_compatible_with` attribute does not solve this problem completely as any incompatible target would invalidate the whole filegroup, so we need some mechanism to allow for the filtering based on that attribute.

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

Windows, Mac, Linux

3.7.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.