From 3e3d8c490f8eef69b019e789ceb2c59aed11eab8 Mon Sep 17 00:00:00 2001 From: Florian Meriaux Date: Wed, 25 May 2022 11:39:10 +0200 Subject: [PATCH 1/5] sbt-cache: don't cache some files. --- dist/cleanup/index.js | 5 ++++- dist/setup/index.js | 5 ++++- src/cache.ts | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/dist/cleanup/index.js b/dist/cleanup/index.js index cfa2fb813..235d0c322 100644 --- a/dist/cleanup/index.js +++ b/dist/cleanup/index.js @@ -65448,7 +65448,10 @@ const supportedPackageManager = [ path: [ path_1.join(os_1.default.homedir(), '.ivy2', 'cache'), path_1.join(os_1.default.homedir(), '.sbt'), - getCoursierCachePath() + getCoursierCachePath(), + //TODO: comment the reason of exclusions + '!' + path_1.join(os_1.default.homedir(), '.sbt', '*.lock'), + '!' + path_1.join(os_1.default.homedir(), '**', 'ivydata-*.properties') ], pattern: ['**/*.sbt', '**/project/build.properties', '**/project/**.{scala,sbt}'] } diff --git a/dist/setup/index.js b/dist/setup/index.js index f2a2170f5..0703230d5 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -100653,7 +100653,10 @@ const supportedPackageManager = [ path: [ path_1.join(os_1.default.homedir(), '.ivy2', 'cache'), path_1.join(os_1.default.homedir(), '.sbt'), - getCoursierCachePath() + getCoursierCachePath(), + //TODO: comment the reason of exclusions + '!' + path_1.join(os_1.default.homedir(), '.sbt', '*.lock'), + '!' + path_1.join(os_1.default.homedir(), '**', 'ivydata-*.properties') ], pattern: ['**/*.sbt', '**/project/build.properties', '**/project/**.{scala,sbt}'] } diff --git a/src/cache.ts b/src/cache.ts index 0ddc426de..e73d078e8 100644 --- a/src/cache.ts +++ b/src/cache.ts @@ -38,7 +38,10 @@ const supportedPackageManager: PackageManager[] = [ path: [ join(os.homedir(), '.ivy2', 'cache'), join(os.homedir(), '.sbt'), - getCoursierCachePath() + getCoursierCachePath(), + //TODO: comment the reason of exclusions + '!' + join(os.homedir(), '.sbt', '*.lock'), + '!' + join(os.homedir(), '**', 'ivydata-*.properties') ], pattern: ['**/*.sbt', '**/project/build.properties', '**/project/**.{scala,sbt}'] } From fa01820a3b46185b6e37266c5c6a2777e04297a5 Mon Sep 17 00:00:00 2001 From: Florian Meriaux Date: Wed, 15 Jun 2022 08:10:31 +0200 Subject: [PATCH 2/5] add documentation notes --- dist/cleanup/index.js | 2 +- dist/setup/index.js | 2 +- src/cache.ts | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/cleanup/index.js b/dist/cleanup/index.js index 235d0c322..3f419ec28 100644 --- a/dist/cleanup/index.js +++ b/dist/cleanup/index.js @@ -65449,8 +65449,8 @@ const supportedPackageManager = [ path_1.join(os_1.default.homedir(), '.ivy2', 'cache'), path_1.join(os_1.default.homedir(), '.sbt'), getCoursierCachePath(), - //TODO: comment the reason of exclusions '!' + path_1.join(os_1.default.homedir(), '.sbt', '*.lock'), + // Avoid SNAPSHOT resolution problems by forcing the deletion of these files (due to ideological gaps in maven/ivy). '!' + path_1.join(os_1.default.homedir(), '**', 'ivydata-*.properties') ], pattern: ['**/*.sbt', '**/project/build.properties', '**/project/**.{scala,sbt}'] diff --git a/dist/setup/index.js b/dist/setup/index.js index 0703230d5..2bfd7910f 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -100654,8 +100654,8 @@ const supportedPackageManager = [ path_1.join(os_1.default.homedir(), '.ivy2', 'cache'), path_1.join(os_1.default.homedir(), '.sbt'), getCoursierCachePath(), - //TODO: comment the reason of exclusions '!' + path_1.join(os_1.default.homedir(), '.sbt', '*.lock'), + // Avoid SNAPSHOT resolution problems by forcing the deletion of these files (due to ideological gaps in maven/ivy). '!' + path_1.join(os_1.default.homedir(), '**', 'ivydata-*.properties') ], pattern: ['**/*.sbt', '**/project/build.properties', '**/project/**.{scala,sbt}'] diff --git a/src/cache.ts b/src/cache.ts index e73d078e8..4f920c038 100644 --- a/src/cache.ts +++ b/src/cache.ts @@ -39,7 +39,8 @@ const supportedPackageManager: PackageManager[] = [ join(os.homedir(), '.ivy2', 'cache'), join(os.homedir(), '.sbt'), getCoursierCachePath(), - //TODO: comment the reason of exclusions + // Some files should not be cached to avoid resolution problems. + // In particular the resolution of snapshots (ideological gap between maven/ivy). '!' + join(os.homedir(), '.sbt', '*.lock'), '!' + join(os.homedir(), '**', 'ivydata-*.properties') ], @@ -84,8 +85,7 @@ export async function restore(id: string) { core.saveState(STATE_CACHE_PRIMARY_KEY, primaryKey); if (primaryKey.endsWith('-')) { throw new Error( - `No file in ${process.cwd()} matched to [${ - packageManager.pattern + `No file in ${process.cwd()} matched to [${packageManager.pattern }], make sure you have checked out the target repository` ); } From 48576e577eb8199add8f0dacd8086683cd4b33a7 Mon Sep 17 00:00:00 2001 From: Florian Meriaux Date: Wed, 15 Jun 2022 08:19:27 +0200 Subject: [PATCH 3/5] npm run release --- dist/cleanup/index.js | 3 ++- dist/setup/index.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dist/cleanup/index.js b/dist/cleanup/index.js index 3f419ec28..a96f297c3 100644 --- a/dist/cleanup/index.js +++ b/dist/cleanup/index.js @@ -65449,8 +65449,9 @@ const supportedPackageManager = [ path_1.join(os_1.default.homedir(), '.ivy2', 'cache'), path_1.join(os_1.default.homedir(), '.sbt'), getCoursierCachePath(), + // Some files should not be cached to avoid resolution problems. + // In particular the resolution of snapshots (ideological gap between maven/ivy). '!' + path_1.join(os_1.default.homedir(), '.sbt', '*.lock'), - // Avoid SNAPSHOT resolution problems by forcing the deletion of these files (due to ideological gaps in maven/ivy). '!' + path_1.join(os_1.default.homedir(), '**', 'ivydata-*.properties') ], pattern: ['**/*.sbt', '**/project/build.properties', '**/project/**.{scala,sbt}'] diff --git a/dist/setup/index.js b/dist/setup/index.js index 2bfd7910f..df75cfb1d 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -100654,8 +100654,9 @@ const supportedPackageManager = [ path_1.join(os_1.default.homedir(), '.ivy2', 'cache'), path_1.join(os_1.default.homedir(), '.sbt'), getCoursierCachePath(), + // Some files should not be cached to avoid resolution problems. + // In particular the resolution of snapshots (ideological gap between maven/ivy). '!' + path_1.join(os_1.default.homedir(), '.sbt', '*.lock'), - // Avoid SNAPSHOT resolution problems by forcing the deletion of these files (due to ideological gaps in maven/ivy). '!' + path_1.join(os_1.default.homedir(), '**', 'ivydata-*.properties') ], pattern: ['**/*.sbt', '**/project/build.properties', '**/project/**.{scala,sbt}'] From 187f735c38a0242a92486f37331d269d49e4f1ff Mon Sep 17 00:00:00 2001 From: Florian Meriaux Date: Wed, 15 Jun 2022 08:23:10 +0200 Subject: [PATCH 4/5] npm run format --- src/cache.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cache.ts b/src/cache.ts index 4f920c038..b8c87d865 100644 --- a/src/cache.ts +++ b/src/cache.ts @@ -85,7 +85,8 @@ export async function restore(id: string) { core.saveState(STATE_CACHE_PRIMARY_KEY, primaryKey); if (primaryKey.endsWith('-')) { throw new Error( - `No file in ${process.cwd()} matched to [${packageManager.pattern + `No file in ${process.cwd()} matched to [${ + packageManager.pattern }], make sure you have checked out the target repository` ); } From 7b469c48c4eab9f7176be4e91a7a5f9cf25e1af1 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Thu, 16 Jun 2022 21:47:05 +0100 Subject: [PATCH 5/5] sbt is a valid cache option value --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index c6af975a5..ec05f65ab 100644 --- a/action.yml +++ b/action.yml @@ -54,7 +54,7 @@ inputs: $GPG_PASSPHRASE.' required: false cache: - description: 'Name of the build platform to cache dependencies. It can be "maven" or "gradle".' + description: 'Name of the build platform to cache dependencies. It can be "maven", "gradle" or "sbt".' required: false job-status: description: 'Workaround to pass job status to post job step. This variable is not intended for manual setting'