From 6577ca3f320d58894172abc8dd7d6806afd1aeaa Mon Sep 17 00:00:00 2001 From: Olafur Pall Geirsson Date: Sat, 10 Oct 2020 09:51:12 +0200 Subject: [PATCH] Revert "Allow installing JDKs via the 'version=link' syntax (#23)" This reverts commit e39fcfaf37afc5eabd3950c3b77332df3323a221. --- src/install.ts | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/install.ts b/src/install.ts index ef84f12f..c783274a 100644 --- a/src/install.ts +++ b/src/install.ts @@ -49,29 +49,23 @@ function installJava(javaVersion: string, jabbaVersion: string) { shell.set("-ev"); shell.exec(`curl -sL -o ${jabba} ${jabbaUrl}`, { silent: true }); shell.chmod(755, jabba); - // if a string using the 'version=url' format is provided, respect it (e.g. 1.14.0=tgz+https://link.to.tarball.tgz) - const javaVersionSearch = javaVersion.split('=')[0]; - const useVersion = shell + const toInstall = shell .exec(`${jabba} ls-remote`) - .grep(javaVersionSearch) + .grep(javaVersion) .head({ "-n": 1 }) .stdout.trim(); - var toInstall = useVersion; - if (!useVersion) { - core.setFailed(`Couldn't find Java ${javaVersionSearch}. To fix this problem, run 'jabba ls-remote' to see the list of valid Java versions.`); + if (!toInstall) { + core.setFailed(`Couldn't find Java ${javaVersion}. To fix this problem, run 'jabba ls-remote' to see the list of valid Java versions.`); return; } - if (javaVersion !== javaVersionSearch) { - toInstall = javaVersion; - } console.log(`Installing ${toInstall}`); const result = shell.exec(`${jabba} install ${toInstall}`); if (result.code > 0) { - core.setFailed(`Failed to install Java ${toInstall}, Jabba stderr: ${result.stderr}`); + core.setFailed(`Failed to install Java ${javaVersion}, Jabba stderr: ${result.stderr}`); return; } const javaHome = shell - .exec(`${jabba} which --home ${useVersion}`) + .exec(`${jabba} which --home ${toInstall}`) .stdout.trim(); core.exportVariable("JAVA_HOME", javaHome); core.addPath(path.join(javaHome, "bin"));