Skip to content
Closed
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
21 changes: 16 additions & 5 deletions dist/index.js

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

21 changes: 17 additions & 4 deletions src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,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 @@ -188,20 +188,33 @@ async function unzipJavaDownload(
function getDownloadInfo(
refs: string[],
version: string,
arch: string,
javaPackage: string
): {version: string; url: string} {
version = normalizeVersion(version);

let archExtension = '';
if (arch === 'x86') {
archExtension = 'i686';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did this extension come from? Is it not x86?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i686 is the latest iteration of the IA-32 (commonly known as x86). From today's perspective, it's a synonym of x86 (although it is technically not). I didn't choose this extension, I just looked at https://cdn.azul.com/zulu/bin/ and saw that's what they use.

} else if (arch === 'x64') {
archExtension = 'x64';
} else {
throw new Error(`architecture "${arch}" is not int [x86 | x64]`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should validate that the architecture input is valid when we retrieve the input in https://github.com/actions/setup-java/blob/master/src/setup-java.ts#L12

Then this whole block can just be:

const archExtension = arch === 'x86' ? 'i686' : 'x64';

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. I'm not very familiar with the GitHub Actions core library (and JS in general) so bear with me. I'll make the change soon.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries! Let me know if you need any help

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be "not in" instead of "not int".

}

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