Tests and pathing

This commit is contained in:
Danny McCormick 2019-07-15 14:46:34 -04:00
parent 02c1a8e374
commit 72c20b3e34
3 changed files with 41 additions and 3 deletions

View file

@ -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')) {