Adam
04/20/2026, 5:56 PMval foo by tasks.registering https://github.com/gradle/gradle/pull/37556
I rather like these utils. They help make buildscripts more concise.
I've created an issue to restore them https://github.com/gradle/gradle/issues/37604. Does anyone have thoughts on this?tony
04/20/2026, 5:59 PMAdam
04/20/2026, 6:07 PMAdam
04/20/2026, 6:08 PMtony
04/20/2026, 6:14 PMtasks.register("foo") {}
is better than
val foo by tasks.registering {}
it is not only literally shorter but also doesn't result in unused variables in build scripts, which clutter my IDE interfacePhilip W
04/20/2026, 6:43 PMVampire
04/20/2026, 8:43 PMand disagree on the other point.
Copy codetasks.register("foo") {}
is better than
Matter of point of view. But the point to compare (or also compare) isCopy codeval foo by tasks.registering {}
val foo = tasks.register("foo") {}
which is longer than both the other variants and requires that you duplicate the name, unless you want the variable have a different name.
it is not only literally shorter but also doesn't result in unused variables in build scripts, which clutter my IDE interfaceI think it is several years ago that my IDE has shown those variables as unused, because they are used. Their name defines the name of the element that is created or retrieved. It was only in the beginning of that all where the my IDE has shown them wrongly as unused.
Also, it makes only sense if you need the variable, otherwise you have an unused variable.It is not unused, its name is used and the IDE knows that since years and does not show them as unused.
Does anyone have thoughts on this?I would greatly support having those stay and even extended. Unfortunately, it was long clear that this step will come. When the Gradle folks did not add such delegate property helpers for the new role-defined configuration helper methods (
val foo = configurations.resolvable("foo")) and when I requested them to be added 2.5 years ago, they already said that they will eventually remove the existing ones too (https://github.com/gradle/gradle/issues/27204) 😞
So we probably will have a hard stand getting them to change their mind.
This probably needs to go into some library, providing that functionality is possible.