diff --git a/dist/index.js b/dist/index.js index d77e3beb..d81245c0 100644 Binary files a/dist/index.js and b/dist/index.js differ diff --git a/dist/setup/index.js b/dist/setup/index.js index 3beeeece..28c5c3cc 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -28685,6 +28685,9 @@ function run() { version = core.getInput(constants.INPUT_JAVA_VERSION, { required: true }); } const arch = core.getInput(constants.INPUT_ARCHITECTURE, { required: true }); + if (!['x86', 'x64'].includes(arch)) { + throw new Error(`architecture "${arch}" is not in [x86 | x64]`); + } const javaPackage = core.getInput(constants.INPUT_JAVA_PACKAGE, { required: true }); @@ -33423,7 +33426,7 @@ function getJava(version, arch, jdkFile, javaPackage) { } const contents = yield response.readBody(); const refs = contents.match(//gi) || []; - const downloadInfo = getDownloadInfo(refs, version, javaPackage); + const downloadInfo = getDownloadInfo(refs, version, arch, javaPackage); jdkFile = yield tc.downloadTool(downloadInfo.url); version = downloadInfo.version; compressedFileExtension = IS_WINDOWS ? '.zip' : '.tar.gz'; @@ -33539,20 +33542,22 @@ function unzipJavaDownload(repoRoot, fileEnding, destinationFolder, extension) { } }); } -function getDownloadInfo(refs, version, javaPackage) { +function getDownloadInfo(refs, version, arch, javaPackage) { version = normalizeVersion(version); + const archExtension = arch === 'x86' ? 'i686' : 'x64'; let extension = ''; if (IS_WINDOWS) { - extension = `-win_x64.zip`; + extension = `-win_${archExtension}.zip`; } else { if (process.platform === 'darwin') { - extension = `-macosx_x64.tar.gz`; + extension = `-macosx_${archExtension}.tar.gz`; } else { - extension = `-linux_x64.tar.gz`; + extension = `-linux_${archExtension}.tar.gz`; } } + core.debug(`Searching for files with extension: ${extension}`); let pkgRegexp = new RegExp(''); let pkgTypeLength = 0; if (javaPackage === 'jdk') { diff --git a/src/installer.ts b/src/installer.ts index 88a8ff18..b48eeb0b 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -45,7 +45,7 @@ export async function getJava( const contents = await response.readBody(); const refs = contents.match(//gi) || []; - const downloadInfo = getDownloadInfo(refs, version, javaPackage); + const downloadInfo = getDownloadInfo(refs, version, arch, javaPackage); jdkFile = await tc.downloadTool(downloadInfo.url); version = downloadInfo.version; compressedFileExtension = IS_WINDOWS ? '.zip' : '.tar.gz'; @@ -181,20 +181,26 @@ async function unzipJavaDownload( function getDownloadInfo( refs: string[], version: string, + arch: string, javaPackage: string ): {version: string; url: string} { version = normalizeVersion(version); + + const archExtension = arch === 'x86' ? 'i686' : 'x64'; + let extension = ''; if (IS_WINDOWS) { - extension = `-win_x64.zip`; + extension = `-win_${archExtension}.zip`; } else { if (process.platform === 'darwin') { - extension = `-macosx_x64.tar.gz`; + extension = `-macosx_${archExtension}.tar.gz`; } else { - extension = `-linux_x64.tar.gz`; + extension = `-linux_${archExtension}.tar.gz`; } } + core.debug(`Searching for files with extension: ${extension}`); + let pkgRegexp = new RegExp(''); let pkgTypeLength = 0; if (javaPackage === 'jdk') { diff --git a/src/setup-java.ts b/src/setup-java.ts index db169f29..5ba35297 100644 --- a/src/setup-java.ts +++ b/src/setup-java.ts @@ -11,7 +11,12 @@ async function run() { if (!version) { version = core.getInput(constants.INPUT_JAVA_VERSION, {required: true}); } + const arch = core.getInput(constants.INPUT_ARCHITECTURE, {required: true}); + if (!['x86', 'x64'].includes(arch)) { + throw new Error(`architecture "${arch}" is not in [x86 | x64]`); + } + const javaPackage = core.getInput(constants.INPUT_JAVA_PACKAGE, { required: true });