Add experimental support for cache-cleanup

- Includes basic implementation as `CacheCleaner`
- Integration test that checks unused files are removed:
  - Downloaded dependencies
  - Local build cache entries
  - Wrapper distributions
This commit is contained in:
Daz DeBoer 2022-06-12 09:53:04 -06:00
parent ef638c00fd
commit 915123c493
No known key found for this signature in database
GPG key ID: DD6B9F0B06683D5D
14 changed files with 522 additions and 1 deletions

View file

@ -16,6 +16,7 @@ const CACHE_DISABLED_PARAMETER = 'cache-disabled'
const CACHE_READONLY_PARAMETER = 'cache-read-only'
const CACHE_WRITEONLY_PARAMETER = 'cache-write-only'
const STRICT_CACHE_MATCH_PARAMETER = 'gradle-home-cache-strict-match'
const CACHE_CLEANUP_ENABLED_PARAMETER = 'gradle-home-cache-cleanup'
const CACHE_DEBUG_VAR = 'GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED'
const CACHE_KEY_PREFIX_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX'
@ -46,6 +47,10 @@ export function isCacheDebuggingEnabled(): boolean {
return process.env[CACHE_DEBUG_VAR] ? true : false
}
export function isCacheCleanupEnabled(): boolean {
return core.getBooleanInput(CACHE_CLEANUP_ENABLED_PARAMETER)
}
/**
* Represents a key used to restore a cache entry.
* The Github Actions cache will first try for an exact match on the key.