ysb33r
09/21/2026, 3:53 PMaddLater or addAllLater on a domain collection especially on a named collection?Philip W
09/21/2026, 4:04 PMNDOC.addAllLater(NDOC.elements.map { it.map { objectFactory.newInstance(Foo::class, it.name).apply {} }}Philip W
09/21/2026, 4:04 PMPhilip W
09/21/2026, 4:05 PMysb33r
09/21/2026, 4:26 PMPhilip W
09/21/2026, 4:27 PMPhilip W
09/21/2026, 4:27 PMysb33r
09/21/2026, 4:29 PMTaskContainer does extend DomainObjectCollection which provides the addAllLater method.
I've never tried it, but it is there on paper.Philip W
09/21/2026, 4:29 PMysb33r
09/21/2026, 4:46 PMVampire
09/21/2026, 4:55 PMVampire
09/21/2026, 4:56 PMval foo = providers.gradleProperty("foo")
tasks.addRule("Task 'bar' if project property 'foo' is set") {
if (foo.isPresent && (this == "bar")) {
tasks.register(this) {
doLast {
println(this)
}
}
}
}ysb33r
09/21/2026, 4:57 PMVampire
09/21/2026, 4:57 PM$ gw -q bar -P foo && echo ============= && gw -q bar
task ':bar'
=============
FAILURE: Build failed with an exception.
* What went wrong:
No matches
Task 'bar' not found in root project 'showcase'. Some candidates are: 'jar'.
* Try:
> Run gradlew tasks to get a list of available tasks.
> For more on name expansion, please refer to <https://docs.gradle.org/9.7.1/userguide/command_line_interface.html#sec:name_abbreviation> in the Gradle documentation.
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights from a Build Scan (powered by Develocity).
> Get more help at <https://help.gradle.org>.
BUILD FAILED in 1sVampire
09/21/2026, 4:58 PMDefaultTaskContainerVampire
09/21/2026, 4:58 PMonlyIf to skip it conditionally