Add comment explaining why the environment variable should be normalized
This commit is contained in:
parent
81bfa641b0
commit
655cb05195
|
@ -4742,6 +4742,10 @@ 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;
|
||||||
|
// 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, '_');
|
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);
|
||||||
|
|
|
@ -87,6 +87,10 @@ export async function getJava(
|
||||||
}
|
}
|
||||||
|
|
||||||
let extendedJavaHome = 'JAVA_HOME_' + version + '_' + arch;
|
let extendedJavaHome = 'JAVA_HOME_' + version + '_' + arch;
|
||||||
|
// 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, '_');
|
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);
|
||||||
|
|
Loading…
Reference in New Issue