mirror of
https://github.com/actions/setup-java.git
synced 2025-04-19 09:26:46 +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
|
@ -1,18 +1,24 @@
|
|||
import fs from 'fs';
|
||||
import * as core from '@actions/core';
|
||||
import * as auth from './auth';
|
||||
import { getBooleanInput, isCacheFeatureAvailable, getVersionFromFileContent } from './util';
|
||||
import {
|
||||
getBooleanInput,
|
||||
isCacheFeatureAvailable,
|
||||
getVersionFromFileContent
|
||||
} from './util';
|
||||
import * as toolchains from './toolchains';
|
||||
import * as constants from './constants';
|
||||
import { restore } from './cache';
|
||||
import {restore} from './cache';
|
||||
import * as path from 'path';
|
||||
import { getJavaDistribution } from './distributions/distribution-factory';
|
||||
import { JavaInstallerOptions } from './distributions/base-models';
|
||||
import {getJavaDistribution} from './distributions/distribution-factory';
|
||||
import {JavaInstallerOptions} from './distributions/base-models';
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
const versions = core.getMultilineInput(constants.INPUT_JAVA_VERSION);
|
||||
const distributionName = core.getInput(constants.INPUT_DISTRIBUTION, { required: true });
|
||||
const distributionName = core.getInput(constants.INPUT_DISTRIBUTION, {
|
||||
required: true
|
||||
});
|
||||
const versionFile = core.getInput(constants.INPUT_JAVA_VERSION_FILE);
|
||||
const architecture = core.getInput(constants.INPUT_ARCHITECTURE);
|
||||
const packageType = core.getInput(constants.INPUT_JAVA_PACKAGE);
|
||||
|
@ -41,17 +47,18 @@ async function run() {
|
|||
};
|
||||
|
||||
if (!versions.length) {
|
||||
core.debug('java-version input is empty, looking for java-version-file input');
|
||||
const content = fs
|
||||
.readFileSync(versionFile)
|
||||
.toString()
|
||||
.trim();
|
||||
core.debug(
|
||||
'java-version input is empty, looking for java-version-file input'
|
||||
);
|
||||
const content = fs.readFileSync(versionFile).toString().trim();
|
||||
|
||||
const version = getVersionFromFileContent(content, distributionName);
|
||||
core.debug(`Parsed version from file '${version}'`);
|
||||
|
||||
if (!version) {
|
||||
throw new Error(`No supported version was found in file ${versionFile}`);
|
||||
throw new Error(
|
||||
`No supported version was found in file ${versionFile}`
|
||||
);
|
||||
}
|
||||
|
||||
await installVersion(version, installerInputsOptions);
|
||||
|
@ -75,7 +82,11 @@ async function run() {
|
|||
|
||||
run();
|
||||
|
||||
async function installVersion(version: string, options: installerInputsOptions, toolchainId = 0) {
|
||||
async function installVersion(
|
||||
version: string,
|
||||
options: installerInputsOptions,
|
||||
toolchainId = 0
|
||||
) {
|
||||
const {
|
||||
distributionName,
|
||||
jdkFile,
|
||||
|
@ -92,9 +103,15 @@ async function installVersion(version: string, options: installerInputsOptions,
|
|||
version
|
||||
};
|
||||
|
||||
const distribution = getJavaDistribution(distributionName, installerOptions, jdkFile);
|
||||
const distribution = getJavaDistribution(
|
||||
distributionName,
|
||||
installerOptions,
|
||||
jdkFile
|
||||
);
|
||||
if (!distribution) {
|
||||
throw new Error(`No supported distribution was found for input ${distributionName}`);
|
||||
throw new Error(
|
||||
`No supported distribution was found for input ${distributionName}`
|
||||
);
|
||||
}
|
||||
|
||||
const result = await distribution.setupJava();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue