Caleb Cushing
10/25/2024, 4:50 PMProperty convention mutate the original property, or does it return a new one? I'm definitely writing code like it returns a new one...Thomas Broyer
10/25/2024, 5:16 PMset() with lower priority (won't change the property value if one has already been set())Caleb Cushing
10/25/2024, 5:17 PMThomas Broyer
10/25/2024, 5:17 PMReturns: this
Caleb Cushing
10/25/2024, 5:17 PMCaleb Cushing
10/25/2024, 5:18 PMCaleb Cushing
10/25/2024, 5:21 PMVampire
10/25/2024, 5:43 PMVampire
10/25/2024, 5:44 PMProperty instance.
So if convention would return a new instance, that would be counter-productive.
Also typically you set those conventions from the plugin that registers a task or extension.Caleb Cushing
10/25/2024, 6:04 PMProperty and then call convention... so the property is kind of set up first. I'm not doing something like Property.convention("...") to create them, gradle is injecting or whatever. since I'm always chaining then I've basically set them up right before extracting, so from an API perspective... I wasn't really able to intuit whether and what kind of builder. (I mean prop.convention("foo").get() doesn't intuit that convention is mutating, and we aren't really supposed to be calling get most of the time.
I should have read the docs though...Caleb Cushing
10/25/2024, 6:06 PMProperty.convention(...) would be nice 😛 and can I get a simple Provider interface? haven't quite figured out why creating a Provider requires gradle to do it... but these are other topics entirelyVampire
10/25/2024, 6:22 PMgetOrElse.
As I said, usually you set the convention in the plugin that registers the according task or extension,
so that every consumer sees that convention if no explicit value was set.Vampire
10/25/2024, 6:23 PMconvention at execution time before getting the property might even be an anti-pattern, as it changes the configuration actually.Caleb Cushing
10/25/2024, 8:05 PMCaleb Cushing
10/25/2024, 8:06 PMVampire
10/25/2024, 10:52 PMafterEvaluate brings, ordering problems and race conditions.Caleb Cushing
10/25/2024, 10:53 PMCaleb Cushing
10/25/2024, 10:54 PMVampire
10/25/2024, 10:55 PMCaleb Cushing
10/25/2024, 10:58 PMVampire
10/25/2024, 10:59 PMProperty is for evaluation at execution time. Whenever you evaluate at configuration time, you create ordering problems and race conditions just like if you would use afterEvaluate.
`Property`s are for wiring together and only evaluated at execution time. If I need something at configuration time, I don't make it a Property, but a function parameter, or nested one level so that the setting is wrapped in a function call.Vampire
10/25/2024, 10:59 PMthen why have the values if nothing ever uses them?
Why noone?
Vampire
10/25/2024, 11:00 PMCaleb Cushing
10/25/2024, 11:00 PM.get() which I also could have used .map but since I'm working on configuring publishing I'm working with a bunch of stuff which isn't lazyCaleb Cushing
10/25/2024, 11:01 PMCaleb Cushing
10/25/2024, 11:02 PMsomething.set(extension.myprop.convention("foo").map { } ) that's always where it ends up being... right before its useCaleb Cushing
10/25/2024, 11:03 PMVampire
10/25/2024, 11:04 PMCaleb Cushing
10/25/2024, 11:04 PMCaleb Cushing
10/25/2024, 11:04 PMVampire
10/25/2024, 11:05 PMCaleb Cushing
10/25/2024, 11:05 PMbuild() anyways, I get how it works nowCaleb Cushing
10/25/2024, 11:05 PMBuilder in the class nameCaleb Cushing
10/25/2024, 11:05 PMVampire
10/25/2024, 11:05 PMCaleb Cushing
10/25/2024, 11:07 PMVampire
10/25/2024, 11:07 PMCaleb Cushing
10/25/2024, 11:07 PMVampire
10/25/2024, 11:08 PMCaleb Cushing
10/25/2024, 11:08 PMCaleb Cushing
10/25/2024, 11:09 PMVampire
10/25/2024, 11:09 PMCaleb Cushing
10/25/2024, 11:09 PMCaleb Cushing
10/25/2024, 11:11 PMVampire
10/25/2024, 11:11 PMCaleb Cushing
10/25/2024, 11:11 PMCaleb Cushing
10/25/2024, 11:12 PMCaleb Cushing
10/25/2024, 11:13 PMCaleb Cushing
10/25/2024, 11:13 PMVampire
10/25/2024, 11:14 PMCaleb Cushing
10/25/2024, 11:15 PMCaleb Cushing
10/25/2024, 11:15 PMCaleb Cushing
10/25/2024, 11:16 PMVampire
10/25/2024, 11:16 PMCaleb Cushing
10/25/2024, 11:18 PMCaleb Cushing
10/25/2024, 11:20 PM