mirror of
https://github.com/actions/setup-java
synced 2024-12-22 21:22:41 +00:00
Dont fail if jdkFile not set until checking cache
This commit is contained in:
parent
609f104c5b
commit
012e07621e
5 changed files with 11 additions and 3 deletions
|
@ -11,7 +11,7 @@ inputs:
|
|||
default: 'x64'
|
||||
jdkFile:
|
||||
description: 'Path to where the compressed JDK is located. The path could be in your source repository or a local path on the agent.'
|
||||
required: true
|
||||
required: false
|
||||
runs:
|
||||
using: 'node12'
|
||||
main: 'lib/setup-java.js'
|
||||
|
|
|
@ -46,6 +46,9 @@ function getJava(version, arch, jdkFile) {
|
|||
core.debug(`Tool found in cache ${toolPath}`);
|
||||
}
|
||||
else {
|
||||
if (!jdkFile) {
|
||||
throw new Error(`Failed to find Java ${version} in the cache. Please specify a valid jdk file to install from instead.`);
|
||||
}
|
||||
core.debug('Retrieving Jdk from local path');
|
||||
const compressedFileExtension = getFileEnding(jdkFile);
|
||||
let tempDir = path.join(tempDirectory, 'temp_' + Math.floor(Math.random() * 2000000000));
|
||||
|
|
|
@ -23,7 +23,7 @@ function run() {
|
|||
try {
|
||||
const version = core.getInput('version', { required: true });
|
||||
const arch = core.getInput('architecture', { required: true });
|
||||
const jdkFile = core.getInput('jdkFile', { required: true });
|
||||
const jdkFile = core.getInput('jdkFile', { required: false }) || '';
|
||||
yield installer.getJava(version, arch, jdkFile);
|
||||
const matchersPath = path.join(__dirname, '..', '.github');
|
||||
console.log(`##[add-matcher]${path.join(matchersPath, 'java.json')}`);
|
||||
|
|
|
@ -34,6 +34,11 @@ export async function getJava(
|
|||
if (toolPath) {
|
||||
core.debug(`Tool found in cache ${toolPath}`);
|
||||
} else {
|
||||
if (!jdkFile) {
|
||||
throw new Error(
|
||||
`Failed to find Java ${version} in the cache. Please specify a valid jdk file to install from instead.`
|
||||
);
|
||||
}
|
||||
core.debug('Retrieving Jdk from local path');
|
||||
const compressedFileExtension = getFileEnding(jdkFile);
|
||||
let tempDir: string = path.join(
|
||||
|
|
|
@ -6,7 +6,7 @@ async function run() {
|
|||
try {
|
||||
const version = core.getInput('version', {required: true});
|
||||
const arch = core.getInput('architecture', {required: true});
|
||||
const jdkFile = core.getInput('jdkFile', {required: true});
|
||||
const jdkFile = core.getInput('jdkFile', {required: false}) || '';
|
||||
|
||||
await installer.getJava(version, arch, jdkFile);
|
||||
|
||||
|
|
Loading…
Reference in a new issue