mirror of
https://github.com/gradle/actions.git
synced 2025-08-24 19:01:27 +08:00
Using `settingsEvaluated` meant that the project root was not recorded when the build was run with a config-cache hit. This meant that the subsequent build would not restore the config-cache, resulting in a cache miss. In order to avoid issues running the init script on older versions of Gradle the project-collection is extracted into a separate groovy file that is only applied conditionally on Gradle 7 or higher.
11 lines
393 B
Groovy
11 lines
393 B
Groovy
import org.gradle.util.GradleVersion
|
|
|
|
// Only run against root build. Do not run against included builds.
|
|
def isTopLevelBuild = gradle.getParent() == null
|
|
// Only record configuration-cache entries for Gradle 7+
|
|
def isAtLeastGradle7 = GradleVersion.current() >= GradleVersion.version('7.0')
|
|
|
|
if (isTopLevelBuild && isAtLeastGradle7) {
|
|
apply from: 'project-root-capture.plugin.groovy'
|
|
}
|