Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download x64 binary on Apple Silicon #949

Merged
merged 2 commits into from Dec 15, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -135,7 +135,12 @@ public String getNodeDownloadFilename(String nodeVersion, boolean archiveOnWindo
}

public String getNodeClassifier() {
String result = getCodename() + "-" + architecture.name();
final String result;
if(isMac() && architecture == Architecture.arm64) { // this check is required to download the x64 binary until there is an arm64 version available for macOS (darwin).
result = getCodename() + "-" + Architecture.x64.name();
} else {
result = getCodename() + "-" + architecture.name();
}
return classifier != null ? result + "-" + classifier : result;
}
}
Expand Up @@ -31,6 +31,18 @@ public void detect_win_doesntLookForAlpine() {
verifyNoMoreInteractions(File.class); // doesn't look for a file path
}

@Test
public void detect_arm_mac_download_x64_binary() {
mockStatic(OS.class);
mockStatic(Architecture.class);

when(OS.guess()).thenReturn(OS.Mac);
when(Architecture.guess()).thenReturn(Architecture.arm64);

Platform platform = Platform.guess();
assertEquals("darwin-x64", platform.getNodeClassifier());
}

@Test
public void detect_linux_notAlpine() throws Exception {
mockStatic(OS.class);
Expand Down