Skip to content

Commit 0385289

Browse files
authored
Avoid conflicting actions for xcframework bundles with custom bundle names (#2883)
1 parent b506b43 commit 0385289

File tree

3 files changed

+54
-3
lines changed

3 files changed

+54
-3
lines changed

apple/internal/outputs.bzl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,14 @@ def _archive(
5151
if bundle_name != label_name:
5252
archive_relative_path = rule_descriptor.bundle_locations.archive_relative
5353
root_path = label_name + "_archive-root"
54-
return actions.declare_directory(
55-
paths.join(root_path, archive_relative_path, bundle_name_with_extension),
56-
)
54+
if output_discriminator:
55+
return actions.declare_directory(
56+
paths.join(root_path, archive_relative_path, output_discriminator, bundle_name_with_extension),
57+
)
58+
else:
59+
return actions.declare_directory(
60+
paths.join(root_path, archive_relative_path, bundle_name_with_extension),
61+
)
5762
if output_discriminator:
5863
return actions.declare_directory(paths.join(
5964
output_discriminator,

test/starlark_tests/apple_xcframework_tests.bzl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,30 @@ def apple_xcframework_test_suite(name):
792792
tags = [name],
793793
)
794794

795+
directory_test(
796+
name = "{}_ios_dynamic_xcframework_custom_bundle_name_tree_artifact_test".format(name),
797+
build_settings = {
798+
build_settings_labels.use_tree_artifacts_outputs: "True",
799+
},
800+
target_under_test = "//test/starlark_tests/targets_under_test/apple:ios_dynamic_xcframework_custom_bundle_name",
801+
expected_directories = {
802+
"CustomBundleName.xcframework": [
803+
"Info.plist",
804+
"ios-arm64/CustomBundleName.framework/CustomBundleName",
805+
"ios-arm64/CustomBundleName.framework/Info.plist",
806+
"ios-arm64/CustomBundleName.framework/Headers/CustomBundleName.h",
807+
"ios-arm64/CustomBundleName.framework/Headers/shared.h",
808+
"ios-arm64/CustomBundleName.framework/Modules/module.modulemap",
809+
"ios-x86_64-simulator/CustomBundleName.framework/CustomBundleName",
810+
"ios-x86_64-simulator/CustomBundleName.framework/Info.plist",
811+
"ios-x86_64-simulator/CustomBundleName.framework/Headers/CustomBundleName.h",
812+
"ios-x86_64-simulator/CustomBundleName.framework/Headers/shared.h",
813+
"ios-x86_64-simulator/CustomBundleName.framework/Modules/module.modulemap",
814+
],
815+
},
816+
tags = [name],
817+
)
818+
795819
native.test_suite(
796820
name = name,
797821
tags = [name],

test/starlark_tests/targets_under_test/apple/BUILD

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,28 @@ apple_xcframework(
353353
deps = [":fmwk_lib"],
354354
)
355355

356+
apple_xcframework(
357+
name = "ios_dynamic_xcframework_custom_bundle_name",
358+
bundle_id = "com.google.example",
359+
bundle_name = "CustomBundleName",
360+
extension_safe = True,
361+
infoplists = [
362+
"//test/starlark_tests/resources:Info.plist",
363+
],
364+
ios = {
365+
"simulator": ["x86_64"],
366+
"device": ["arm64"],
367+
},
368+
minimum_os_versions = {
369+
"ios": common.min_os_ios.baseline,
370+
},
371+
public_hdrs = [
372+
"//test/starlark_tests/resources:shared.h",
373+
],
374+
tags = common.fixture_tags,
375+
deps = [":fmwk_lib"],
376+
)
377+
356378
genrule(
357379
name = "generate_umbrella_header",
358380
outs = ["Umbrella.h"],

0 commit comments

Comments
 (0)