Slackbot
09/23/2023, 1:25 PMThomas Broyer
09/23/2023, 2:48 PMwithType<…> { … }
is equivalent to `withType<…>().all { … }`: https://docs.gradle.org/current/kotlin-dsl/gradle/org.gradle.kotlin.dsl/with-type.html, exactly like Java's withType(class, action)
(https://docs.gradle.org/current/javadoc/org/gradle/api/DomainObjectCollection.html#withType-java.lang.Class-org.gradle.api.Action-)Simon Marquis
09/23/2023, 2:52 PM.all { ... }
behave like .configureEach { ... }
? I tried to find the corresponding source code but did not succeed.Simon Marquis
09/23/2023, 2:54 PMconfigureEach
for no obvious reasons 🤔Thomas Broyer
09/23/2023, 3:06 PM.all { … }
eagerly realizes all tasks, whereas .configureEach { … }
will only configure the task when they are realized by other means (most likely because they need to be executed, that should be the goal). .configureEach { … }
was specifically added for task configuration avoidance.Thomas Broyer
09/23/2023, 3:07 PMInstead of:DomainObjectCollection.all(org.gradle.api.Action)
Use:DomainObjectCollection.configureEach(org.gradle.api.Action)
Thomas Broyer
09/23/2023, 3:08 PMtasks.withType<…>().configureEach { … }
, and avoid tasks.withType<…> { … }
(or the equivalent tasks.withType<…>().all { … }
)Simon Marquis
09/23/2023, 3:58 PMSimon Marquis
09/23/2023, 4:00 PMVampire
09/25/2023, 11:14 AMSimon Marquis
09/25/2023, 11:20 AMVampire
09/25/2023, 11:36 AMtasks.all { }
or tasks.withType<...> { }
you have no "Not created" tasks and many "Created during configuration" tasks.
The "Created during configuration" ones should be near to zero usually.Simon Marquis
09/25/2023, 11:37 AMVampire
09/25/2023, 11:39 AM