Skip to content

Commit

Permalink
Adjust and add apple_precompiled_resource_bundle tests (#2593)
Browse files Browse the repository at this point in the history
Signed-off-by: Brentley Jones <[email protected]>
  • Loading branch information
brentleyjones authored Nov 13, 2024
1 parent 35516f8 commit c48e947
Show file tree
Hide file tree
Showing 4 changed files with 158 additions and 54 deletions.
88 changes: 65 additions & 23 deletions test/starlark_tests/ios_application_resources_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down Expand Up @@ -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!",
},
Expand Down Expand Up @@ -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",
Expand Down
75 changes: 75 additions & 0 deletions test/starlark_tests/resources/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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 = [
Expand Down Expand Up @@ -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 = [
Expand Down
19 changes: 18 additions & 1 deletion test/starlark_tests/targets_under_test/ios/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
)
Expand Down Expand Up @@ -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",
Expand Down
30 changes: 0 additions & 30 deletions test/testdata/resources/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit c48e947

Please sign in to comment.