Save/restore exploded Gradle dist rather than zip

To save space, future versions of Gradle are likely to delete the downloaded distribution
after extracting it. See gradle/gradle#3605 and gradle/gradle#19495.
To cater for this we will now save/restore the extracted distribution rather than the
downloaded zip file.
This commit is contained in:
Daz DeBoer 2022-04-04 21:22:46 -06:00
parent bd717aced6
commit 0e24fa1975
No known key found for this signature in database
GPG key ID: DD6B9F0B06683D5D
5 changed files with 13 additions and 7 deletions

2
dist/main/index.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/post/index.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -304,13 +304,19 @@ export class GradleHomeEntryExtractor extends AbstractEntryExtractor {
patterns: string[],
bundle: boolean
): ExtractedCacheEntryDefinition => {
const resolvedPattern = patterns.map(x => path.resolve(this.gradleUserHome, x)).join('\n')
return new ExtractedCacheEntryDefinition(artifactType, resolvedPattern, bundle)
const resolvedPatterns = patterns
.map(x => {
const isDir = x.endsWith('/')
const resolved = path.resolve(this.gradleUserHome, x)
return isDir ? `${resolved}/` : resolved // Restore trailing '/' removed by path.resolve()
})
.join('\n')
return new ExtractedCacheEntryDefinition(artifactType, resolvedPatterns, bundle)
}
return [
entryDefinition('generated-gradle-jars', ['caches/*/generated-gradle-jars/*.jar'], false),
entryDefinition('wrapper-zips', ['wrapper/dists/*/*/*.zip'], false),
entryDefinition('wrapper-zips', ['wrapper/dists/*/*/*/'], false), // Directories only
entryDefinition('java-toolchains', ['jdks/*.zip', 'jdks/*.tar.gz'], false),
entryDefinition('dependencies', ['caches/modules-*/files-*/*/*/*/*'], true),
entryDefinition('instrumented-jars', ['caches/jars-*/*'], true),