Skip to content

Commit

Permalink
Revert default cpu value on x86 macOS to "darwin"
Browse files Browse the repository at this point in the history
Many downstream projects are still depending on the default cpu value
on x86 macOS being "darwin" instead of "darwin_x86_64"

https://buildkite.com/bazel/bazel-auto-sheriff-face-with-cowboy-hat/builds/412

Related: #11628

Closes #12918.

PiperOrigin-RevId: 354279409
  • Loading branch information
meteorcloudy authored and copybara-github committed Jan 28, 2021
1 parent 75bd1ff commit e96b8ca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ public class AutoCpuConverter implements Converter<String> {
public String convert(String input) throws OptionsParsingException {
if (input.isEmpty()) {
// TODO(philwo) - replace these deprecated names with more logical ones (e.g. k8 becomes
// linux-x86_64 ...).
// linux-x86_64, darwin includes the CPU architecture, ...).
switch (OS.getCurrent()) {
case DARWIN:
switch (CPU.getCurrent()) {
case X86_64:
return "darwin_x86_64";
return "darwin";
case AARCH64:
return "darwin_arm64";
default:
Expand Down
2 changes: 1 addition & 1 deletion tools/cpp/lib_cc_configure.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def get_cpu_value(repository_ctx):
if os_name.startswith("mac os"):
# Check if we are on x86_64 or arm64 and return the corresponding cpu value.
result = repository_ctx.execute(["uname", "-m"])
return "darwin_" + result.stdout.strip()
return "darwin" + ("_arm64" if result.stdout.strip() == "arm64" else "")
if os_name.find("freebsd") != -1:
return "freebsd"
if os_name.find("openbsd") != -1:
Expand Down

0 comments on commit e96b8ca

Please sign in to comment.