mirror of
https://github.com/actions/setup-java.git
synced 2025-04-21 02:16:45 +00:00
Add and configure ESLint and update configuration for Prettier (#458)
* Add ESLint config and update Prettier * Update test files * Rebuild action * Update docs * Update licenses * Update tsconfig * Rebuild action * Update tsconfig.json * Fix console.time calls * Rebuild action * Rebuild action on Linux
This commit is contained in:
parent
ea15b3b99c
commit
0de5c66fc0
55 changed files with 4402 additions and 1317 deletions
34
src/cache.ts
34
src/cache.ts
|
@ -2,7 +2,7 @@
|
|||
* @fileoverview this file provides methods handling dependency cache
|
||||
*/
|
||||
|
||||
import { join } from 'path';
|
||||
import {join} from 'path';
|
||||
import os from 'os';
|
||||
import * as cache from '@actions/cache';
|
||||
import * as core from '@actions/core';
|
||||
|
@ -29,7 +29,10 @@ const supportedPackageManager: PackageManager[] = [
|
|||
},
|
||||
{
|
||||
id: 'gradle',
|
||||
path: [join(os.homedir(), '.gradle', 'caches'), join(os.homedir(), '.gradle', 'wrapper')],
|
||||
path: [
|
||||
join(os.homedir(), '.gradle', 'caches'),
|
||||
join(os.homedir(), '.gradle', 'wrapper')
|
||||
],
|
||||
// https://github.com/actions/cache/blob/0638051e9af2c23d10bb70fa9beffcad6cff9ce3/examples.md#java---gradle
|
||||
pattern: [
|
||||
'**/*.gradle*',
|
||||
|
@ -50,18 +53,25 @@ const supportedPackageManager: PackageManager[] = [
|
|||
'!' + join(os.homedir(), '.sbt', '*.lock'),
|
||||
'!' + join(os.homedir(), '**', 'ivydata-*.properties')
|
||||
],
|
||||
pattern: ['**/*.sbt', '**/project/build.properties', '**/project/**.{scala,sbt}']
|
||||
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');
|
||||
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);
|
||||
const packageManager = supportedPackageManager.find(
|
||||
packageManager => packageManager.id === id
|
||||
);
|
||||
if (packageManager === undefined) {
|
||||
throw new Error(`unknown package manager specified: ${id}`);
|
||||
}
|
||||
|
@ -125,7 +135,9 @@ export async function save(id: string) {
|
|||
return;
|
||||
} else if (matchedKey === primaryKey) {
|
||||
// no change in target directories
|
||||
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
|
||||
core.info(
|
||||
`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`
|
||||
);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
|
@ -151,8 +163,14 @@ export async function save(id: string) {
|
|||
* @returns true if the given error seems related to the {@link https://github.com/actions/cache/issues/454|running Gradle Daemon issue}.
|
||||
* @see {@link https://github.com/actions/cache/issues/454#issuecomment-840493935|why --no-daemon is necessary}
|
||||
*/
|
||||
function isProbablyGradleDaemonProblem(packageManager: PackageManager, error: Error) {
|
||||
if (packageManager.id !== 'gradle' || process.env['RUNNER_OS'] !== 'Windows') {
|
||||
function isProbablyGradleDaemonProblem(
|
||||
packageManager: PackageManager,
|
||||
error: Error
|
||||
) {
|
||||
if (
|
||||
packageManager.id !== 'gradle' ||
|
||||
process.env['RUNNER_OS'] !== 'Windows'
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
const message = error.message || '';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue