From 45b7b136cfb310c1722227968931d6e69ac80d90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Sch=C3=BCnadel?= Date: Mon, 25 Apr 2022 13:40:12 +0200 Subject: [PATCH] only Versions.kt and Dependencies.kt as cache key --- README.md | 2 +- __tests__/cache.test.ts | 2 +- dist/cleanup/index.js | 7 ++++++- dist/setup/index.js | 7 ++++++- src/cache.ts | 7 ++++++- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index cfd41634..cc9760b4 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ Currently, the following distributions are supported: ### Caching packages dependencies The action has a built-in functionality for caching and restoring dependencies. It uses [actions/cache](https://github.com/actions/cache) under hood for caching dependencies but requires less configuration settings. Supported package managers are gradle and maven. The format of the used cache key is `setup-java-${{ platform }}-${{ packageManager }}-${{ fileHash }}`, where the hash is based on the following files: -- gradle: `**/*.gradle*`, `**/gradle-wrapper.properties`, `buildSrc/**/*.kt` +- gradle: `**/*.gradle*`, `**/gradle-wrapper.properties`, `buildSrc/**/Versions.kt`, `buildSrc/**/Dependencies.kt` - maven: `**/pom.xml` - sbt: `**/build.sbt` diff --git a/__tests__/cache.test.ts b/__tests__/cache.test.ts index bb7ead85..f7f151b5 100644 --- a/__tests__/cache.test.ts +++ b/__tests__/cache.test.ts @@ -98,7 +98,7 @@ describe('dependency cache', () => { await expect(restore('gradle')).rejects.toThrowError( `No file in ${projectRoot( workspace - )} matched to [**/*.gradle*,**/gradle-wrapper.properties,buildSrc/**/*.kt], make sure you have checked out the target repository` + )} matched to [**/*.gradle*,**/gradle-wrapper.properties,buildSrc/**/Versions.kt,buildSrc/**/Dependencies.kt], make sure you have checked out the target repository` ); }); it('downloads cache based on build.gradle', async () => { diff --git a/dist/cleanup/index.js b/dist/cleanup/index.js index ca0dd279..52330db0 100644 --- a/dist/cleanup/index.js +++ b/dist/cleanup/index.js @@ -63299,7 +63299,12 @@ const supportedPackageManager = [ id: 'gradle', path: [path_1.join(os_1.default.homedir(), '.gradle', 'caches'), path_1.join(os_1.default.homedir(), '.gradle', 'wrapper')], // https://github.com/actions/cache/blob/0638051e9af2c23d10bb70fa9beffcad6cff9ce3/examples.md#java---gradle - pattern: ['**/*.gradle*', '**/gradle-wrapper.properties', 'buildSrc/**/*.kt'] + pattern: [ + '**/*.gradle*', + '**/gradle-wrapper.properties', + 'buildSrc/**/Versions.kt', + 'buildSrc/**/Dependencies.kt' + ] }, { id: 'sbt', diff --git a/dist/setup/index.js b/dist/setup/index.js index 0cd24a4b..0f3e330a 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -18631,7 +18631,12 @@ const supportedPackageManager = [ id: 'gradle', path: [path_1.join(os_1.default.homedir(), '.gradle', 'caches'), path_1.join(os_1.default.homedir(), '.gradle', 'wrapper')], // https://github.com/actions/cache/blob/0638051e9af2c23d10bb70fa9beffcad6cff9ce3/examples.md#java---gradle - pattern: ['**/*.gradle*', '**/gradle-wrapper.properties', 'buildSrc/**/*.kt'] + pattern: [ + '**/*.gradle*', + '**/gradle-wrapper.properties', + 'buildSrc/**/Versions.kt', + 'buildSrc/**/Dependencies.kt' + ] }, { id: 'sbt', diff --git a/src/cache.ts b/src/cache.ts index 75186c6b..08c85508 100644 --- a/src/cache.ts +++ b/src/cache.ts @@ -31,7 +31,12 @@ const supportedPackageManager: PackageManager[] = [ id: 'gradle', path: [join(os.homedir(), '.gradle', 'caches'), join(os.homedir(), '.gradle', 'wrapper')], // https://github.com/actions/cache/blob/0638051e9af2c23d10bb70fa9beffcad6cff9ce3/examples.md#java---gradle - pattern: ['**/*.gradle*', '**/gradle-wrapper.properties', 'buildSrc/**/*.kt'] + pattern: [ + '**/*.gradle*', + '**/gradle-wrapper.properties', + 'buildSrc/**/Versions.kt', + 'buildSrc/**/Dependencies.kt' + ] }, { id: 'sbt',