mirror of
https://github.com/gradle/gradle-build-action.git
synced 2025-06-07 08:46:10 +02: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:
parent
cde0632795
commit
ae74c01440
4 changed files with 58 additions and 12 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue