Skip to content

Commit

Permalink
Drop universal binary support for Mac OS as it requires security whit…
Browse files Browse the repository at this point in the history
…elisting
  • Loading branch information
ascopes committed Nov 17, 2023
1 parent 97bb830 commit 0a556a5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private String determineArchitectureForLinux() throws ProtocResolutionException
}
}

private String determineArchitectureForMacOs() {
private String determineArchitectureForMacOs() throws ProtocResolutionException {
var arch = HostEnvironment.cpuArchitecture();

switch (arch) {
Expand All @@ -122,13 +122,7 @@ private String determineArchitectureForMacOs() {
return "x86_64";

default:
LOGGER.warn(
"No supported protoc version was found for Mac OS systems using the '{}' architecture,"
+ " attempting to fall back to the Universal Binary distribution. Your mileage may"
+ " vary with this approach.",
arch
);
return "universal_binary";
throw noResolvableProtocFor("Mac OS", arch);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,18 @@ void supportedMacOsArchitecturesResolveCorrectly(
}
}

@DisplayName("Unsupported Mac OS architectures fall back to the universal binary")
@DisplayName("Unsupported Mac OS architectures result in an exception")
@Test
void unsupportedMacOsArchitecturesFallBackToTheUniversalBinary() throws ProtocResolutionException {
void unsupportedMacOsArchitecturesResultInException() throws ProtocResolutionException {
try (var hostEnvironment = mockStatic(HostEnvironment.class)) {
// Given
givenMacOsWithArch(hostEnvironment, "something-crazy-unknown");

// When
var actualCoordinate = factory.create("7.8.9");

// Then
thenAssertCoordinateMatches(actualCoordinate, "7.8.9", "osx-universal_binary");
assertThatThrownBy(() -> factory.create("7.8.9"))
.isInstanceOf(ProtocResolutionException.class)
.hasMessage("No resolvable protoc version for Mac OS 'something-crazy-unknown' systems found")
.hasNoCause();
}
}

Expand Down

0 comments on commit 0a556a5

Please sign in to comment.