From 17f1dae227edce1627dbe301ed183649e05b416f Mon Sep 17 00:00:00 2001 From: Ivo List Date: Tue, 19 Sep 2023 19:17:09 +0200 Subject: [PATCH] Add platforms to apple_universal_binary transition (#257) Fixes: https://github.com/bazelbuild/rules_swift/issues/1103 --- lib/transitions.bzl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/transitions.bzl b/lib/transitions.bzl index f07e628..dab7368 100644 --- a/lib/transitions.bzl +++ b/lib/transitions.bzl @@ -18,8 +18,14 @@ def _macos_universal_transition_impl(settings, _attr): # Create a split transition from any macOS cpu to a list of all macOS cpus if settings["//command_line_option:cpu"].startswith("darwin"): return [ - {"//command_line_option:cpu": "darwin_x86_64"}, - {"//command_line_option:cpu": "darwin_arm64"}, + { + "//command_line_option:cpu": "darwin_arm64", + "//command_line_option:platforms": "//platforms:macos_arm64", + }, + { + "//command_line_option:cpu": "darwin_x86_64", + "//command_line_option:platforms": "//platforms:macos_x86_64", + }, ] else: return settings @@ -27,5 +33,5 @@ def _macos_universal_transition_impl(settings, _attr): macos_universal_transition = transition( implementation = _macos_universal_transition_impl, inputs = ["//command_line_option:cpu"], - outputs = ["//command_line_option:cpu"], + outputs = ["//command_line_option:cpu", "//command_line_option:platforms"], )