mirror of
https://github.com/actions/setup-java.git
synced 2025-04-18 00:46:45 +00:00
Fix
This commit is contained in:
parent
c38b0fe09c
commit
55f787ebb1
2 changed files with 11 additions and 16 deletions
|
@ -47,11 +47,13 @@ function getJava(version, arch, jdkFile) {
|
|||
core.debug(`Tool found in cache ${toolPath}`);
|
||||
}
|
||||
else {
|
||||
let compressedFileExtension = '';
|
||||
if (!jdkFile) {
|
||||
jdkFile = yield downloadJava(version);
|
||||
compressedFileExtension = IS_WINDOWS ? '.zip' : '.tar.gz';
|
||||
}
|
||||
core.debug('Retrieving Jdk from local path');
|
||||
const compressedFileExtension = getFileEnding(jdkFile);
|
||||
compressedFileExtension = compressedFileExtension || getFileEnding(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}`);
|
||||
|
@ -127,7 +129,7 @@ function unpackJars(fsPath, javaBinPath) {
|
|||
}
|
||||
});
|
||||
}
|
||||
function unzipJavaDownload(repoRoot, fileEnding, destinationFolder) {
|
||||
function unzipJavaDownload(repoRoot, fileEnding, destinationFolder, extension) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Create the destination folder if it doesn't exist
|
||||
yield io.mkdirP(destinationFolder);
|
||||
|
@ -170,10 +172,6 @@ function downloadJava(version) {
|
|||
throw new Error(`No valid download found for version ${version}. Check https://static.azul.com/zulu/bin/ for a list of valid versions or download your own jdk file and add the jdkFile argument`);
|
||||
}
|
||||
const fileName = refs[0].slice('<a href="'.length, refs[0].length - '">'.length);
|
||||
const dest = yield tc.downloadTool(`https://static.azul.com/zulu/bin/${fileName}`);
|
||||
if (dest) {
|
||||
throw new Error(fs.readdirSync(dest).toString());
|
||||
}
|
||||
return path.join(dest, fileName);
|
||||
return yield tc.downloadTool(`https://static.azul.com/zulu/bin/${fileName}`);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -35,11 +35,13 @@ export async function getJava(
|
|||
if (toolPath) {
|
||||
core.debug(`Tool found in cache ${toolPath}`);
|
||||
} else {
|
||||
let compressedFileExtension = '';
|
||||
if (!jdkFile) {
|
||||
jdkFile = await downloadJava(version);
|
||||
compressedFileExtension = IS_WINDOWS ? '.zip' : '.tar.gz';
|
||||
}
|
||||
core.debug('Retrieving Jdk from local path');
|
||||
const compressedFileExtension = getFileEnding(jdkFile);
|
||||
compressedFileExtension = compressedFileExtension || getFileEnding(jdkFile);
|
||||
let tempDir: string = path.join(
|
||||
tempDirectory,
|
||||
'temp_' + Math.floor(Math.random() * 2000000000)
|
||||
|
@ -123,7 +125,8 @@ async function unpackJars(fsPath: string, javaBinPath: string) {
|
|||
async function unzipJavaDownload(
|
||||
repoRoot: string,
|
||||
fileEnding: string,
|
||||
destinationFolder: string
|
||||
destinationFolder: string,
|
||||
extension?: string
|
||||
): Promise<string> {
|
||||
// Create the destination folder if it doesn't exist
|
||||
await io.mkdirP(destinationFolder);
|
||||
|
@ -175,11 +178,5 @@ async function downloadJava(version: string): Promise<string> {
|
|||
'<a href="'.length,
|
||||
refs[0].length - '">'.length
|
||||
);
|
||||
const dest = await tc.downloadTool(
|
||||
`https://static.azul.com/zulu/bin/${fileName}`
|
||||
);
|
||||
if (dest) {
|
||||
throw new Error(fs.readdirSync(dest).toString());
|
||||
}
|
||||
return path.join(dest, fileName);
|
||||
return await tc.downloadTool(`https://static.azul.com/zulu/bin/${fileName}`);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue