From 4ebd000afd80478e1c5a51857a79e8d442ce95d9 Mon Sep 17 00:00:00 2001 From: Daz DeBoer Date: Fri, 29 Oct 2021 07:44:45 -0600 Subject: [PATCH] Bundle all downloaded dependency files Previously, only .jar files were bundled, with other files (modules, POMs, zips, etc) being left in Gradle User Home. All downloaded files are now included in the bundle. Fixes #100 --- .github/workflows/integTest-caching-config.yml | 4 ++-- action.yml | 2 +- src/cache-utils.ts | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/integTest-caching-config.yml b/.github/workflows/integTest-caching-config.yml index 49093db..dfec98b 100644 --- a/.github/workflows/integTest-caching-config.yml +++ b/.github/workflows/integTest-caching-config.yml @@ -36,7 +36,7 @@ jobs: gradle-home-cache-artifact-bundles: | [ ["generated-gradle-jars", "caches/*/generated-gradle-jars/*.jar"], - ["dependency-jars", "caches/modules-*/files-*/**/*.jar"], + ["dependencies", "caches/modules-*/files-*/*/*/*/*/"], ["instrumented-jars", "caches/jars-*/*/"], ["kotlin-dsl", "caches/*/kotlin-dsl/*/*/"] ] @@ -67,7 +67,7 @@ jobs: gradle-home-cache-artifact-bundles: | [ ["generated-gradle-jars", "caches/*/generated-gradle-jars/*.jar"], - ["dependency-jars", "caches/modules-*/files-*/**/*.jar"], + ["dependencies", "caches/modules-*/files-*/*/*/*/*/"], ["instrumented-jars", "caches/jars-*/*/"], ["kotlin-dsl", "caches/*/kotlin-dsl/*/*/"] ] diff --git a/action.yml b/action.yml index 42fc79e..1b577a6 100644 --- a/action.yml +++ b/action.yml @@ -62,7 +62,7 @@ inputs: [ ["generated-gradle-jars", "caches/*/generated-gradle-jars/*.jar"], ["wrapper-zips", "wrapper/dists/*/*/*.zip"], - ["dependency-jars", "caches/modules-*/files-*/**/*.jar"], + ["dependencies", "caches/modules-*/files-*/*/*/*/*/"], ["instrumented-jars", "caches/jars-*/*/"], ["kotlin-dsl", "caches/*/kotlin-dsl/*/*/"] ] diff --git a/src/cache-utils.ts b/src/cache-utils.ts index 73b054a..efc8bc5 100644 --- a/src/cache-utils.ts +++ b/src/cache-utils.ts @@ -5,6 +5,8 @@ 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 JOB_CONTEXT_PARAMETER = 'workflow-job-context' @@ -25,7 +27,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] || 'v3-' + return process.env[CACHE_PREFIX_VAR] || CACHE_PROTOCOL_VERSION } function generateCacheKey(cacheName: string): CacheKey {