Merge remote-tracking branch 'upstream/main' into suggest-clear-cache-after-dependency-update

This commit is contained in:
Mario Schünadel
2022-04-28 16:16:25 +02:00
13 changed files with 94676 additions and 94884 deletions

View File

@ -13,7 +13,7 @@ const CACHE_MATCHED_KEY = 'cache-matched-key';
const CACHE_KEY_PREFIX = 'setup-java';
interface PackageManager {
id: 'maven' | 'gradle';
id: 'maven' | 'gradle' | 'sbt';
/**
* Paths of the file that specify the files to cache.
*/
@ -32,9 +32,24 @@ const supportedPackageManager: PackageManager[] = [
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']
},
{
id: 'sbt',
path: [
join(os.homedir(), '.ivy2', 'cache'),
join(os.homedir(), '.sbt'),
getCoursierCachePath()
],
pattern: ['**/*.sbt', '**/project/build.properties', '**/project/**.{scala,sbt}']
}
];
function getCoursierCachePath(): string {
if (os.type() === 'Linux') return join(os.homedir(), '.cache', 'coursier');
if (os.type() === 'Darwin') return join(os.homedir(), 'Library', 'Caches', 'Coursier');
return join(os.homedir(), 'AppData', 'Local', 'Coursier', 'Cache');
}
function findPackageManager(id: string): PackageManager {
const packageManager = supportedPackageManager.find(packageManager => packageManager.id === id);
if (packageManager === undefined) {