Skip to content

Commit e9a8823

Browse files
nglevinswiple-rules-gardener
authored andcommitted
Give all static libraries produced by the apple_static_xcframework rule file names based directly on the inferred bundle name.
PiperOrigin-RevId: 448546861
1 parent d637743 commit e9a8823

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

apple/internal/xcframework_rules.bzl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,7 @@ def _apple_static_xcframework_impl(ctx):
919919
outputs_archive = ctx.outputs.archive
920920
xcode_config = ctx.attr._xcode_config[apple_common.XcodeVersionConfig]
921921

922+
binary_name = bundle_name + ".a"
922923
link_result = linking_support.register_static_library_linking_action(ctx = ctx)
923924
link_outputs_by_library_identifier = _group_link_outputs_by_library_identifier(
924925
actions = actions,
@@ -937,7 +938,7 @@ def _apple_static_xcframework_impl(ctx):
937938
binary_artifact = link_output.binary
938939
framework_archive_merge_files.append(struct(
939940
src = binary_artifact.path,
940-
dest = paths.join(library_identifier, binary_artifact.basename),
941+
dest = paths.join(library_identifier, binary_name),
941942
))
942943
framework_archive_files.append(depset([binary_artifact]))
943944

@@ -1010,7 +1011,7 @@ def _apple_static_xcframework_impl(ctx):
10101011
environment = link_output.environment,
10111012
headers_path = "Headers",
10121013
library_identifier = library_identifier,
1013-
library_path = binary_artifact.basename,
1014+
library_path = binary_name,
10141015
platform = link_output.platform,
10151016
),
10161017
)

