Skip to content

Commit

Permalink
Merge pull request #949 from ajthom90/master
Browse files Browse the repository at this point in the history
Download x64 binary on Apple Silicon
  • Loading branch information
eirslett committed Dec 15, 2020
2 parents 2830bcd + b98fda8 commit 7356784
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
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

0 comments on commit 7356784

Please sign in to comment.