mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-11-26 02:52:09 +00:00
Don't create entry for non-existant directory
- Filter out config-cache directories that do not exist when constructing cache entry definitions
This commit is contained in:
parent
57f3f23714
commit
63ce84df08
1 changed files with 9 additions and 7 deletions
|
@ -402,8 +402,7 @@ export class ConfigurationCacheEntryExtractor extends AbstractEntryExtractor {
|
||||||
* Extract cache entries for the configuration cache in each project.
|
* Extract cache entries for the configuration cache in each project.
|
||||||
*/
|
*/
|
||||||
protected getExtractedCacheEntryDefinitions(): ExtractedCacheEntryDefinition[] {
|
protected getExtractedCacheEntryDefinitions(): ExtractedCacheEntryDefinition[] {
|
||||||
return this.getProjectRoots().map(projectRoot => {
|
return this.getConfigCacheDirs().map(configCachePath => {
|
||||||
const configCachePath = path.resolve(projectRoot, '.gradle/configuration-cache')
|
|
||||||
return new ExtractedCacheEntryDefinition(
|
return new ExtractedCacheEntryDefinition(
|
||||||
'configuration-cache',
|
'configuration-cache',
|
||||||
configCachePath,
|
configCachePath,
|
||||||
|
@ -413,12 +412,15 @@ export class ConfigurationCacheEntryExtractor extends AbstractEntryExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For every Gradle invocation, we record the project root directory. This method returns the entire
|
* For every Gradle invocation, we record the project root directory.
|
||||||
* set of project roots, to allow saving of configuration-cache entries for each.
|
* This method returns any configuraton-cache directories found in any of these project roots.
|
||||||
*/
|
*/
|
||||||
private getProjectRoots(): string[] {
|
private getConfigCacheDirs(): string[] {
|
||||||
const buildResults = loadBuildResults()
|
const buildResults = loadBuildResults()
|
||||||
const projectRootDirs = buildResults.map(x => x.rootProjectDir)
|
const configCacheDirs = buildResults
|
||||||
return [...new Set(projectRootDirs)] // Remove duplicates
|
.map(x => path.resolve(x.rootProjectDir, '.gradle/configuration-cache'))
|
||||||
|
.filter(x => fs.existsSync(x))
|
||||||
|
|
||||||
|
return [...new Set(configCacheDirs)] // Remove duplicates
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue