-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Closed
Labels
P1I'll work on this now. (Assignee required)I'll work on this now. (Assignee required)incompatible-changeIncompatible/breaking changeIncompatible/breaking change
Description
This flag disables the default parameter on attr.output and attr.output_list.
Flag: --incompatible_no_output_attr_default
Available since: 0.23 (February 2019 release)
Motivation
The previous default parameter of these attribute types was severely bug-prone, as two targets of the same rule would be unable to exist in the same package under default behavior. (Two targets both generating foo.txt in the same package would conflict.)
Additional details in #6241
Migration
Use Starlark macros to specify defaults for these attributes instead.
For example, replace:
my_rule = rule(
...
attrs = {"out" : attr.output(default = "foo.txt")}
...with:
# myrule.bzl
my_rule = rule(
...
attrs = {"out" : attr.output()}
...
# mymacro.bzl
load(":myrule.bzl", _my_rule = "my_rule")
def my_rule(name):
_my_rule(
name = name,
output = "%s_out.txt" % name
)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P1I'll work on this now. (Assignee required)I'll work on this now. (Assignee required)incompatible-changeIncompatible/breaking changeIncompatible/breaking change