Commit 012e0762 authored by Danny McCormick's avatar Danny McCormick
Browse files

Dont fail if jdkFile not set until checking cache

parent 609f104c
Loading
Loading
Loading
Loading
+1 −1
Changes for action.yml: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -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'
+3
Changes for lib/installer.js: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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));
+1 −1
Changes for lib/setup-java.js: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -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')}`);
+5
Changes for src/installer.ts: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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(
+1 −1
Changes for src/setup-java.ts: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -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);