Dynamic defaults for target field values #15809
Replies: 9 comments 30 replies
-
I think most of the core of the discussion will likely be focused on syntax, as (I believe) almost everyone will be on board with the core idea and the implementation discussion can be handled in PR. |
Beta Was this translation helpful? Give feedback.
-
Thoughts on syntax:
|
Beta Was this translation helpful? Give feedback.
-
🧵 Do the default values given in in the positional My vote is definitely. It allows for intuitive overriding of defaults within the defaults overrider (woof) If +1, we should call this out explicitly in doc. |
Beta Was this translation helpful? Give feedback.
-
It would be neat if we could support multiple args, similar to __defaults__({
"go_package": {"tags": ["go"]},
("python_source", "python_test"): {"tags": ["py"]},
}) It's proven very useful with I like this syntax also because it's 100% aligned to |
Beta Was this translation helpful? Give feedback.
-
One tricky thing here is target generators vs atom targets. Do we expect people to set the override for I think in practice, it shouldn't matter much because the Only probably matters if users are manually declaring |
Beta Was this translation helpful? Give feedback.
-
Overall, I really love the proposal: thanks! I left one comment related to whether we can actually eliminate global/built-in defaults for things like the |
Beta Was this translation helpful? Give feedback.
-
I realize that we want to keep the door open for providing options to the __defaults__(
{
my_target: dict(field_a=1, field_b=2),
...
},
replace=True,
opt_foo="bar",
...
) |
Beta Was this translation helpful? Give feedback.
-
Just calling this out, probably OK. Probably OK, just takes a new tint on my BUILD file goggles. |
Beta Was this translation helpful? Give feedback.
-
FYI one challenge here will be that some target types do not consistently use the same name for a field. Namely, Python targets call it This might suggest there are some times where we want to keep subsystem options, like |
Beta Was this translation helpful? Give feedback.
-
Design doc: https://docs.google.com/document/d/1KHkAUonCCMrdI7TqEx06mUpPZqItXJBwlCD3tBz5-xw/edit#
Starting a discussion about how we want to support defaults that span multiple targets and/or BUILD files.
PR: #15836
Relates to #13767 and #15803.
I've found long winded comments in Google docs hard to follow, so I think we're better served to keep the discussion going here for the general direction, and leave room for comments on the document itself for grammar nits and structural feedback. Let's try that, thank you :)
Beta Was this translation helpful? Give feedback.
All reactions