mirror of
https://github.com/actions/setup-java.git
synced 2025-04-21 02:16:45 +00:00
Tests and pathing
This commit is contained in:
parent
02c1a8e374
commit
72c20b3e34
3 changed files with 41 additions and 3 deletions
|
@ -60,7 +60,7 @@ function getJava(version, arch, jdkFile) {
|
|||
let tempDir = path.join(tempDirectory, 'temp_' + Math.floor(Math.random() * 2000000000));
|
||||
const jdkDir = yield unzipJavaDownload(jdkFile, compressedFileExtension, tempDir);
|
||||
core.debug(`jdk extracted to ${jdkDir}`);
|
||||
toolPath = yield tc.cacheDir(jdkDir, 'Java', `${version}.0.0`, arch);
|
||||
toolPath = yield tc.cacheDir(jdkDir, 'Java', normalizeVersion(version), arch);
|
||||
}
|
||||
let extendedJavaHome = 'JAVA_HOME_' + version + '_' + arch;
|
||||
core.exportVariable('JAVA_HOME', toolPath);
|
||||
|
@ -69,6 +69,13 @@ function getJava(version, arch, jdkFile) {
|
|||
});
|
||||
}
|
||||
exports.getJava = getJava;
|
||||
function normalizeVersion(version) {
|
||||
const versionArray = version.split('.');
|
||||
const major = versionArray[0];
|
||||
const minor = versionArray.length > 1 ? versionArray[1] : '0';
|
||||
const patch = versionArray.length > 2 ? versionArray[2] : '0';
|
||||
return `${major}.${minor}.${patch}`;
|
||||
}
|
||||
function getFileEnding(file) {
|
||||
let fileEnding = '';
|
||||
if (file.endsWith('.tar')) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue