-
Notifications
You must be signed in to change notification settings - Fork 5k
Closed
Closed
Copy link
Labels
a:performance-improvementPerformance improvement potentialPerformance improvement potentialin:configuration-modellazy api, domain object containerlazy api, domain object container
Milestone
Description
Related: #20969
Currently, any changes to -P
command-line properties will invalidate the configuration cache, regardless of whether the changed properties are actually used at configuration-time or not.
Consider the following simple Kotlin DSL example:
tasks.register("echo") {
val value = providers.gradleProperty("value")
doLast {
println("value: ${value.orNull}")
}
}
Multiple executions of the echo
task with different -P
arguments will be unable to reuse the configuration cache:
$ gradle --configuration-cache echo -Pvalue=1
Calculating task graph as no cached configuration is available for tasks: echo
> Task :echo
value: 1
...
Configuration cache entry stored.
$ gradle --configuration-cache echo -Pvalue=2
Calculating task graph as configuration cache cannot be reused because the set of Gradle properties has changed: the value of 'value' was changed.
> Task :echo
value: 2
...
Configuration cache entry stored.
Since the value
property is never mentioned at configuration time, Gradle should be able to reuse the configuration cache for faster builds:
$ gradle --configuration-cache echo -Pvalue=1
Calculating task graph as no cached configuration is available for tasks: echo
> Task :echo
value: 1
...
Configuration cache entry stored.
$ gradle --configuration-cache echo -Pvalue=2
Reusing configuration cache.
> Task :echo
value: 2
...
Configuration cache entry reused.
In addition, the Configuration Cache report should also include properties used at configuration-time in the Build configuration inputs tab.
Preparation: #32471
Metadata
Metadata
Labels
a:performance-improvementPerformance improvement potentialPerformance improvement potentialin:configuration-modellazy api, domain object containerlazy api, domain object container