test/starlark_tests/apple_static_xcframework_tests.bzl

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ def apple_static_xcframework_test_suite(name):
3333
plist_test_values = {
3434
"AvailableLibraries:0:HeadersPath": "Headers",
3535
"AvailableLibraries:0:LibraryIdentifier": "ios-arm64",
36-
"AvailableLibraries:0:LibraryPath": "ios_static_xcframework_ios_device.a",
36+
"AvailableLibraries:0:LibraryPath": "ios_static_xcframework.a",
3737
"AvailableLibraries:0:SupportedArchitectures:0": "arm64",
3838
"AvailableLibraries:0:SupportedPlatform": "ios",
3939
"AvailableLibraries:1:HeadersPath": "Headers",
4040
"AvailableLibraries:1:LibraryIdentifier": "ios-arm64_x86_64-simulator",
41-
"AvailableLibraries:1:LibraryPath": "ios_static_xcframework_ios_simulator.a",
41+
"AvailableLibraries:1:LibraryPath": "ios_static_xcframework.a",
4242
"AvailableLibraries:1:SupportedArchitectures:0": "arm64",
4343
"AvailableLibraries:1:SupportedArchitectures:1": "x86_64",
4444
"AvailableLibraries:1:SupportedPlatform": "ios",
@@ -56,11 +56,11 @@ def apple_static_xcframework_test_suite(name):
5656
"$BUNDLE_ROOT/ios-arm64/Headers/shared.h",
5757
"$BUNDLE_ROOT/ios-arm64/Headers/ios_static_xcframework.h",
5858
"$BUNDLE_ROOT/ios-arm64/Headers/module.modulemap",
59-
"$BUNDLE_ROOT/ios-arm64/ios_static_xcframework_ios_device.a",
59+
"$BUNDLE_ROOT/ios-arm64/ios_static_xcframework.a",
6060
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/Headers/shared.h",
6161
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/Headers/ios_static_xcframework.h",
6262
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/Headers/module.modulemap",
63-
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcframework_ios_simulator.a",
63+
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcframework.a",
6464
"$BUNDLE_ROOT/Info.plist",
6565
],
6666
tags = [name],
@@ -72,15 +72,15 @@ def apple_static_xcframework_test_suite(name):
7272
compilation_mode = "opt",
7373
target_under_test = "//test/starlark_tests/targets_under_test/apple:ios_static_xcfmwk_with_avoid_deps",
7474
contains = [
75-
"$BUNDLE_ROOT/ios-arm64/ios_static_xcfmwk_with_avoid_deps_ios_device.a",
76-
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_avoid_deps_ios_simulator.a",
75+
"$BUNDLE_ROOT/ios-arm64/ios_static_xcfmwk_with_avoid_deps.a",
76+
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_avoid_deps.a",
7777
"$BUNDLE_ROOT/Info.plist",
7878
],
7979
not_contains = [
8080
"$BUNDLE_ROOT/ios-arm64/Headers/DummyFmwk.h",
8181
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/Headers/DummyFmwk.h",
8282
],
83-
binary_test_file = "$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_avoid_deps_ios_simulator.a",
83+
binary_test_file = "$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_avoid_deps.a",
8484
binary_test_architecture = "x86_64",
8585
binary_contains_symbols = ["_doStuff"],
8686
binary_not_contains_symbols = ["_frameworkDependent"],
@@ -109,12 +109,12 @@ def apple_static_xcframework_test_suite(name):
109109
"$BUNDLE_ROOT/Info.plist",
110110
"$BUNDLE_ROOT/ios-arm64/ios_static_xcfmwk_with_swift.swiftmodule/arm64.swiftdoc",
111111
"$BUNDLE_ROOT/ios-arm64/ios_static_xcfmwk_with_swift.swiftmodule/arm64.swiftinterface",
112-
"$BUNDLE_ROOT/ios-arm64/ios_static_xcfmwk_with_swift_ios_device.a",
112+
"$BUNDLE_ROOT/ios-arm64/ios_static_xcfmwk_with_swift.a",
113113
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_swift.swiftmodule/arm64.swiftdoc",
114114
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_swift.swiftmodule/arm64.swiftinterface",
115115
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_swift.swiftmodule/x86_64.swiftdoc",
116116
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_swift.swiftmodule/x86_64.swiftinterface",
117-
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_swift_ios_simulator.a",
117+
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_swift.a",
118118
],
119119
tags = [name],
120120
)
@@ -131,14 +131,14 @@ def apple_static_xcframework_test_suite(name):
131131
"$BUNDLE_ROOT/ios-arm64/Headers/module.modulemap",
132132
"$BUNDLE_ROOT/ios-arm64/ios_static_xcfmwk_with_swift_generated_headers.swiftmodule/arm64.swiftdoc",
133133
"$BUNDLE_ROOT/ios-arm64/ios_static_xcfmwk_with_swift_generated_headers.swiftmodule/arm64.swiftinterface",
134-
"$BUNDLE_ROOT/ios-arm64/ios_static_xcfmwk_with_swift_generated_headers_ios_device.a",
134+
"$BUNDLE_ROOT/ios-arm64/ios_static_xcfmwk_with_swift_generated_headers.a",
135135
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/Headers/ios_static_xcfmwk_with_swift_generated_headers.h",
136136
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/Headers/module.modulemap",
137137
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_swift_generated_headers.swiftmodule/arm64.swiftdoc",
138138
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_swift_generated_headers.swiftmodule/arm64.swiftinterface",
139139
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_swift_generated_headers.swiftmodule/x86_64.swiftdoc",
140140
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_swift_generated_headers.swiftmodule/x86_64.swiftinterface",
141-
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_swift_generated_headers_ios_simulator.a",
141+
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_swift_generated_headers.a",
142142
],
143143
tags = [name],
144144
)
@@ -156,7 +156,7 @@ def apple_static_xcframework_test_suite(name):
156156
build_type = "device",
157157
target_under_test = "//test/starlark_tests/targets_under_test/apple:ios_static_xcframework",
158158
binary_test_architecture = "arm64",
159-
binary_test_file = "$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcframework_ios_simulator.a",
159+
binary_test_file = "$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcframework.a",
160160
macho_load_commands_contain = ["cmd LC_BUILD_VERSION", "platform IOSSIMULATOR"],
161161
macho_load_commands_not_contain = ["cmd LC_VERSION_MIN_IPHONEOS"],
162162
tags = [name],
@@ -166,7 +166,7 @@ def apple_static_xcframework_test_suite(name):
166166
build_type = "device",
167167
target_under_test = "//test/starlark_tests/targets_under_test/apple:ios_static_xcframework",
168168
binary_test_architecture = "x86_64",
169-
binary_test_file = "$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcframework_ios_simulator.a",
169+
binary_test_file = "$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcframework.a",
170170
macho_load_commands_contain = ["cmd LC_VERSION_MIN_IPHONEOS"],
171171
macho_load_commands_not_contain = ["cmd LC_BUILD_VERSION"],
172172
tags = [name],
@@ -176,7 +176,7 @@ def apple_static_xcframework_test_suite(name):
176176
build_type = "device",
177177
target_under_test = "//test/starlark_tests/targets_under_test/apple:ios_static_xcframework_min_os_12",
178178
binary_test_architecture = "x86_64",
179-
binary_test_file = "$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcframework_min_os_12_ios_simulator.a",
179+
binary_test_file = "$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcframework_min_os_12.a",
180180
macho_load_commands_contain = ["cmd LC_BUILD_VERSION", "platform IOSSIMULATOR"],
181181
macho_load_commands_not_contain = ["cmd LC_VERSION_MIN_IPHONEOS"],
182182
tags = [name],
@@ -189,7 +189,7 @@ def apple_static_xcframework_test_suite(name):
189189
name = "{}_ios_x86_64_arm64_below_12_0_macho_load_cmd_for_device".format(name),
190190
build_type = "device",
191191
target_under_test = "//test/starlark_tests/targets_under_test/apple:ios_static_xcframework",
192-
binary_test_file = "$BUNDLE_ROOT/ios-arm64/ios_static_xcframework_ios_device.a",
192+
binary_test_file = "$BUNDLE_ROOT/ios-arm64/ios_static_xcframework.a",
193193
macho_load_commands_contain = ["cmd LC_VERSION_MIN_IPHONEOS"],
194194
macho_load_commands_not_contain = ["cmd LC_BUILD_VERSION"],
195195
tags = [name],
@@ -198,7 +198,7 @@ def apple_static_xcframework_test_suite(name):
198198
name = "{}_ios_x86_64_arm64_above_12_0_macho_load_cmd_for_device".format(name),
199199
build_type = "device",
200200
target_under_test = "//test/starlark_tests/targets_under_test/apple:ios_static_xcframework_min_os_12",
201-
binary_test_file = "$BUNDLE_ROOT/ios-arm64/ios_static_xcframework_min_os_12_ios_device.a",
201+
binary_test_file = "$BUNDLE_ROOT/ios-arm64/ios_static_xcframework_min_os_12.a",
202202
macho_load_commands_contain = ["cmd LC_BUILD_VERSION", "platform IOS"],
203203
macho_load_commands_not_contain = ["cmd LC_VERSION_MIN_IPHONEOS"],
204204
tags = [name],
@@ -211,7 +211,7 @@ def apple_static_xcframework_test_suite(name):
211211
target_features = ["cc_include_scanning"],
212212
target_under_test = "//test/starlark_tests/targets_under_test/apple:ios_static_xcframework",
213213
contains = [
214-
"$BUNDLE_ROOT/ios-arm64/ios_static_xcframework_ios_device.a",
214+
"$BUNDLE_ROOT/ios-arm64/ios_static_xcframework.a",
215215
],
216216
tags = [name],
217217
)
@@ -224,8 +224,8 @@ def apple_static_xcframework_test_suite(name):
224224
target_under_test = "//test/starlark_tests/targets_under_test/apple:ios_static_xcfmwk_with_swift_and_bundle_name",
225225
contains = [
226226
"$ARCHIVE_ROOT/ios_static_xcfmwk_with_custom_bundle_name.xcframework/",
227-
"$BUNDLE_ROOT/ios-arm64/ios_static_xcfmwk_with_custom_bundle_name_ios_device.a",
228-
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_custom_bundle_name_ios_simulator.a",
227+
"$BUNDLE_ROOT/ios-arm64/ios_static_xcfmwk_with_custom_bundle_name.a",
228+
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_custom_bundle_name.a",
229229
],
230230
text_test_file = "$BUNDLE_ROOT/ios-arm64/Headers/module.modulemap",
231231
text_test_values = [

0 commit comments

Comments
 (0)