Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 47 additions & 76 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
Expand Down Expand Up @@ -33423,7 +33426,7 @@ function getJava(version, arch, jdkFile, javaPackage) {
}
const contents = yield response.readBody();
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);
version = downloadInfo.version;
compressedFileExtension = IS_WINDOWS ? '.zip' : '.tar.gz';
Expand Down Expand Up @@ -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') {
Expand Down
14 changes: 10 additions & 4 deletions src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export async function getJava(

const contents = await response.readBody();
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);
version = downloadInfo.version;
compressedFileExtension = IS_WINDOWS ? '.zip' : '.tar.gz';
Expand Down Expand Up @@ -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') {
Expand Down
5 changes: 5 additions & 0 deletions src/setup-java.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
Expand Down