diff --git a/apple/internal/rule_factory.bzl b/apple/internal/rule_factory.bzl index d00cc33bde..c40e2a6547 100644 --- a/apple/internal/rule_factory.bzl +++ b/apple/internal/rule_factory.bzl @@ -1007,6 +1007,15 @@ If `True`, this extension is an App Extension instead of a WatchKit Extension. It links the extension with the application extension point (`_NSExtensionMain`) instead of the WatchKit extension point (`_WKExtensionMain`), and has the `app_extension` `product_type` instead of `watch2_extension`. +""", + ), + "extensionkit_extension": attr.bool( + default = False, + doc = """ +If `True`, this extension is an ExtensionKit Extension instead of a WatchKit Extension. +It links the extension with the application extension point (`_NSExtensionMain`) +instead of the WatchKit extension point (`_WKExtensionMain`), and has the +`extensionkit_extension` `product_type` instead of `watch2_extension`. """, ), }) diff --git a/apple/internal/watchos_rules.bzl b/apple/internal/watchos_rules.bzl index 39bbcbd000..3cf6ba14a2 100644 --- a/apple/internal/watchos_rules.bzl +++ b/apple/internal/watchos_rules.bzl @@ -858,6 +858,11 @@ def _watchos_extension_impl(ctx): ], ) product_type = rule_descriptor.product_type + if ctx.attr.extensionkit_extension: + bundle_location = processor.location.extension + product_type = apple_product_type.extensionkit_extension + else: + bundle_location = processor.location.plugin # Xcode 11 requires this flag to be passed to the linker, but it is not accepted by earlier # versions. @@ -868,6 +873,9 @@ def _watchos_extension_impl(ctx): if ctx.attr.application_extension: extra_linkopts = ["-e", "_NSExtensionMain"] product_type = apple_product_type.app_extension + elif ctx.attr.extensionkit_extension: + extra_linkopts = ["-e", "_NSExtensionMain"] + product_type = apple_product_type.extensionkit_extension else: extra_linkopts = ["-e", "_WKExtensionMain"] @@ -913,7 +921,7 @@ def _watchos_extension_impl(ctx): binary_artifact = link_result.binary debug_outputs = linking_support.debug_outputs_by_architecture(link_result.outputs) - archive = outputs.archive( + archive_for_embedding = outputs.archive( actions = actions, bundle_extension = bundle_extension, bundle_name = bundle_name, @@ -921,6 +929,13 @@ def _watchos_extension_impl(ctx): predeclared_outputs = predeclared_outputs, ) + if ctx.attr.extensionkit_extension: + plugins = [] + extensions = [archive_for_embedding] + else: + plugins = [archive_for_embedding] + extensions = [] + bundle_verification_targets = [struct(target = ext) for ext in ctx.attr.extensions] processor_partials = [ @@ -965,7 +980,7 @@ def _watchos_extension_impl(ctx): actions = actions, apple_mac_toolchain_info = apple_mac_toolchain_info, bundle_extension = bundle_extension, - bundle_location = processor.location.plugin, + bundle_location = bundle_location, bundle_name = bundle_name, embed_target_dossiers = True, embedded_targets = embeddable_targets, @@ -990,7 +1005,8 @@ def _watchos_extension_impl(ctx): bundle_embedded_bundles = True, platform_prerequisites = platform_prerequisites, embeddable_targets = embeddable_targets, - plugins = [archive], + plugins = plugins, + extensions = extensions, ), partials.extension_safe_validation_partial( is_extension_safe = True, diff --git a/doc/rules-watchos.md b/doc/rules-watchos.md index dd17077326..6e05e14a26 100644 --- a/doc/rules-watchos.md +++ b/doc/rules-watchos.md @@ -128,9 +128,10 @@ Builds and bundles a watchOS dynamic framework that is consumable by Xcode.
watchos_extension(name, additional_linker_inputs, application_extension, bundle_id, bundle_name, codesign_inputs, codesignopts, deps, entitlements, entitlements_validation, - executable_name, exported_symbols_lists, extensions, frameworks, infoplists, - ipa_post_processor, linkopts, minimum_deployment_os_version, minimum_os_version, - platform_type, provisioning_profile, resources, stamp, strings, version) + executable_name, exported_symbols_lists, extensionkit_extension, extensions, + frameworks, infoplists, ipa_post_processor, linkopts, minimum_deployment_os_version, + minimum_os_version, platform_type, provisioning_profile, resources, stamp, strings, + version)Builds and bundles an watchOS Extension. @@ -156,6 +157,7 @@ so these bundling rules do not support that version of the platform. | entitlements_validation | An [
entitlements_validation_mode
](/doc/types.md#entitlements-validation-mode) to control the validation of the requested entitlements against the provisioning profile to ensure they are supported. | String | optional | "loose"
|
| executable_name | The desired name of the executable, if the bundle has an executable. If this attribute is not set, then the name of the bundle_name
attribute will be used if it is set; if not, then the name of the target will be used instead. | String | optional | ""
|
| exported_symbols_lists | A list of targets containing exported symbols lists files for the linker to control symbol resolution.__private_extern__
(aka visibility=hidden
) and will not be global in the output file.ld(1)
on macOS for more details. | List of labels | optional | []
|
+| extensionkit_extension | If True
, this extension is an ExtensionKit Extension instead of a WatchKit Extension. It links the extension with the application extension point (_NSExtensionMain
) instead of the WatchKit extension point (_WKExtensionMain
), and has the extensionkit_extension
product_type
instead of watch2_extension
. | Boolean | optional | False
|
| extensions | A list of watchOS application extensions to include in the final watch extension bundle. | List of labels | optional | []
|
| frameworks | A list of framework targets (see [watchos_framework
](https://github.com/bazelbuild/rules_apple/blob/master/doc/rules-watchos.md#watchos_framework)) that this target depends on. | List of labels | optional | []
|
| infoplists | A list of .plist files that will be merged to form the Info.plist for this target. At least one file must be specified. Please see [Info.plist Handling](https://github.com/bazelbuild/rules_apple/blob/master/doc/common_info.md#infoplist-handling) for what is supported. | List of labels | required | |
diff --git a/test/starlark_tests/BUILD b/test/starlark_tests/BUILD
index d9df934469..f95ee05365 100644
--- a/test/starlark_tests/BUILD
+++ b/test/starlark_tests/BUILD
@@ -43,6 +43,7 @@ load(":watchos_application_swift_tests.bzl", "watchos_application_swift_test_sui
load(":watchos_application_tests.bzl", "watchos_application_test_suite")
load(":watchos_dynamic_framework_tests.bzl", "watchos_dynamic_framework_test_suite")
load(":watchos_extension_tests.bzl", "watchos_extension_test_suite")
+load(":watchos_extensionkit_extension_tests.bzl", "watchos_extensionkit_extension_test_suite")
load(":watchos_framework_tests.bzl", "watchos_framework_test_suite")
load(":watchos_static_framework_tests.bzl", "watchos_static_framework_test_suite")
load(":watchos_ui_test_tests.bzl", "watchos_ui_test_test_suite")
@@ -141,6 +142,8 @@ watchos_dynamic_framework_test_suite(name = "watchos_dynamic_framework")
watchos_extension_test_suite(name = "watchos_extension")
+watchos_extensionkit_extension_test_suite(name = "watchos_extensionkit_extension")
+
watchos_framework_test_suite(name = "watchos_framework")
watchos_static_framework_test_suite(name = "watchos_static_framework")
diff --git a/test/starlark_tests/targets_under_test/watchos/BUILD b/test/starlark_tests/targets_under_test/watchos/BUILD
index db894535f9..7c0a4a33a4 100644
--- a/test/starlark_tests/targets_under_test/watchos/BUILD
+++ b/test/starlark_tests/targets_under_test/watchos/BUILD
@@ -245,6 +245,207 @@ ios_application(
# ---------------------------------------------------------------------------------------
+watchos_application(
+ name = "app_with_exappextension",
+ app_icons = ["//test/starlark_tests/resources:WatchAppIcon.xcassets"],
+ bundle_id = "com.google.example",
+ extension = ":exappextension",
+ infoplists = [
+ "//test/starlark_tests/resources:WatchosAppInfo.plist",
+ ],
+ minimum_os_version = common.min_os_watchos.baseline,
+ provisioning_profile = "//test/testdata/provisioning:integration_testing_ios.mobileprovision",
+ tags = common.fixture_tags,
+)
+
+watchos_application(
+ name = "app_with_exappextension_with_imported_fmwk",
+ app_icons = ["//test/starlark_tests/resources:WatchAppIcon.xcassets"],
+ bundle_id = "com.google.example",
+ extension = ":exappextension_with_imported_fmwk",
+ infoplists = [
+ "//test/starlark_tests/resources:WatchosAppInfo.plist",
+ ],
+ minimum_os_version = common.min_os_watchos.baseline,
+ tags = common.fixture_tags,
+)
+
+watchos_application(
+ name = "app_arm64_support_exappextension",
+ app_icons = ["//test/starlark_tests/resources:WatchAppIcon.xcassets"],
+ bundle_id = "com.google.example",
+ extension = ":exappextension_arm64_support",
+ infoplists = [
+ "//test/starlark_tests/resources:WatchosAppInfo.plist",
+ ],
+ minimum_os_version = common.min_os_watchos.arm64_support,
+ provisioning_profile = "//test/testdata/provisioning:integration_testing_ios.mobileprovision",
+ tags = common.fixture_tags,
+)
+
+watchos_extension(
+ name = "exappextension",
+ bundle_id = "com.google.example.exappextension",
+ entitlements = "//test/starlark_tests/resources:entitlements.plist",
+ extensionkit_extension = True,
+ infoplists = [
+ "//test/starlark_tests/resources:WatchosExtensionInfo.plist",
+ ],
+ minimum_os_version = common.min_os_watchos.baseline,
+ provisioning_profile = "//test/testdata/provisioning:integration_testing_ios.mobileprovision",
+ resources = [
+ "//test/starlark_tests/resources:complications_watchos",
+ "//test/starlark_tests/resources:example_filegroup",
+ "//test/starlark_tests/resources:localization",
+ "//test/starlark_tests/resources:resource_bundle",
+ ],
+ tags = common.fixture_tags,
+ deps = [
+ "//test/starlark_tests/resources:watchkit_ext_main_lib",
+ ],
+)
+
+watchos_extension(
+ name = "exappextension_with_fmwk",
+ bundle_id = "com.google.example.exappextension",
+ entitlements = "//test/starlark_tests/resources:entitlements.plist",
+ extensionkit_extension = True,
+ frameworks = [":fmwk"],
+ infoplists = [
+ "//test/starlark_tests/resources:WatchosExtensionInfo.plist",
+ ],
+ minimum_os_version = common.min_os_watchos.baseline,
+ provisioning_profile = "//test/testdata/provisioning:integration_testing_ios.mobileprovision",
+ tags = common.fixture_tags,
+ deps = [
+ "//test/starlark_tests/resources:watchkit_ext_main_lib",
+ ],
+)
+
+watchos_extension(
+ name = "exappextension_with_two_fmwk_provisioned",
+ bundle_id = "com.google.example.exappextension",
+ entitlements = "//test/starlark_tests/resources:entitlements.plist",
+ extensionkit_extension = True,
+ frameworks = [
+ ":fmwk_with_provisioning",
+ ":second_fmwk_with_provisioning",
+ ],
+ infoplists = [
+ "//test/starlark_tests/resources:WatchosExtensionInfo.plist",
+ ],
+ ipa_post_processor = "//test/starlark_tests/targets_under_test/apple:ipa_post_processor_verify_codesigning",
+ minimum_os_version = common.min_os_watchos.baseline,
+ provisioning_profile = "//test/testdata/provisioning:integration_testing_ios.mobileprovision",
+ tags = common.fixture_tags,
+ deps = [
+ "//test/starlark_tests/resources:watchkit_ext_main_lib",
+ ],
+)
+
+watchos_extension(
+ name = "exappextension_with_fmwk_with_fmwk_provisioned",
+ bundle_id = "com.google.example.exappextension",
+ entitlements = "//test/starlark_tests/resources:entitlements.plist",
+ extensionkit_extension = True,
+ frameworks = [":fmwk_with_fmwk_with_provisioning"],
+ infoplists = [
+ "//test/starlark_tests/resources:WatchosExtensionInfo.plist",
+ ],
+ ipa_post_processor = "//test/starlark_tests/targets_under_test/apple:ipa_post_processor_verify_codesigning",
+ minimum_os_version = common.min_os_watchos.baseline,
+ provisioning_profile = "//test/testdata/provisioning:integration_testing_ios.mobileprovision",
+ tags = common.fixture_tags,
+ deps = [
+ "//test/starlark_tests/resources:watchkit_ext_main_lib",
+ ],
+)
+
+watchos_extension(
+ name = "exappextension_with_fmwk_with_fmwk",
+ bundle_id = "com.google.example.exappextension",
+ entitlements = "//test/starlark_tests/resources:entitlements.plist",
+ extensionkit_extension = True,
+ frameworks = [":fmwk_with_fmwk"],
+ infoplists = [
+ "//test/starlark_tests/resources:WatchosExtensionInfo.plist",
+ ],
+ minimum_os_version = common.min_os_watchos.baseline,
+ provisioning_profile = "//test/testdata/provisioning:integration_testing_ios.mobileprovision",
+ tags = common.fixture_tags,
+ deps = [
+ "//test/starlark_tests/resources:watchkit_ext_main_lib",
+ ],
+)
+
+watchos_extension(
+ name = "exappextension_with_imported_fmwk",
+ bundle_id = "com.google.example.exappextension",
+ entitlements = "//test/starlark_tests/resources:entitlements.plist",
+ extensionkit_extension = True,
+ infoplists = [
+ "//test/starlark_tests/resources:WatchosExtensionInfo.plist",
+ ],
+ ipa_post_processor = "//test/starlark_tests/targets_under_test/apple:ipa_post_processor_verify_codesigning",
+ minimum_os_version = common.min_os_watchos.baseline,
+ provisioning_profile = "//test/testdata/provisioning:integration_testing_ios.mobileprovision",
+ tags = common.fixture_tags,
+ deps = [
+ ":dynamic_fmwk_depending_lib",
+ "//test/starlark_tests/resources:watchkit_ext_main_lib",
+ ],
+)
+
+watchos_extension(
+ name = "exappextension_with_runtime_framework_using_import_static_lib_dep",
+ bundle_id = "com.google.example",
+ extensionkit_extension = True,
+ frameworks = [":fmwk_with_imported_static_framework"],
+ infoplists = [
+ "//test/starlark_tests/resources:WatchosExtensionInfo.plist",
+ ],
+ ipa_post_processor = "//test/starlark_tests/targets_under_test/apple:ipa_post_processor_verify_codesigning",
+ minimum_os_version = common.min_os_watchos.baseline,
+ tags = common.fixture_tags,
+ deps = [
+ "//test/starlark_tests/resources:objc_main_lib",
+ ],
+)
+
+watchos_extension(
+ name = "exappextension_multiple_infoplists",
+ bundle_id = "com.google.example.exappextension",
+ extensionkit_extension = True,
+ infoplists = [
+ "//test/starlark_tests/resources:Another.plist",
+ "//test/starlark_tests/resources:WatchosExtensionInfo.plist",
+ ],
+ minimum_os_version = common.min_os_watchos.baseline,
+ tags = common.fixture_tags,
+)
+
+watchos_extension(
+ name = "exappextension_arm64_support",
+ bundle_id = "com.google.example.exappextension",
+ extensionkit_extension = True,
+ infoplists = [
+ "//test/starlark_tests/resources:WatchosExtensionInfo.plist",
+ ],
+ minimum_os_version = common.min_os_watchos.arm64_support,
+ provisioning_profile = "//test/testdata/provisioning:integration_testing_ios.mobileprovision",
+ resources = [
+ "//test/starlark_tests/resources:example_filegroup",
+ "//test/starlark_tests/resources:localization",
+ "//test/starlark_tests/resources:resource_bundle",
+ ],
+ tags = common.fixture_tags,
+ deps = [
+ "//test/starlark_tests/resources:watchkit_ext_main_lib",
+ ],
+)
+
+# ---------------------------------------------------------------------------------------
+
watchos_framework(
name = "fmwk",
bundle_id = "com.google.example.framework",
@@ -493,6 +694,73 @@ watchos_application(
# ---------------------------------------------------------------------------------------
+ios_application(
+ name = "ios_watchos_with_watchos_exappextension",
+ bundle_id = "com.google",
+ bundle_name = "companion",
+ families = ["iphone"],
+ infoplists = [
+ "//test/starlark_tests/resources:Info.plist",
+ ],
+ minimum_os_version = common.min_os_ios.arm_sim_support,
+ provisioning_profile = "//test/testdata/provisioning:integration_testing_ios.mobileprovision",
+ tags = common.fixture_tags,
+ watch_application = ":watchos_app_with_exappextension",
+ deps = [
+ ":swift_lib",
+ ],
+)
+
+watchos_extension(
+ name = "watchos_exappextension",
+ bundle_id = "com.google.example.watchosext.nestedwatchosext",
+ entitlements = "//test/starlark_tests/resources:entitlements.plist",
+ extensionkit_extension = True,
+ infoplists = [
+ "//test/starlark_tests/resources:Info.plist",
+ ],
+ minimum_os_version = common.min_os_watchos.baseline,
+ provisioning_profile = "//test/testdata/provisioning:integration_testing_ios.mobileprovision",
+ tags = common.fixture_tags,
+ deps = [
+ "//test/starlark_tests/resources:objc_main_lib",
+ ],
+)
+
+watchos_extension(
+ name = "watchos_exappextension_with_exappextension",
+ bundle_id = "com.google.example.watchosext",
+ bundle_name = "ext",
+ entitlements = "//test/starlark_tests/resources:entitlements.plist",
+ extensionkit_extension = True,
+ extensions = [":watchos_exappextension"],
+ infoplists = [
+ "//test/starlark_tests/resources:WatchosExtensionInfo.plist",
+ ],
+ minimum_os_version = common.min_os_watchos.baseline,
+ provisioning_profile = "//test/testdata/provisioning:integration_testing_ios.mobileprovision",
+ tags = common.fixture_tags,
+ deps = [
+ "//test/starlark_tests/resources:objc_main_lib",
+ ],
+)
+
+watchos_application(
+ name = "watchos_app_with_exappextension",
+ app_icons = ["//test/starlark_tests/resources:WatchAppIcon.xcassets"],
+ bundle_id = "com.google.example",
+ bundle_name = "app",
+ extension = ":watchos_exappextension_with_exappextension",
+ infoplists = [
+ "//test/starlark_tests/resources:WatchosAppInfo.plist",
+ ],
+ minimum_os_version = common.min_os_watchos.baseline,
+ provisioning_profile = "//test/testdata/provisioning:integration_testing_ios.mobileprovision",
+ tags = common.fixture_tags,
+)
+
+# ---------------------------------------------------------------------------------------
+
ios_application(
name = "ios_with_swift_watchos_no_swift",
bundle_id = "com.google",
diff --git a/test/starlark_tests/watchos_extensionkit_extension_tests.bzl b/test/starlark_tests/watchos_extensionkit_extension_tests.bzl
new file mode 100644
index 0000000000..35ea11d250
--- /dev/null
+++ b/test/starlark_tests/watchos_extensionkit_extension_tests.bzl
@@ -0,0 +1,261 @@
+# Copyright 2019 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""watchos_extensionkit_extension Starlark tests."""
+
+load(
+ "@build_bazel_rules_apple//apple/internal:apple_product_type.bzl", # buildifier: disable=bzl-visibility
+ "apple_product_type",
+) # buildifier: disable=bzl-visibility
+load(
+ ":common.bzl",
+ "common",
+)
+load(
+ ":rules/apple_verification_test.bzl",
+ "apple_verification_test",
+)
+load(
+ ":rules/product_type_test.bzl",
+ "product_type_test",
+)
+load(
+ ":rules/common_verification_tests.bzl",
+ "archive_contents_test",
+ "bitcode_symbol_map_test",
+ "entry_point_test",
+)
+load(
+ ":rules/infoplist_contents_test.bzl",
+ "infoplist_contents_test",
+)
+load(
+ ":rules/linkmap_test.bzl",
+ "linkmap_test",
+)
+
+def watchos_extensionkit_extension_test_suite(name):
+ """Test suite for watchos_extensionkit_extension.
+
+ Args:
+ name: the base name to be used in things created by this macro
+ """
+ apple_verification_test(
+ name = "{}_codesign_test".format(name),
+ build_type = "simulator",
+ target_under_test = "//test/starlark_tests/targets_under_test/watchos:exappextension",
+ verifier_script = "verifier_scripts/codesign_verifier.sh",
+ tags = [name],
+ )
+
+ apple_verification_test(
+ name = "{}_imported_fmwk_codesign_test".format(name),
+ build_type = "simulator",
+ target_under_test = "//test/starlark_tests/targets_under_test/watchos:exappextension_with_imported_fmwk",
+ verifier_script = "verifier_scripts/codesign_verifier.sh",
+ tags = [name],
+ )
+
+ apple_verification_test(
+ name = "{}_entitlements_simulator_test".format(name),
+ build_type = "simulator",
+ target_under_test = "//test/starlark_tests/targets_under_test/watchos:exappextension",
+ verifier_script = "verifier_scripts/entitlements_verifier.sh",
+ tags = [name],
+ )
+
+ apple_verification_test(
+ name = "{}_entitlements_device_test".format(name),
+ build_type = "device",
+ target_under_test = "//test/starlark_tests/targets_under_test/watchos:exappextension",
+ verifier_script = "verifier_scripts/entitlements_verifier.sh",
+ tags = [name],
+ )
+
+ archive_contents_test(
+ name = "{}_resources_simulator_test".format(name),
+ build_type = "simulator",
+ contains = [
+ "$RESOURCE_ROOT/resource_bundle.bundle/Info.plist",
+ "$RESOURCE_ROOT/Another.plist",
+ "$RESOURCE_ROOT/Assets.car",
+ ],
+ target_under_test = "//test/starlark_tests/targets_under_test/watchos:exappextension",
+ tags = [name],
+ )
+
+ archive_contents_test(
+ name = "{}_strings_simulator_test".format(name),
+ build_type = "simulator",
+ target_under_test = "//test/starlark_tests/targets_under_test/watchos:exappextension",
+ contains = [
+ "$RESOURCE_ROOT/localization.bundle/en.lproj/files.stringsdict",
+ "$RESOURCE_ROOT/localization.bundle/en.lproj/greetings.strings",
+ ],
+ tags = [name],
+ )
+
+ archive_contents_test(
+ name = "{}_imported_fmwk_simulator_test".format(name),
+ build_type = "simulator",
+ contains = [
+ "$RESOURCE_ROOT/Frameworks/generated_watchos_dynamic_fmwk.framework/generated_watchos_dynamic_fmwk",
+ "$RESOURCE_ROOT/Frameworks/generated_watchos_dynamic_fmwk.framework/Info.plist",
+ ],
+ target_under_test = "//test/starlark_tests/targets_under_test/watchos:exappextension_with_imported_fmwk",
+ tags = [name],
+ )
+
+ infoplist_contents_test(
+ name = "{}_plist_test".format(name),
+ target_under_test = "//test/starlark_tests/targets_under_test/watchos:exappextension",
+ expected_values = {
+ "BuildMachineOSBuild": "*",
+ "CFBundleExecutable": "exappextension",
+ "CFBundleIdentifier": "com.google.example.exappextension",
+ "CFBundleName": "exappextension",
+ "CFBundlePackageType": "XPC!",
+ "CFBundleSupportedPlatforms:0": "WatchSimulator*",
+ "DTCompiler": "com.apple.compilers.llvm.clang.1_0",
+ "DTPlatformBuild": "*",
+ "DTPlatformName": "watchsimulator*",
+ "DTPlatformVersion": "*",
+ "DTSDKBuild": "*",
+ "DTSDKName": "watchsimulator*",
+ "DTXcode": "*",
+ "DTXcodeBuild": "*",
+ "MinimumOSVersion": common.min_os_watchos.baseline,
+ "NSExtension:NSExtensionAttributes:WKAppBundleIdentifier": "com.google.example",
+ "NSExtension:NSExtensionPointIdentifier": "com.apple.watchkit",
+ "UIDeviceFamily:0": "4",
+ },
+ tags = [name],
+ )
+
+ infoplist_contents_test(
+ name = "{}_multiple_plist_test".format(name),
+ target_under_test = "//test/starlark_tests/targets_under_test/watchos:exappextension_multiple_infoplists",
+ expected_values = {
+ "AnotherKey": "AnotherValue",
+ "CFBundleExecutable": "exappextension_multiple_infoplists",
+ },
+ tags = [name],
+ )
+
+ # Tests that the archive contains Bitcode symbol maps when Bitcode is
+ # enabled. We have to test this by building a companion iOS application,
+ # since the symbol maps are only included in a top-level archive for
+ # distribution.
+ bitcode_symbol_map_test(
+ name = "{}_archive_contains_bitcode_symbol_maps_test".format(name),
+ binary_paths = [
+ "Payload/app_companion.app/Watch/app.app/Extensions/exappextension.appex/exappextension",
+ ],
+ target_under_test = "//test/starlark_tests/targets_under_test/watchos:app_companion",
+ tags = [name],
+ )
+
+ # Tests that the linkmap outputs are produced when `--objc_generate_linkmap`
+ # is present.
+ linkmap_test(
+ name = "{}_linkmap_test".format(name),
+ target_under_test = "//test/starlark_tests/targets_under_test/watchos:exappextension",
+ tags = [name],
+ )
+
+ # Tests that the provisioning profile is present when built for device.
+ archive_contents_test(
+ name = "{}_contains_provisioning_profile_test".format(name),
+ build_type = "device",
+ target_under_test = "//test/starlark_tests/targets_under_test/watchos:exappextension",
+ contains = [
+ "$BUNDLE_ROOT/embedded.mobileprovision",
+ ],
+ tags = [name],
+ )
+
+ archive_contents_test(
+ name = "{}_correct_rpath_header_value_test".format(name),
+ build_type = "device",
+ binary_test_file = "$CONTENT_ROOT/exappextension",
+ macho_load_commands_contain = [
+ "path @executable_path/Frameworks (offset 12)",
+ "path @executable_path/../../Frameworks (offset 12)",
+ ],
+ target_under_test = "//test/starlark_tests/targets_under_test/watchos:exappextension",
+ tags = [name],
+ )
+
+ entry_point_test(
+ name = "{}_entry_point_test".format(name),
+ build_type = "simulator",
+ entry_point = "_NSExtensionMain",
+ target_under_test = "//test/starlark_tests/targets_under_test/watchos:exappextension",
+ tags = [name],
+ )
+
+ entry_point_test(
+ name = "{}_entry_point_exappextension_test".format(name),
+ build_type = "simulator",
+ entry_point = "_NSExtensionMain",
+ target_under_test = "//test/starlark_tests/targets_under_test/watchos:watchos_exappextension",
+ tags = [name],
+ )
+
+ product_type_test(
+ name = "{}_product_type_watchkit_extension".format(name),
+ expected_product_type = apple_product_type.extensionkit_extension,
+ target_under_test = "//test/starlark_tests/targets_under_test/watchos:exappextension",
+ tags = [name],
+ )
+
+ product_type_test(
+ name = "{}_product_type_exappextension".format(name),
+ expected_product_type = apple_product_type.extensionkit_extension,
+ target_under_test = "//test/starlark_tests/targets_under_test/watchos:watchos_exappextension",
+ )
+
+ # Test that the output binary omits the 32 bit watchOS slice when built for a minimum OS that
+ # does not support 32 bit architectures.
+ archive_contents_test(
+ name = "{}_watchos_binary_contents_dropping_32_bit_device_archs_test".format(name),
+ build_type = "device",
+ target_under_test = "//test/starlark_tests/targets_under_test/watchos:exappextension_arm64_support",
+ cpus = {
+ "watchos_cpus": ["armv7k", "arm64_32"],
+ },
+ binary_test_file = "$BINARY",
+ binary_not_contains_architectures = ["armv7k"],
+ tags = [name],
+ )
+
+ # Test that the watchOS output binary still contains the 64 bit Arm slice when built for a
+ # minimum OS that does not support 32 bit architectures.
+ archive_contents_test(
+ name = "{}_watchos_binary_contents_retains_arm64_32_when_dropping_32_bit_device_archs_test".format(name),
+ build_type = "device",
+ target_under_test = "//test/starlark_tests/targets_under_test/watchos:exappextension_arm64_support",
+ cpus = {
+ "watchos_cpus": ["armv7k", "arm64_32"],
+ },
+ binary_test_file = "$BINARY",
+ binary_test_architecture = "arm64_32",
+ macho_load_commands_contain = ["cmd LC_BUILD_VERSION"],
+ tags = [name],
+ )
+
+ native.test_suite(
+ name = name,
+ tags = [name],
+ )