From 2fbc525e9e5091516c4bc8bc3f51680034fff885 Mon Sep 17 00:00:00 2001 From: Luis Padron Date: Tue, 20 May 2025 13:59:22 -0400 Subject: [PATCH] Update minimum_os_version for XCTest support in Xcode 15.3. Add additional references to common.bzl test targets where it's convenient. This leaves the "examples" targets alone, as we're assuming that they should be documentation. Cherry-pick: https://github.com/bazelbuild/rules_apple/commit/ce6f443590f424fed6839a88bbf6feec301c8904 --- test/starlark_tests/common.bzl | 12 ++++---- test/starlark_tests/ios_framework_tests.bzl | 26 ++++++++++++++++ .../targets_under_test/ios/BUILD | 24 +++++++-------- .../targets_under_test/tvos/BUILD | 8 ++--- .../targets_under_test/watchos/BUILD | 8 ++--- test/starlark_tests/tvos_framework_tests.bzl | 30 +++++++++++++++++++ .../watchos_application_swift_tests.bzl | 2 +- test/testdata/binaries/BUILD | 6 +++- 8 files changed, 88 insertions(+), 28 deletions(-) diff --git a/test/starlark_tests/common.bzl b/test/starlark_tests/common.bzl index 061eef7eb4..626060a498 100644 --- a/test/starlark_tests/common.bzl +++ b/test/starlark_tests/common.bzl @@ -33,9 +33,9 @@ _min_os_ios = struct( app_intents_support = "16.0", appclip_support = "14.0", arm_sim_support = "14.0", - baseline = "12.0", - oldest_supported = "11.0", - nplus1 = "13.0", + baseline = "13.0", + oldest_supported = "12.0", + nplus1 = "14.0", stable_swift_abi = "12.2", widget_configuration_intents_support = "16.0", ) @@ -51,9 +51,9 @@ _min_os_macos = struct( _min_os_tvos = struct( app_intents_support = "16.0", arm_sim_support = "14.0", - baseline = "12.0", - nplus1 = "13.0", - oldest_supported = "11.0", + baseline = "13.0", + oldest_supported = "12.0", + nplus1 = "14.0", stable_swift_abi = "12.2", ) diff --git a/test/starlark_tests/ios_framework_tests.bzl b/test/starlark_tests/ios_framework_tests.bzl index 8cda58ca18..66b7d66f3f 100644 --- a/test/starlark_tests/ios_framework_tests.bzl +++ b/test/starlark_tests/ios_framework_tests.bzl @@ -697,6 +697,32 @@ Please remove one of the two from your rule definition. tags = [name], ) + # Tests that if frameworks and applications have different minimum versions that a user + # actionable error is raised. + analysis_failure_message_test( + name = "{}_app_with_baseline_min_os_and_nplus1_fmwk_produces_error".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/ios:app_with_baseline_min_os_and_nplus1_fmwk", + expected_error = """ +ERROR: minimum_os_version {framework_version} on the framework //test/starlark_tests/targets_under_test/ios:fmwk_min_os_nplus1 is too high compared to //test/starlark_tests/targets_under_test/ios:app_with_baseline_min_os_and_nplus1_fmwk's minimum_os_version of {app_version} + +Please address the minimum_os_version on framework //test/starlark_tests/targets_under_test/ios:fmwk_min_os_nplus1 to match //test/starlark_tests/targets_under_test/ios:app_with_baseline_min_os_and_nplus1_fmwk's minimum_os_version. +""".format(app_version = common.min_os_ios.baseline, framework_version = common.min_os_ios.nplus1), + tags = [name], + ) + + # Tests that if data-loaded frameworks and applications have different minimum versions that a + # user actionable error is raised. + analysis_failure_message_test( + name = "{}_app_with_baseline_min_os_and_nplus1_transitive_data_fmwk_produces_error".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/ios:app_with_nplus1_framework_objc_lib_using_data", + expected_error = """ +ERROR: minimum_os_version {framework_version} on the framework //test/starlark_tests/targets_under_test/ios:fmwk_min_os_nplus1 is too high compared to //test/starlark_tests/targets_under_test/ios:app_with_nplus1_framework_objc_lib_using_data's minimum_os_version of {app_version} + +Please address the minimum_os_version on framework //test/starlark_tests/targets_under_test/ios:fmwk_min_os_nplus1 to match //test/starlark_tests/targets_under_test/ios:app_with_nplus1_framework_objc_lib_using_data's minimum_os_version. +""".format(app_version = common.min_os_ios.baseline, framework_version = common.min_os_ios.nplus1), + tags = [name], + ) + native.test_suite( name = name, tags = [name], diff --git a/test/starlark_tests/targets_under_test/ios/BUILD b/test/starlark_tests/targets_under_test/ios/BUILD index 293991df18..02e62138e8 100644 --- a/test/starlark_tests/targets_under_test/ios/BUILD +++ b/test/starlark_tests/targets_under_test/ios/BUILD @@ -1469,7 +1469,7 @@ ios_application( infoplists = [ "//test/starlark_tests/resources:Info.plist", ], - minimum_os_version = common.min_os_ios.baseline, + minimum_os_version = common.min_os_ios.oldest_supported, # Before the stable Swift ABI provisioning_profile = "//test/testdata/provisioning:integration_testing_ios.mobileprovision", tags = common.fixture_tags, deps = [ @@ -1612,7 +1612,7 @@ ios_extension( infoplists = [ "//test/starlark_tests/resources:Info.plist", ], - minimum_os_version = common.min_os_ios.baseline, + minimum_os_version = common.min_os_ios.oldest_supported, # Before the stable Swift ABI provisioning_profile = "//test/testdata/provisioning:integration_testing_ios.mobileprovision", tags = common.fixture_tags, deps = [ @@ -2271,7 +2271,7 @@ ios_application( infoplists = [ "//test/starlark_tests/resources:Info.plist", ], - minimum_os_version = common.min_os_ios.baseline, + minimum_os_version = common.min_os_ios.oldest_supported, # Before the stable Swift ABI tags = common.fixture_tags, deps = [ ":dynamic_fmwk_depending_swift_lib", @@ -2466,7 +2466,7 @@ ios_application( infoplists = [ "//test/starlark_tests/resources:Info.plist", ], - minimum_os_version = common.min_os_ios.baseline, + minimum_os_version = common.min_os_ios.oldest_supported, # Before the stable Swift ABI tags = common.fixture_tags, deps = [ ":swift_static_without_module_interfaces_fmwk_depending_lib", @@ -2507,7 +2507,7 @@ ios_application( infoplists = [ "//test/starlark_tests/resources:Info.plist", ], - minimum_os_version = common.min_os_ios.baseline, + minimum_os_version = common.min_os_ios.oldest_supported, # Before the stable Swift ABI tags = common.fixture_tags, deps = [ ":swift_static_fmwk_depending_swift_lib", @@ -2656,7 +2656,7 @@ ios_application( infoplists = [ "//test/starlark_tests/resources:Info.plist", ], - minimum_os_version = common.min_os_ios.baseline, + minimum_os_version = common.min_os_ios.oldest_supported, # Before the stable Swift ABI tags = common.fixture_tags, deps = [ ":dynamic_objc_xcframework_depending_swift_lib", @@ -2767,7 +2767,7 @@ ios_application( infoplists = [ "//test/starlark_tests/resources:Info.plist", ], - minimum_os_version = common.min_os_ios.baseline, + minimum_os_version = common.min_os_ios.oldest_supported, # Before the stable Swift ABI tags = common.fixture_tags, deps = [ ":dynamic_swift_xcframework_depending_swift_lib", @@ -2839,7 +2839,7 @@ ios_application( infoplists = [ "//test/starlark_tests/resources:Info.plist", ], - minimum_os_version = common.min_os_ios.baseline, + minimum_os_version = common.min_os_ios.oldest_supported, # Before the stable Swift ABI tags = common.fixture_tags, deps = [ ":static_fmwk_depending_swift_lib", @@ -2960,7 +2960,7 @@ ios_application( infoplists = [ "//test/starlark_tests/resources:Info.plist", ], - minimum_os_version = common.min_os_ios.baseline, + minimum_os_version = common.min_os_ios.oldest_supported, # Before the stable Swift ABI tags = common.fixture_tags, deps = [ ":swift_static_xcframework_depending_objc_lib", @@ -3001,7 +3001,7 @@ ios_application( infoplists = [ "//test/starlark_tests/resources:Info.plist", ], - minimum_os_version = common.min_os_ios.baseline, + minimum_os_version = common.min_os_ios.oldest_supported, # Before the stable Swift ABI tags = common.fixture_tags, deps = [ ":swift_static_xcframework_without_swiftmodule_depending_objc_lib", @@ -3053,7 +3053,7 @@ ios_application( bundle_id = "com.google.example", families = ["iphone"], infoplists = ["//test/starlark_tests/resources:Info.plist"], - minimum_os_version = common.min_os_ios.baseline, + minimum_os_version = common.min_os_ios.oldest_supported, # Before the stable Swift ABI tags = common.fixture_tags, deps = [ ":static_xcframework_depending_swift_lib", @@ -3117,7 +3117,7 @@ ios_application( bundle_id = "com.google.example", families = ["iphone"], infoplists = ["//test/starlark_tests/resources:Info.plist"], - minimum_os_version = common.min_os_ios.baseline, + minimum_os_version = common.min_os_ios.oldest_supported, # Before the stable Swift ABI tags = common.fixture_tags, deps = [ ":static_swift_xcframework_depending_swift_lib", diff --git a/test/starlark_tests/targets_under_test/tvos/BUILD b/test/starlark_tests/targets_under_test/tvos/BUILD index d8f992e1c9..75053f30e4 100644 --- a/test/starlark_tests/targets_under_test/tvos/BUILD +++ b/test/starlark_tests/targets_under_test/tvos/BUILD @@ -115,7 +115,7 @@ tvos_application( bundle_id = "com.google.example", extensions = [":swift_ext"], infoplists = ["//test/starlark_tests/resources:Info.plist"], - minimum_os_version = common.min_os_tvos.baseline, + minimum_os_version = common.min_os_tvos.oldest_supported, # Before the stable Swift ABI provisioning_profile = "//test/testdata/provisioning:integration_testing_ios.mobileprovision", tags = common.fixture_tags, deps = ["//test/starlark_tests/resources:objc_main_lib"], @@ -137,7 +137,7 @@ tvos_extension( bundle_id = "com.google.example.ext", entitlements = "//test/starlark_tests/resources:entitlements.plist", infoplists = ["//test/starlark_tests/resources:Info.plist"], - minimum_os_version = common.min_os_tvos.baseline, + minimum_os_version = common.min_os_tvos.oldest_supported, # Before the stable Swift ABI provisioning_profile = "//test/testdata/provisioning:integration_testing_ios.mobileprovision", tags = common.fixture_tags, deps = [ @@ -1062,7 +1062,7 @@ tvos_application( infoplists = [ "//test/starlark_tests/resources:Info.plist", ], - minimum_os_version = common.min_os_tvos.baseline, + minimum_os_version = common.min_os_tvos.oldest_supported, # Before the stable Swift ABI provisioning_profile = "//test/testdata/provisioning:integration_testing_ios.mobileprovision", tags = common.fixture_tags, deps = [":swift_lib"], @@ -1074,7 +1074,7 @@ tvos_application( infoplists = [ "//test/starlark_tests/resources:Info.plist", ], - minimum_os_version = common.min_os_tvos.baseline, + minimum_os_version = common.min_os_tvos.oldest_supported, # Before the stable Swift ABI provisioning_profile = "//test/testdata/provisioning:integration_testing_ios.mobileprovision", tags = common.fixture_tags, deps = [":objc_to_swift_lib"], diff --git a/test/starlark_tests/targets_under_test/watchos/BUILD b/test/starlark_tests/targets_under_test/watchos/BUILD index 873d3005c7..e6ce59e7c2 100644 --- a/test/starlark_tests/targets_under_test/watchos/BUILD +++ b/test/starlark_tests/targets_under_test/watchos/BUILD @@ -667,7 +667,7 @@ watchos_application( infoplists = [ "//test/starlark_tests/resources:WatchosAppInfo.plist", ], - minimum_os_version = "6.0", + minimum_os_version = common.min_os_watchos.baseline, provisioning_profile = "//test/testdata/provisioning:integration_testing_ios.mobileprovision", resources = [ "//test/starlark_tests/resources:example_filegroup", @@ -712,7 +712,7 @@ ios_application( infoplists = [ "//test/starlark_tests/resources:Info.plist", ], - minimum_os_version = common.min_os_ios.baseline, + minimum_os_version = common.min_os_ios.oldest_supported, # Before the stable Swift ABI provisioning_profile = "//test/testdata/provisioning:integration_testing_ios.mobileprovision", tags = common.fixture_tags, watch_application = ":watchos_app_no_swift", @@ -746,7 +746,7 @@ ios_application( infoplists = [ "//test/starlark_tests/resources:Info.plist", ], - minimum_os_version = common.min_os_ios.baseline, + minimum_os_version = common.min_os_ios.oldest_supported, # Before the stable Swift ABI provisioning_profile = "//test/testdata/provisioning:integration_testing_ios.mobileprovision", tags = common.fixture_tags, watch_application = ":watchos_app_swift", @@ -858,7 +858,7 @@ watchos_application( infoplists = [ "//test/starlark_tests/resources:WatchosAppInfo.plist", ], - minimum_os_version = "6.0", + minimum_os_version = common.min_os_watchos.stable_swift_abi, provisioning_profile = "//test/testdata/provisioning:integration_testing_ios.mobileprovision", tags = common.fixture_tags, ) diff --git a/test/starlark_tests/tvos_framework_tests.bzl b/test/starlark_tests/tvos_framework_tests.bzl index 459e1e1e40..d93d789b3c 100644 --- a/test/starlark_tests/tvos_framework_tests.bzl +++ b/test/starlark_tests/tvos_framework_tests.bzl @@ -14,6 +14,10 @@ """tvos_framework Starlark tests.""" +load( + "//test/starlark_tests/rules:analysis_failure_message_test.bzl", + "analysis_failure_message_test", +) load( "//test/starlark_tests/rules:analysis_output_group_info_files_test.bzl", "analysis_output_group_info_files_test", @@ -352,6 +356,32 @@ def tvos_framework_test_suite(name): tags = [name], ) + # Tests that if frameworks and applications have different minimum versions that a user + # actionable error is raised. + analysis_failure_message_test( + name = "{}_app_with_baseline_min_os_and_nplus1_fmwk_produces_error".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/tvos:app_with_baseline_min_os_and_nplus1_fmwk", + expected_error = """ +ERROR: minimum_os_version {framework_version} on the framework //test/starlark_tests/targets_under_test/tvos:fmwk_min_os_nplus1 is too high compared to //test/starlark_tests/targets_under_test/tvos:app_with_baseline_min_os_and_nplus1_fmwk's minimum_os_version of {app_version} + +Please address the minimum_os_version on framework //test/starlark_tests/targets_under_test/tvos:fmwk_min_os_nplus1 to match //test/starlark_tests/targets_under_test/tvos:app_with_baseline_min_os_and_nplus1_fmwk's minimum_os_version. +""".format(app_version = common.min_os_tvos.baseline, framework_version = common.min_os_tvos.nplus1), + tags = [name], + ) + + # Tests that if data-loaded frameworks and applications have different minimum versions that a + # user actionable error is raised. + analysis_failure_message_test( + name = "{}_app_with_baseline_min_os_and_nplus1_transitive_data_fmwk_produces_error".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/tvos:app_with_nplus1_framework_objc_lib_using_data", + expected_error = """ +ERROR: minimum_os_version {framework_version} on the framework //test/starlark_tests/targets_under_test/tvos:fmwk_min_os_nplus1 is too high compared to //test/starlark_tests/targets_under_test/tvos:app_with_nplus1_framework_objc_lib_using_data's minimum_os_version of {app_version} + +Please address the minimum_os_version on framework //test/starlark_tests/targets_under_test/tvos:fmwk_min_os_nplus1 to match //test/starlark_tests/targets_under_test/tvos:app_with_nplus1_framework_objc_lib_using_data's minimum_os_version. +""".format(app_version = common.min_os_tvos.baseline, framework_version = common.min_os_tvos.nplus1), + tags = [name], + ) + native.test_suite( name = name, tags = [name], diff --git a/test/starlark_tests/watchos_application_swift_tests.bzl b/test/starlark_tests/watchos_application_swift_tests.bzl index 98b2c04549..215dec18f1 100644 --- a/test/starlark_tests/watchos_application_swift_tests.bzl +++ b/test/starlark_tests/watchos_application_swift_tests.bzl @@ -119,7 +119,7 @@ def watchos_application_swift_test_suite(name): "bundle/Payload/companion.app/Watch/app.app/app", "bundle/Payload/companion.app/Watch/app.app/PlugIns/ext.appex/Info.plist", "bundle/Payload/companion.app/Watch/app.app/PlugIns/ext.appex/ext", - "bundle/SwiftSupport/iphoneos/libswiftCore.dylib", + "bundle/SwiftSupport/watchos/libswiftCore.dylib", "bundle/WatchKitSupport2/WK", "dossier/manifest.json", ], diff --git a/test/testdata/binaries/BUILD b/test/testdata/binaries/BUILD index 2f75e28cab..510b2b03aa 100644 --- a/test/testdata/binaries/BUILD +++ b/test/testdata/binaries/BUILD @@ -3,6 +3,10 @@ load( "//apple:apple_binary.bzl", "apple_binary", ) +load( + "//test/starlark_tests:common.bzl", + "common", +) # Public only because these are used by the integration tests from generated # workspaces. Please no not depend on them as they can change at any time. @@ -13,7 +17,7 @@ licenses(["notice"]) apple_binary( name = "empty_tvos_dylib", binary_type = "dylib", - minimum_os_version = "11.0", + minimum_os_version = common.min_os_tvos.baseline, platform_type = "tvos", deps = [":dummy_lib"], )