Skip to content
This repository was archived by the owner on Dec 6, 2022. It is now read-only.

Commit dccd7bb

Browse files
committed
Normalize extendedJavaHome environment variable for AdoptOpenJDK
1 parent 789195c commit dccd7bb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/installer.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,13 @@ async function downloadJavaBinary(
447447
toolPath = await tc.cacheDir(jdkDir, toolName, versionSpec, arch);
448448
}
449449

450-
const extendedJavaHome = `JAVA_HOME_${version}_${arch}`;
450+
let extendedJavaHome = `JAVA_HOME_${version}_${arch}`;
451+
core.exportVariable(extendedJavaHome, toolPath); //TODO: remove for v2
452+
// For portability reasons environment variables should only consist of
453+
// uppercase letters, digits, and the underscore. Therefore we convert
454+
// the extendedJavaHome variable to upper case and replace '.' symbols and
455+
// any other non-alphanumeric characters with an underscore.
456+
extendedJavaHome = extendedJavaHome.toUpperCase().replace(/[^0-9A-Z_]/g, '_');
451457
core.exportVariable('JAVA_HOME', toolPath);
452458
core.exportVariable(extendedJavaHome, toolPath);
453459
core.addPath(path.join(toolPath, 'bin'));

0 commit comments

Comments
 (0)