From 17f4203ca0ec497248a4d66f43d8096beb97d3c1 Mon Sep 17 00:00:00 2001 From: Thi Doan Date: Mon, 30 Oct 2023 21:58:48 +0900 Subject: [PATCH] Add validation for platform type attribute in `apple_{,static}_xcframework` rules (#2313) The platform type attributes (`ios`, `tvos`,...) aren't mandatory, but at least one of them has to be set. It wasn't clear in the documentation that one of these is required, because there is another attribute `minimum_os_versions` which also mentions platform types. Previously not setting any of these led to an error in: ``` Error in link_multi_arch_static_library: unexpected empty key in split transition ``` which wasn't that much useful. --- apple/internal/transition_support.bzl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apple/internal/transition_support.bzl b/apple/internal/transition_support.bzl index 7d05754cba..7f2e0a593e 100644 --- a/apple/internal/transition_support.bzl +++ b/apple/internal/transition_support.bzl @@ -681,6 +681,11 @@ def _xcframework_transition_impl(settings, attr): target_environments = target_environments, ) output_dictionary = dicts.add(command_line_options, output_dictionary) + + if not output_dictionary: + fail("Missing a platform type attribute. At least one of 'ios', " + + "'tvos', 'visionos', 'watchos', or 'macos' attribute is mandatory.") + return output_dictionary _xcframework_transition = transition(