diff --git a/.github/workflows/ci-check-and-unit-test.yml b/.github/workflows/ci-check-and-unit-test.yml index 2fb9d440..fdea756f 100644 --- a/.github/workflows/ci-check-and-unit-test.yml +++ b/.github/workflows/ci-check-and-unit-test.yml @@ -28,7 +28,7 @@ jobs: env: ALLOWED_GRADLE_WRAPPER_CHECKSUMS: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 # Invalid wrapper jar used for testing with: - gradle-version: "8.10.2" + gradle-version: "8.11" - name: Check formatting and compile run: | diff --git a/sources/.tool-versions b/sources/.tool-versions index 61180589..9698cf00 100644 --- a/sources/.tool-versions +++ b/sources/.tool-versions @@ -1,3 +1,3 @@ # Configuration file for asdf version manager nodejs 20.10.0 -gradle 8.10.2 +gradle 8.11 diff --git a/sources/src/caching/cache-cleaner.ts b/sources/src/caching/cache-cleaner.ts index e23d5abf..4b3f43e9 100644 --- a/sources/src/caching/cache-cleaner.ts +++ b/sources/src/caching/cache-cleaner.ts @@ -44,19 +44,20 @@ export class CacheCleaner { settings.caches { cleanup = Cleanup.ALWAYS - releasedWrappers.removeUnusedEntriesOlderThan.set(cleanupTime) - snapshotWrappers.removeUnusedEntriesOlderThan.set(cleanupTime) - downloadedResources.removeUnusedEntriesOlderThan.set(cleanupTime) - createdResources.removeUnusedEntriesOlderThan.set(cleanupTime) - buildCache.removeUnusedEntriesOlderThan.set(cleanupTime) + releasedWrappers.setRemoveUnusedEntriesOlderThan(cleanupTime) + snapshotWrappers.setRemoveUnusedEntriesOlderThan(cleanupTime) + downloadedResources.setRemoveUnusedEntriesOlderThan(cleanupTime) + createdResources.setRemoveUnusedEntriesOlderThan(cleanupTime) + buildCache.setRemoveUnusedEntriesOlderThan(cleanupTime) } } ` ) fs.writeFileSync(path.resolve(cleanupProjectDir, 'build.gradle'), 'task("noop") {}') - // Gradle >= 8.9 required for cache cleanup - const executable = await provisioner.provisionGradleAtLeast('8.9') + // Gradle >= 8.11 required for cache cleanup + // 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 () => { core.info(`Cleaning up caches last used before ${cleanTimestamp}`) @@ -78,11 +79,8 @@ export class CacheCleaner { 'noop' ] - const result = await exec.getExecOutput(executable, args, { - cwd: cleanupProjectDir, - silent: true + await exec.exec(executable, args, { + cwd: cleanupProjectDir }) - - core.info(result.stdout) } } diff --git a/sources/test/jest/cache-cleanup.test.ts b/sources/test/jest/cache-cleanup.test.ts index e35b77e3..808e6021 100644 --- a/sources/test/jest/cache-cleanup.test.ts +++ b/sources/test/jest/cache-cleanup.test.ts @@ -53,8 +53,8 @@ test('will cleanup unused gradle versions', async () => { const transforms3 = path.resolve(gradleUserHome, "caches/transforms-3") const metadata100 = path.resolve(gradleUserHome, "caches/modules-2/metadata-2.100") const wrapper802 = path.resolve(gradleUserHome, "wrapper/dists/gradle-8.0.2-bin") - const gradleCurrent = path.resolve(gradleUserHome, "caches/8.10.2") - const metadataCurrent = path.resolve(gradleUserHome, "caches/modules-2/metadata-2.106") + const gradleCurrent = path.resolve(gradleUserHome, "caches/8.11") + const metadataCurrent = path.resolve(gradleUserHome, "caches/modules-2/metadata-2.107") expect(fs.existsSync(gradle802)).toBe(true) expect(fs.existsSync(transforms3)).toBe(true)