From c157d0a33224e1b9d7490726dded57e91042ed4e Mon Sep 17 00:00:00 2001 From: Daz DeBoer Date: Fri, 17 Dec 2021 15:48:05 -0700 Subject: [PATCH] Cache downloaded Java Toolchains Due to limitations with the way extracted entries are defined, a separate entry is defined for *nix and windows. Fixes #33 --- action.yml | 8 +++++--- src/cache-gradle-user-home.ts | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index 5a1ad52..6596af2 100644 --- a/action.yml +++ b/action.yml @@ -62,9 +62,11 @@ inputs: [ ["generated-gradle-jars", "caches/*/generated-gradle-jars/*.jar"], ["wrapper-zips", "wrapper/dists/*/*/*.zip"], - ["dependencies", "caches/modules-*/files-*/*/*/*/*/"], - ["instrumented-jars", "caches/jars-*/*/"], - ["kotlin-dsl", "caches/*/kotlin-dsl/*/*/"] + ["java-toolchains-win", "jdks/*.zip"], + ["java-toolchains-nix", "jdks/*.tar.gz"], + ["dependencies", "caches/modules-*/files-*/*/*/*/*"], + ["instrumented-jars", "caches/jars-*/*"], + ["kotlin-dsl", "caches/*/kotlin-dsl/*/*"] ] outputs: diff --git a/src/cache-gradle-user-home.ts b/src/cache-gradle-user-home.ts index c59ceea..42b8991 100644 --- a/src/cache-gradle-user-home.ts +++ b/src/cache-gradle-user-home.ts @@ -229,7 +229,8 @@ export class GradleUserHomeCache extends AbstractCache { } private isBundlePattern(pattern: string): boolean { - return pattern.endsWith('*') + // If pattern ends with `/*`, then we cache as a "bundle": all of the matching files in a single cache entry + return pattern.endsWith(`${path.sep}*`) } private async collectCacheResults(processes: Promise[]): Promise {