Skip to content

Commit

Permalink
Reland: Retrieve single arch cpu from cc_toolchain instead of from …
Browse files Browse the repository at this point in the history
…`ctx.fragments.apple` when building for darwin cpus (bazelbuild#749)

Workaround for bazelbuild/bazel#14291.

`ctx.fragments.apple.single_arch_cpu` is returning the default macos
cpu for the host platform for tools while it should return the cpu of
the execution platform.
  • Loading branch information
thii authored Jan 26, 2022
1 parent a06c804 commit 6b508dd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion swift/internal/xcode_swift_toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,13 @@ def _xcode_swift_toolchain_impl(ctx):
apple_toolchain = apple_common.apple_toolchain()
cc_toolchain = find_cpp_toolchain(ctx)

cpu = apple_fragment.single_arch_cpu
# TODO(https://github.com/bazelbuild/bazel/issues/14291): Always use the
# value from ctx.fragments.apple.single_arch_cpu
if cc_toolchain.cpu.startswith("darwin_"):
cpu = cc_toolchain.cpu[len("darwin_"):]
else:
cpu = apple_fragment.single_arch_cpu

platform = apple_fragment.single_arch_platform
xcode_config = ctx.attr._xcode_config[apple_common.XcodeVersionConfig]

Expand Down

0 comments on commit 6b508dd

Please sign in to comment.