mirror of
https://github.com/gradle/gradle-build-action.git
synced 2025-09-15 04:02:21 +08:00
Use a BuildService to always collect project root
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.
This commit is contained in:
@@ -170,7 +170,11 @@ export class GradleStateCache {
|
||||
const propertiesFile = path.resolve(gradleUserHome, 'gradle.properties')
|
||||
fs.appendFileSync(propertiesFile, 'org.gradle.daemon=false')
|
||||
|
||||
const initScriptFilenames = ['build-result-capture.init.gradle', 'project-root-capture.init.gradle']
|
||||
const initScriptFilenames = [
|
||||
'build-result-capture.init.gradle',
|
||||
'project-root-capture.init.gradle',
|
||||
'project-root-capture.plugin.groovy'
|
||||
]
|
||||
for (const initScriptFilename of initScriptFilenames) {
|
||||
const initScriptContent = this.readResourceAsString(initScriptFilename)
|
||||
const initScriptPath = path.resolve(initScriptsDir, initScriptFilename)
|
||||
|
Reference in New Issue
Block a user