bazelbuild / bazelbuild/bazel-skylib

Test rule to verify aspect applied to another target

Open
#189 0 comments 0 reactions 0 assignees View on GitHub
P4 type: feature request
Dominant language
Starlark
Stars
444
Forks
202
PR merge metrics
No merged PRs in 30d

Description

Some workflows apply a top level aspect to a build, such as:

```
bazel build //foo:bar --aspect=//baz:my_aspect.bzl%my_aspect
```

It would be nice to have a canonical test rule which would verify that builds such as these would work.

It should be as simple as creating a thin analysis test rule which applies the aspect along the edge. That is, a test rule with attribute defined:

```
deps' : attr.label_list(aspects = [my_aspect]),
```
And then, to satisfy the above example, the user could create a test target that has `//foo:bar` as one of its `deps`.

Contributor guide

Open the contributing guide

Research direction

Start by locating the existing analysis test rules in bazel-skylib and review how their attributes and tests are structured. Implement the proposed thin rule with a deps attribute applying my_aspect along the dependency edge, then verify it with a target depending on //foo:bar and an aspect invocation like the example.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.