Skip to content

Commit

Permalink
Revert "Allow installing JDKs via the 'version=link' syntax (#23)"
Browse files Browse the repository at this point in the history
This reverts commit e39fcfa.
  • Loading branch information
Olafur Pall Geirsson committed Oct 10, 2020
1 parent a413c36 commit 6577ca3
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down

0 comments on commit 6577ca3

Please sign in to comment.