mirror of
https://github.com/gradle/gradle-build-action.git
synced 2025-06-07 16:56:12 +02:00
Refactor: use a single .json file to describe all cached artifact bundles (#121)
This is a pure refactor, moving from a separate .cache file per bundle to a single cache-metadata.json file describing all bundles. Instead of storing cache metadata in a separate .cache file per artifact bundle, all of the metadata is now stored in a single `.json` file. This will make it easier to implement more flexible artifact-caching strategies, such as caching each wrapper zip separately. * Always include cache protocol version in cache key * Store all cache metadata in a single JSON file * Rename cache-metadata file and bump protocol version * Polish and documentation
This commit is contained in:
parent
92a1f98d35
commit
322805e800
10 changed files with 199 additions and 88 deletions
|
@ -4,8 +4,6 @@ import * as crypto from 'crypto'
|
|||
import * as path from 'path'
|
||||
import * as fs from 'fs'
|
||||
|
||||
const CACHE_PROTOCOL_VERSION = 'v4-'
|
||||
|
||||
const CACHE_DISABLED_PARAMETER = 'cache-disabled'
|
||||
const CACHE_READONLY_PARAMETER = 'cache-read-only'
|
||||
const CACHE_DEBUG_VAR = 'GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED'
|
||||
|
@ -25,7 +23,7 @@ export function isCacheDebuggingEnabled(): boolean {
|
|||
|
||||
export function getCacheKeyPrefix(): string {
|
||||
// Prefix can be used to force change all cache keys (defaults to cache protocol version)
|
||||
return process.env[CACHE_PREFIX_VAR] || CACHE_PROTOCOL_VERSION
|
||||
return process.env[CACHE_PREFIX_VAR] || ''
|
||||
}
|
||||
|
||||
export function hashStrings(values: string[]): string {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue