mirror of
https://github.com/gradle/actions
synced 2024-11-27 11:52:24 +00:00
Use Gradle 8.11 as the minimum version for cache-cleanup
The cache-cleanup API has changed, so the init-script that worked with Gradle 8.9 no longer works with 8.11. We now provision and use Gradle 8.11 for cache cleanup. This provides a band-aid fix for #417 but that issue will still impact any build configured to run with Gradle > 8.11
This commit is contained in:
parent
4ec844e551
commit
f22ac61fd1
4 changed files with 14 additions and 16 deletions
2
.github/workflows/ci-check-and-unit-test.yml
vendored
2
.github/workflows/ci-check-and-unit-test.yml
vendored
|
@ -28,7 +28,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
ALLOWED_GRADLE_WRAPPER_CHECKSUMS: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 # Invalid wrapper jar used for testing
|
ALLOWED_GRADLE_WRAPPER_CHECKSUMS: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 # Invalid wrapper jar used for testing
|
||||||
with:
|
with:
|
||||||
gradle-version: "8.10.2"
|
gradle-version: "8.11"
|
||||||
|
|
||||||
- name: Check formatting and compile
|
- name: Check formatting and compile
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
# Configuration file for asdf version manager
|
# Configuration file for asdf version manager
|
||||||
nodejs 20.10.0
|
nodejs 20.10.0
|
||||||
gradle 8.10.2
|
gradle 8.11
|
||||||
|
|
|
@ -44,19 +44,20 @@ export class CacheCleaner {
|
||||||
settings.caches {
|
settings.caches {
|
||||||
cleanup = Cleanup.ALWAYS
|
cleanup = Cleanup.ALWAYS
|
||||||
|
|
||||||
releasedWrappers.removeUnusedEntriesOlderThan.set(cleanupTime)
|
releasedWrappers.setRemoveUnusedEntriesOlderThan(cleanupTime)
|
||||||
snapshotWrappers.removeUnusedEntriesOlderThan.set(cleanupTime)
|
snapshotWrappers.setRemoveUnusedEntriesOlderThan(cleanupTime)
|
||||||
downloadedResources.removeUnusedEntriesOlderThan.set(cleanupTime)
|
downloadedResources.setRemoveUnusedEntriesOlderThan(cleanupTime)
|
||||||
createdResources.removeUnusedEntriesOlderThan.set(cleanupTime)
|
createdResources.setRemoveUnusedEntriesOlderThan(cleanupTime)
|
||||||
buildCache.removeUnusedEntriesOlderThan.set(cleanupTime)
|
buildCache.setRemoveUnusedEntriesOlderThan(cleanupTime)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
)
|
)
|
||||||
fs.writeFileSync(path.resolve(cleanupProjectDir, 'build.gradle'), 'task("noop") {}')
|
fs.writeFileSync(path.resolve(cleanupProjectDir, 'build.gradle'), 'task("noop") {}')
|
||||||
|
|
||||||
// Gradle >= 8.9 required for cache cleanup
|
// Gradle >= 8.11 required for cache cleanup
|
||||||
const executable = await provisioner.provisionGradleAtLeast('8.9')
|
// TODO: This is ineffective: we should be using the newest version of Gradle that ran a build, or a newer version if it's available on PATH.
|
||||||
|
const executable = await provisioner.provisionGradleAtLeast('8.11')
|
||||||
|
|
||||||
await core.group('Executing Gradle to clean up caches', async () => {
|
await core.group('Executing Gradle to clean up caches', async () => {
|
||||||
core.info(`Cleaning up caches last used before ${cleanTimestamp}`)
|
core.info(`Cleaning up caches last used before ${cleanTimestamp}`)
|
||||||
|
@ -78,11 +79,8 @@ export class CacheCleaner {
|
||||||
'noop'
|
'noop'
|
||||||
]
|
]
|
||||||
|
|
||||||
const result = await exec.getExecOutput(executable, args, {
|
await exec.exec(executable, args, {
|
||||||
cwd: cleanupProjectDir,
|
cwd: cleanupProjectDir
|
||||||
silent: true
|
|
||||||
})
|
})
|
||||||
|
|
||||||
core.info(result.stdout)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,8 +53,8 @@ test('will cleanup unused gradle versions', async () => {
|
||||||
const transforms3 = path.resolve(gradleUserHome, "caches/transforms-3")
|
const transforms3 = path.resolve(gradleUserHome, "caches/transforms-3")
|
||||||
const metadata100 = path.resolve(gradleUserHome, "caches/modules-2/metadata-2.100")
|
const metadata100 = path.resolve(gradleUserHome, "caches/modules-2/metadata-2.100")
|
||||||
const wrapper802 = path.resolve(gradleUserHome, "wrapper/dists/gradle-8.0.2-bin")
|
const wrapper802 = path.resolve(gradleUserHome, "wrapper/dists/gradle-8.0.2-bin")
|
||||||
const gradleCurrent = path.resolve(gradleUserHome, "caches/8.10.2")
|
const gradleCurrent = path.resolve(gradleUserHome, "caches/8.11")
|
||||||
const metadataCurrent = path.resolve(gradleUserHome, "caches/modules-2/metadata-2.106")
|
const metadataCurrent = path.resolve(gradleUserHome, "caches/modules-2/metadata-2.107")
|
||||||
|
|
||||||
expect(fs.existsSync(gradle802)).toBe(true)
|
expect(fs.existsSync(gradle802)).toBe(true)
|
||||||
expect(fs.existsSync(transforms3)).toBe(true)
|
expect(fs.existsSync(transforms3)).toBe(true)
|
||||||
|
|
Loading…
Reference in a new issue