mirror of
https://github.com/actions/setup-java.git
synced 2025-04-20 09:56:46 +00:00
Quick fix for 32-bit architecture support.
This commit is contained in:
parent
5c87b70ffe
commit
8b062ac0cf
2 changed files with 33 additions and 9 deletions
21
dist/index.js
generated
vendored
21
dist/index.js
generated
vendored
|
@ -4696,7 +4696,7 @@ function getJava(version, arch, jdkFile, javaPackage) {
|
||||||
}
|
}
|
||||||
const contents = yield response.readBody();
|
const contents = yield response.readBody();
|
||||||
const refs = contents.match(/<a href.*\">/gi) || [];
|
const refs = contents.match(/<a href.*\">/gi) || [];
|
||||||
const downloadInfo = getDownloadInfo(refs, version, javaPackage);
|
const downloadInfo = getDownloadInfo(refs, version, arch, javaPackage);
|
||||||
jdkFile = yield tc.downloadTool(downloadInfo.url);
|
jdkFile = yield tc.downloadTool(downloadInfo.url);
|
||||||
version = downloadInfo.version;
|
version = downloadInfo.version;
|
||||||
compressedFileExtension = IS_WINDOWS ? '.zip' : '.tar.gz';
|
compressedFileExtension = IS_WINDOWS ? '.zip' : '.tar.gz';
|
||||||
|
@ -4804,20 +4804,31 @@ function unzipJavaDownload(repoRoot, fileEnding, destinationFolder, extension) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function getDownloadInfo(refs, version, javaPackage) {
|
function getDownloadInfo(refs, version, arch, javaPackage) {
|
||||||
version = normalizeVersion(version);
|
version = normalizeVersion(version);
|
||||||
|
let archExtension = '';
|
||||||
|
if (arch === 'x86') {
|
||||||
|
archExtension = 'i686';
|
||||||
|
}
|
||||||
|
else if (arch === 'x64') {
|
||||||
|
archExtension = 'x64';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new Error(`architecture "${arch}" is not int [x86 | x64]`);
|
||||||
|
}
|
||||||
let extension = '';
|
let extension = '';
|
||||||
if (IS_WINDOWS) {
|
if (IS_WINDOWS) {
|
||||||
extension = `-win_x64.zip`;
|
extension = `-win_${archExtension}.zip`;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
extension = `-macosx_x64.tar.gz`;
|
extension = `-macosx_${archExtension}.tar.gz`;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
extension = `-linux_x64.tar.gz`;
|
extension = `-linux_${archExtension}.tar.gz`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
core.debug(`Searching for files with extension: ${extension}`);
|
||||||
let pkgRegexp = new RegExp('');
|
let pkgRegexp = new RegExp('');
|
||||||
let pkgTypeLength = 0;
|
let pkgTypeLength = 0;
|
||||||
if (javaPackage === 'jdk') {
|
if (javaPackage === 'jdk') {
|
||||||
|
|
|
@ -60,7 +60,7 @@ export async function getJava(
|
||||||
|
|
||||||
const contents = await response.readBody();
|
const contents = await response.readBody();
|
||||||
const refs = contents.match(/<a href.*\">/gi) || [];
|
const refs = contents.match(/<a href.*\">/gi) || [];
|
||||||
const downloadInfo = getDownloadInfo(refs, version, javaPackage);
|
const downloadInfo = getDownloadInfo(refs, version, arch, javaPackage);
|
||||||
jdkFile = await tc.downloadTool(downloadInfo.url);
|
jdkFile = await tc.downloadTool(downloadInfo.url);
|
||||||
version = downloadInfo.version;
|
version = downloadInfo.version;
|
||||||
compressedFileExtension = IS_WINDOWS ? '.zip' : '.tar.gz';
|
compressedFileExtension = IS_WINDOWS ? '.zip' : '.tar.gz';
|
||||||
|
@ -188,20 +188,33 @@ async function unzipJavaDownload(
|
||||||
function getDownloadInfo(
|
function getDownloadInfo(
|
||||||
refs: string[],
|
refs: string[],
|
||||||
version: string,
|
version: string,
|
||||||
|
arch: string,
|
||||||
javaPackage: string
|
javaPackage: string
|
||||||
): {version: string; url: string} {
|
): {version: string; url: string} {
|
||||||
version = normalizeVersion(version);
|
version = normalizeVersion(version);
|
||||||
|
|
||||||
|
let archExtension = '';
|
||||||
|
if (arch === 'x86') {
|
||||||
|
archExtension = 'i686';
|
||||||
|
} else if (arch === 'x64') {
|
||||||
|
archExtension = 'x64';
|
||||||
|
} else {
|
||||||
|
throw new Error(`architecture "${arch}" is not int [x86 | x64]`);
|
||||||
|
}
|
||||||
|
|
||||||
let extension = '';
|
let extension = '';
|
||||||
if (IS_WINDOWS) {
|
if (IS_WINDOWS) {
|
||||||
extension = `-win_x64.zip`;
|
extension = `-win_${archExtension}.zip`;
|
||||||
} else {
|
} else {
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
extension = `-macosx_x64.tar.gz`;
|
extension = `-macosx_${archExtension}.tar.gz`;
|
||||||
} else {
|
} else {
|
||||||
extension = `-linux_x64.tar.gz`;
|
extension = `-linux_${archExtension}.tar.gz`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
core.debug(`Searching for files with extension: ${extension}`);
|
||||||
|
|
||||||
let pkgRegexp = new RegExp('');
|
let pkgRegexp = new RegExp('');
|
||||||
let pkgTypeLength = 0;
|
let pkgTypeLength = 0;
|
||||||
if (javaPackage === 'jdk') {
|
if (javaPackage === 'jdk') {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue