From c48e94761171b7b9f97a8071289b662a4a6ed225 Mon Sep 17 00:00:00 2001 From: Brentley Jones Date: Wed, 13 Nov 2024 10:26:55 -0600 Subject: [PATCH] Adjust and add `apple_precompiled_resource_bundle` tests (#2593) Signed-off-by: Brentley Jones --- .../ios_application_resources_test.bzl | 88 ++++++++++++++----- test/starlark_tests/resources/BUILD | 75 ++++++++++++++++ .../targets_under_test/ios/BUILD | 19 +++- test/testdata/resources/BUILD | 30 ------- 4 files changed, 158 insertions(+), 54 deletions(-) diff --git a/test/starlark_tests/ios_application_resources_test.bzl b/test/starlark_tests/ios_application_resources_test.bzl index c5e99c1535..d5b4990911 100644 --- a/test/starlark_tests/ios_application_resources_test.bzl +++ b/test/starlark_tests/ios_application_resources_test.bzl @@ -348,34 +348,34 @@ app_icons was assigned the following: [ name = "{}_apple_precompiled_resource_bundle_test".format(name), build_type = "device", compilation_mode = "opt", - plist_test_file = "$CONTENT_ROOT/bundle_library_ios.bundle/Info.plist", + plist_test_file = "$CONTENT_ROOT/precompiled_bundle_library_ios.bundle/Info.plist", plist_test_values = { - "CFBundleIdentifier": "org.bazel.bundle-library-ios", - "CFBundleName": "bundle_library_ios.bundle", + "CFBundleIdentifier": "org.bazel.precompiled-bundle-library-ios", + "CFBundleName": "precompiled_bundle_library_ios.bundle", "CFBundlePackageType": "BNDL", - "TargetName": "bundle_library_ios", + "TargetName": "precompiled_bundle_library_ios", }, contains = [ - "$BUNDLE_ROOT/bundle_library_ios.bundle/basic.bundle/basic_bundle.txt", - "$BUNDLE_ROOT/bundle_library_ios.bundle/default.metallib", - "$BUNDLE_ROOT/bundle_library_ios.bundle/it.lproj/localized.strings", - "$BUNDLE_ROOT/bundle_library_ios.bundle/it.lproj/localized.txt", - "$BUNDLE_ROOT/bundle_library_ios.bundle/it.lproj/storyboard_ios.storyboardc/", - "$BUNDLE_ROOT/bundle_library_ios.bundle/it.lproj/view_ios.nib", - "$BUNDLE_ROOT/bundle_library_ios.bundle/mapping_model.cdm", - "$BUNDLE_ROOT/bundle_library_ios.bundle/nonlocalized_resource.txt", - "$BUNDLE_ROOT/bundle_library_ios.bundle/storyboard_ios.storyboardc/", - "$BUNDLE_ROOT/bundle_library_ios.bundle/unversioned_datamodel.mom", - "$BUNDLE_ROOT/bundle_library_ios.bundle/versioned_datamodel.momd/v1.mom", - "$BUNDLE_ROOT/bundle_library_ios.bundle/versioned_datamodel.momd/v2.mom", - "$BUNDLE_ROOT/bundle_library_ios.bundle/versioned_datamodel.momd/VersionInfo.plist", - "$BUNDLE_ROOT/bundle_library_ios.bundle/view_ios.nib", - "$BUNDLE_ROOT/bundle_library_ios.bundle/structured/nested.txt", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/basic.bundle/basic_bundle.txt", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/default.metallib", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/it.lproj/localized.strings", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/it.lproj/localized.txt", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/it.lproj/storyboard_ios.storyboardc/", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/it.lproj/view_ios.nib", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/mapping_model.cdm", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/nonlocalized_resource.txt", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/storyboard_ios.storyboardc/", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/unversioned_datamodel.mom", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/versioned_datamodel.momd/v1.mom", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/versioned_datamodel.momd/v2.mom", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/versioned_datamodel.momd/VersionInfo.plist", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/view_ios.nib", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/structured/nested.txt", ], is_binary_plist = [ - "$BUNDLE_ROOT/bundle_library_ios.bundle/structured/generated.strings", - "$BUNDLE_ROOT/bundle_library_ios.bundle/structured/should_be_binary.plist", - "$BUNDLE_ROOT/bundle_library_ios.bundle/structured/should_be_binary.strings", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/structured/generated.strings", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/structured/should_be_binary.plist", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/structured/should_be_binary.strings", ], target_under_test = "//test/starlark_tests/targets_under_test/ios:app_precompiled_resource_bundle", tags = [name], @@ -423,7 +423,7 @@ app_icons was assigned the following: [ archive_contents_test( name = "{}_precompiled_resource_bundle_generated_strings_test".format(name), build_type = "simulator", - plist_test_file = "$CONTENT_ROOT/bundle_library_ios.bundle/structured/generated.strings", + plist_test_file = "$CONTENT_ROOT/precompiled_bundle_library_ios.bundle/structured/generated.strings", plist_test_values = { "generated_structured_string": "I like turtles too!", }, @@ -726,6 +726,48 @@ app_icons was assigned the following: [ tags = [name], ) + archive_contents_test( + name = "{}_with_multiple_precompiled_resource_bundles_with_shared_resources_test".format(name), + build_type = "device", + compilation_mode = "opt", + target_under_test = "//test/starlark_tests/targets_under_test/ios:app_with_multiple_precompiled_resource_bundles_with_shared_resources", + contains = [ + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/basic.bundle/basic_bundle.txt", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/it.lproj/localized.strings", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/it.lproj/localized.txt", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/it.lproj/storyboard_ios.storyboardc/", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/it.lproj/view_ios.nib", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/mapping_model.cdm", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/nonlocalized_resource.txt", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/storyboard_ios.storyboardc/", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/unversioned_datamodel.mom", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/versioned_datamodel.momd/v1.mom", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/versioned_datamodel.momd/v2.mom", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/versioned_datamodel.momd/VersionInfo.plist", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/view_ios.nib", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/structured/nested.txt", + "$BUNDLE_ROOT/precompiled_bundle_library_apple.bundle/basic.bundle/basic_bundle.txt", + "$BUNDLE_ROOT/precompiled_bundle_library_apple.bundle/it.lproj/localized.strings", + "$BUNDLE_ROOT/precompiled_bundle_library_apple.bundle/it.lproj/localized.txt", + "$BUNDLE_ROOT/precompiled_bundle_library_apple.bundle/mapping_model.cdm", + "$BUNDLE_ROOT/precompiled_bundle_library_apple.bundle/nonlocalized_resource.txt", + "$BUNDLE_ROOT/precompiled_bundle_library_apple.bundle/unversioned_datamodel.mom", + "$BUNDLE_ROOT/precompiled_bundle_library_apple.bundle/versioned_datamodel.momd/v1.mom", + "$BUNDLE_ROOT/precompiled_bundle_library_apple.bundle/versioned_datamodel.momd/v2.mom", + "$BUNDLE_ROOT/precompiled_bundle_library_apple.bundle/versioned_datamodel.momd/VersionInfo.plist", + "$BUNDLE_ROOT/precompiled_bundle_library_apple.bundle/structured/nested.txt", + ], + is_binary_plist = [ + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/structured/generated.strings", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/structured/should_be_binary.plist", + "$BUNDLE_ROOT/precompiled_bundle_library_ios.bundle/structured/should_be_binary.strings", + "$BUNDLE_ROOT/precompiled_bundle_library_apple.bundle/structured/generated.strings", + "$BUNDLE_ROOT/precompiled_bundle_library_apple.bundle/structured/should_be_binary.plist", + "$BUNDLE_ROOT/precompiled_bundle_library_apple.bundle/structured/should_be_binary.strings", + ], + tags = [name], + ) + archive_contents_test( name = "{}_with_resource_bundle_with_structured_resource_group_test".format(name), build_type = "device", diff --git a/test/starlark_tests/resources/BUILD b/test/starlark_tests/resources/BUILD index 823bb6ddea..9fe862e58f 100644 --- a/test/starlark_tests/resources/BUILD +++ b/test/starlark_tests/resources/BUILD @@ -779,6 +779,38 @@ apple_resource_bundle( tags = common.fixture_tags, ) +apple_precompiled_resource_bundle( + name = "precompiled_bundle_library_ios", + infoplists = [ + "Info-template.plist", + ], + resources = [ + "generated.strings", + "nonlocalized.plist", + "nonlocalized.strings", + "nonlocalized_resource.txt", + "sample.png", + "storyboard_ios.storyboard", + "view_ios.xib", + ":assets", + ":basic_bundle", + ":localized_generic_resources", + ":localized_plists", + ":localized_storyboards_ios", + ":localized_strings", + ":localized_xibs_ios", + ":mapping_model", + ":unversioned_datamodel", + ":versioned_datamodel", + "//test/testdata/resources:metal_files", + ], + structured_resources = [ + ":generate_structured_strings", + ":structured", + ], + tags = common.fixture_tags, +) + apple_resource_bundle( name = "bundle_library_macos", infoplists = [ @@ -817,6 +849,14 @@ objc_library( tags = common.fixture_tags, ) +objc_library( + name = "precompiled_bundle_library_ios_lib", + data = [ + ":precompiled_bundle_library_ios", + ], + tags = common.fixture_tags, +) + apple_resource_bundle( name = "bundle_library_apple", infoplists = [ @@ -852,6 +892,41 @@ objc_library( tags = common.fixture_tags, ) +apple_precompiled_resource_bundle( + name = "precompiled_bundle_library_apple", + infoplists = [ + "Info-template.plist", + ], + resources = [ + "generated.strings", + "nonlocalized.plist", + "nonlocalized.strings", + "nonlocalized_resource.txt", + "sample.png", + ":basic_bundle", + ":localized_generic_resources", + ":localized_plists", + ":localized_strings", + ":mapping_model", + ":unversioned_datamodel", + ":versioned_datamodel", + "//test/testdata/resources:metal_files", + ], + structured_resources = [ + ":generate_structured_strings", + ":structured", + ], + tags = common.fixture_tags, +) + +objc_library( + name = "precompiled_bundle_library_apple_lib", + data = [ + ":precompiled_bundle_library_apple", + ], + tags = common.fixture_tags, +) + apple_resource_group( name = "swift_structured_resources", structured_resources = [ diff --git a/test/starlark_tests/targets_under_test/ios/BUILD b/test/starlark_tests/targets_under_test/ios/BUILD index 9028c71d42..22aaa14169 100644 --- a/test/starlark_tests/targets_under_test/ios/BUILD +++ b/test/starlark_tests/targets_under_test/ios/BUILD @@ -183,13 +183,13 @@ ios_application( ], deps = [ "//test/starlark_tests/resources:basic_bundle_lib", - "//test/starlark_tests/resources:bundle_library_ios_lib", "//test/starlark_tests/resources:empty_strings_file_lib", "//test/starlark_tests/resources:ios_localized_assets_lib", "//test/starlark_tests/resources:ios_non_localized_assets_lib", "//test/starlark_tests/resources:nested_bundle_lib", "//test/starlark_tests/resources:objc_linkopt_lib", "//test/starlark_tests/resources:objc_main_lib", + "//test/starlark_tests/resources:precompiled_bundle_library_ios_lib", "//test/starlark_tests/resources:sticker_pack_ios_lib", ], ) @@ -1067,6 +1067,23 @@ ios_application( ], ) +ios_application( + name = "app_with_multiple_precompiled_resource_bundles_with_shared_resources", + bundle_id = "com.google.example", + families = ["iphone"], + infoplists = [ + "//test/starlark_tests/resources:Info.plist", + ], + minimum_os_version = common.min_os_ios.baseline, + provisioning_profile = "//test/testdata/provisioning:integration_testing_ios.mobileprovision", + tags = common.fixture_tags, + deps = [ + "//test/starlark_tests/resources:objc_main_lib", + "//test/starlark_tests/resources:precompiled_bundle_library_apple_lib", + "//test/starlark_tests/resources:precompiled_bundle_library_ios_lib", + ], +) + ios_application( name = "app_with_resource_bundle_with_structured_resource_group", bundle_id = "com.google.example", diff --git a/test/testdata/resources/BUILD b/test/testdata/resources/BUILD index b499e6a338..7dc4ed28c6 100644 --- a/test/testdata/resources/BUILD +++ b/test/testdata/resources/BUILD @@ -162,36 +162,6 @@ genrule( cmd = "cp $< $@", ) -apple_resource_bundle( - name = "bundle_library_ios", - infoplists = [ - "Info-template.plist", - ], - resources = [ - "generated.strings", - "nonlocalized.plist", - "nonlocalized.strings", - "nonlocalized_resource.txt", - "sample.png", - "storyboard_ios.storyboard", - "view_ios.xib", - ":assets", - ":basic_bundle", - ":localized_generic_resources", - ":localized_plists", - ":localized_storyboards_ios", - ":localized_strings", - ":localized_xibs_ios", - ":mapping_model", - ":unversioned_datamodel", - ":versioned_datamodel", - ], - structured_resources = [ - ":generate_structured_strings", - ":structured", - ], -) - apple_resource_bundle( name = "bundle_library_macos", bundle_name = "bundle_library_macos",