bazelbuild / bazelbuild/bazel

Expanded support for Aspect public attributes

Open
#8,494 14 comments 2 reactions 0 assignees View on GitHub
not stale P4 team-Rules-API 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:

We would want Aspect public attribute to be able to support label type and also to be used without pre-defined values.

Today the following are supported:
" Public aspect attributes are of type string and are called parameters. Parameters must have a values attribute specified on them. In this case we have a parameter called extension that is allowed to have ‘*’, ‘h’, or ‘cc’ as a value."

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

In our system we are running a lint program for our c-source files.
This is still done from our old build system (not Bazel).
As an option to the linting program it’s possible to point out a file that contains different linting rules (*.lnt) (which suppress warnings etc).
In our solution different users (who runs the linting program) points out different rule files (*.lnt).

Now we are adding the lint support to our Bazel build system.
We have done that by implement an Aspect.
It all works well except for the ability to point out specific lint rule files (*.lnt)
It would be desirable to let the file be specified in an Aspect attribute which the user could set in the BUILD file. Since we don't know which files that users want to point out.
The problem is that it’s only string attribute that is public for Aspects and for them the values must be specified.

We also plan to use Aspects for other use cases where we also see the same needs.

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

Linux

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

0.25.0

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

No and no attention on the Bazel forum:
https://groups.google.com/forum/#!topic/bazel-discuss/IvfgpZ1nYQM

Contributor guide

Open the contributing guide

Research direction

Start by tracing Bazel's public Aspect attribute handling and its requirement for declared values. Compare the existing string parameter behavior with the requested label and unconstrained-file cases; done means users can select arbitrary lint-rule files or use label-typed attributes from BUILD files.

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
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.