mirror of
https://github.com/actions/setup-java
synced 2024-12-22 21:22:41 +00:00
Merge pull request #78 from aibaars/patch-1
Normalize extendedJavaHome environment variable
This commit is contained in:
commit
d920b7da5f
2 changed files with 12 additions and 0 deletions
6
dist/index.js
generated
vendored
6
dist/index.js
generated
vendored
|
@ -4742,6 +4742,12 @@ function getJava(version, arch, jdkFile, javaPackage) {
|
||||||
toolPath = yield tc.cacheDir(jdkDir, javaPackage, getCacheVersionString(version), arch);
|
toolPath = yield tc.cacheDir(jdkDir, javaPackage, getCacheVersionString(version), arch);
|
||||||
}
|
}
|
||||||
let extendedJavaHome = 'JAVA_HOME_' + version + '_' + arch;
|
let extendedJavaHome = 'JAVA_HOME_' + version + '_' + arch;
|
||||||
|
core.exportVariable(extendedJavaHome, toolPath); //TODO: remove for v2
|
||||||
|
// For portability reasons environment variables should only consist of
|
||||||
|
// uppercase letters, digits, and the underscore. Therefore we convert
|
||||||
|
// the extendedJavaHome variable to upper case and replace '.' symbols and
|
||||||
|
// any other non-alphanumeric characters with an underscore.
|
||||||
|
extendedJavaHome = extendedJavaHome.toUpperCase().replace(/[^0-9A-Z_]/g, '_');
|
||||||
core.exportVariable('JAVA_HOME', toolPath);
|
core.exportVariable('JAVA_HOME', toolPath);
|
||||||
core.exportVariable(extendedJavaHome, toolPath);
|
core.exportVariable(extendedJavaHome, toolPath);
|
||||||
core.addPath(path.join(toolPath, 'bin'));
|
core.addPath(path.join(toolPath, 'bin'));
|
||||||
|
|
|
@ -87,6 +87,12 @@ export async function getJava(
|
||||||
}
|
}
|
||||||
|
|
||||||
let extendedJavaHome = 'JAVA_HOME_' + version + '_' + arch;
|
let extendedJavaHome = 'JAVA_HOME_' + version + '_' + arch;
|
||||||
|
core.exportVariable(extendedJavaHome, toolPath); //TODO: remove for v2
|
||||||
|
// For portability reasons environment variables should only consist of
|
||||||
|
// uppercase letters, digits, and the underscore. Therefore we convert
|
||||||
|
// the extendedJavaHome variable to upper case and replace '.' symbols and
|
||||||
|
// any other non-alphanumeric characters with an underscore.
|
||||||
|
extendedJavaHome = extendedJavaHome.toUpperCase().replace(/[^0-9A-Z_]/g, '_');
|
||||||
core.exportVariable('JAVA_HOME', toolPath);
|
core.exportVariable('JAVA_HOME', toolPath);
|
||||||
core.exportVariable(extendedJavaHome, toolPath);
|
core.exportVariable(extendedJavaHome, toolPath);
|
||||||
core.addPath(path.join(toolPath, 'bin'));
|
core.addPath(path.join(toolPath, 'bin'));
|
||||||
|
|
Loading…
Reference in a new issue