Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions apple/internal/xcframework_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,7 @@ def _apple_static_xcframework_impl(ctx):
outputs_archive = ctx.outputs.archive
xcode_config = ctx.attr._xcode_config[apple_common.XcodeVersionConfig]

binary_name = bundle_name + ".a"
link_result = linking_support.register_static_library_linking_action(ctx = ctx)
link_outputs_by_library_identifier = _group_link_outputs_by_library_identifier(
actions = actions,
Expand All @@ -961,7 +962,7 @@ def _apple_static_xcframework_impl(ctx):
binary_artifact = link_output.binary
framework_archive_merge_files.append(struct(
src = binary_artifact.path,
dest = paths.join(library_identifier, binary_artifact.basename),
dest = paths.join(library_identifier, binary_name),
))
framework_archive_files.append(depset([binary_artifact]))

Expand Down Expand Up @@ -1034,7 +1035,7 @@ def _apple_static_xcframework_impl(ctx):
environment = link_output.environment,
headers_path = "Headers",
library_identifier = library_identifier,
library_path = binary_artifact.basename,
library_path = binary_name,
platform = link_output.platform,
),
)
Expand Down
39 changes: 19 additions & 20 deletions test/starlark_tests/apple_static_xcframework_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ def apple_static_xcframework_test_suite(name):
plist_test_values = {
"AvailableLibraries:0:HeadersPath": "Headers",
"AvailableLibraries:0:LibraryIdentifier": "ios-arm64",
"AvailableLibraries:0:LibraryPath": "ios_static_xcframework_ios_device.a",
"AvailableLibraries:0:LibraryPath": "ios_static_xcframework.a",
"AvailableLibraries:0:SupportedArchitectures:0": "arm64",
"AvailableLibraries:0:SupportedPlatform": "ios",
"AvailableLibraries:1:HeadersPath": "Headers",
"AvailableLibraries:1:LibraryIdentifier": "ios-arm64_x86_64-simulator",
"AvailableLibraries:1:LibraryPath": "ios_static_xcframework_ios_simulator.a",
"AvailableLibraries:1:LibraryPath": "ios_static_xcframework.a",
"AvailableLibraries:1:SupportedArchitectures:0": "arm64",
"AvailableLibraries:1:SupportedArchitectures:1": "x86_64",
"AvailableLibraries:1:SupportedPlatform": "ios",
Expand All @@ -56,11 +56,11 @@ def apple_static_xcframework_test_suite(name):
"$BUNDLE_ROOT/ios-arm64/Headers/shared.h",
"$BUNDLE_ROOT/ios-arm64/Headers/ios_static_xcframework.h",
"$BUNDLE_ROOT/ios-arm64/Headers/module.modulemap",
"$BUNDLE_ROOT/ios-arm64/ios_static_xcframework_ios_device.a",
"$BUNDLE_ROOT/ios-arm64/ios_static_xcframework.a",
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/Headers/shared.h",
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/Headers/ios_static_xcframework.h",
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/Headers/module.modulemap",
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcframework_ios_simulator.a",
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcframework.a",
"$BUNDLE_ROOT/Info.plist",
],
tags = [name],
Expand All @@ -72,15 +72,15 @@ def apple_static_xcframework_test_suite(name):
compilation_mode = "opt",
target_under_test = "//test/starlark_tests/targets_under_test/apple:ios_static_xcfmwk_with_avoid_deps",
contains = [
"$BUNDLE_ROOT/ios-arm64/ios_static_xcfmwk_with_avoid_deps_ios_device.a",
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_avoid_deps_ios_simulator.a",
"$BUNDLE_ROOT/ios-arm64/ios_static_xcfmwk_with_avoid_deps.a",
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_avoid_deps.a",
"$BUNDLE_ROOT/Info.plist",
],
not_contains = [
"$BUNDLE_ROOT/ios-arm64/Headers/DummyFmwk.h",
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/Headers/DummyFmwk.h",
],
binary_test_file = "$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_avoid_deps_ios_simulator.a",
binary_test_file = "$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_avoid_deps.a",
binary_test_architecture = "x86_64",
binary_contains_symbols = ["_doStuff"],
binary_not_contains_symbols = ["_frameworkDependent"],
Expand Down Expand Up @@ -109,12 +109,12 @@ def apple_static_xcframework_test_suite(name):
"$BUNDLE_ROOT/Info.plist",
"$BUNDLE_ROOT/ios-arm64/ios_static_xcfmwk_with_swift.swiftmodule/arm64.swiftdoc",
"$BUNDLE_ROOT/ios-arm64/ios_static_xcfmwk_with_swift.swiftmodule/arm64.swiftinterface",
"$BUNDLE_ROOT/ios-arm64/ios_static_xcfmwk_with_swift_ios_device.a",
"$BUNDLE_ROOT/ios-arm64/ios_static_xcfmwk_with_swift.a",
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_swift.swiftmodule/arm64.swiftdoc",
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_swift.swiftmodule/arm64.swiftinterface",
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_swift.swiftmodule/x86_64.swiftdoc",
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_swift.swiftmodule/x86_64.swiftinterface",
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_swift_ios_simulator.a",
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_swift.a",
],
tags = [name],
)
Expand All @@ -131,14 +131,14 @@ def apple_static_xcframework_test_suite(name):
"$BUNDLE_ROOT/ios-arm64/Headers/module.modulemap",
"$BUNDLE_ROOT/ios-arm64/ios_static_xcfmwk_with_swift_generated_headers.swiftmodule/arm64.swiftdoc",
"$BUNDLE_ROOT/ios-arm64/ios_static_xcfmwk_with_swift_generated_headers.swiftmodule/arm64.swiftinterface",
"$BUNDLE_ROOT/ios-arm64/ios_static_xcfmwk_with_swift_generated_headers_ios_device.a",
"$BUNDLE_ROOT/ios-arm64/ios_static_xcfmwk_with_swift_generated_headers.a",
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/Headers/ios_static_xcfmwk_with_swift_generated_headers.h",
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/Headers/module.modulemap",
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_swift_generated_headers.swiftmodule/arm64.swiftdoc",
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_swift_generated_headers.swiftmodule/arm64.swiftinterface",
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_swift_generated_headers.swiftmodule/x86_64.swiftdoc",
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_swift_generated_headers.swiftmodule/x86_64.swiftinterface",
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_swift_generated_headers_ios_simulator.a",
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_swift_generated_headers.a",
],
tags = [name],
)
Expand All @@ -156,8 +156,7 @@ def apple_static_xcframework_test_suite(name):
build_type = "device",
target_under_test = "//test/starlark_tests/targets_under_test/apple:ios_static_xcframework",
binary_test_architecture = "arm64",
binary_test_file = "$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcframework_ios_simulator.a",
macho_load_commands_contain = ["cmd LC_BUILD_VERSION", "platform 7"],
binary_test_file = "$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcframework.a",
macho_load_commands_not_contain = ["cmd LC_VERSION_MIN_IPHONEOS"],
tags = [name],
)
Expand All @@ -166,7 +165,7 @@ def apple_static_xcframework_test_suite(name):
build_type = "device",
target_under_test = "//test/starlark_tests/targets_under_test/apple:ios_static_xcframework",
binary_test_architecture = "x86_64",
binary_test_file = "$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcframework_ios_simulator.a",
binary_test_file = "$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcframework.a",
macho_load_commands_contain = ["cmd LC_VERSION_MIN_IPHONEOS"],
macho_load_commands_not_contain = ["cmd LC_BUILD_VERSION"],
tags = [name],
Expand All @@ -176,7 +175,7 @@ def apple_static_xcframework_test_suite(name):
build_type = "device",
target_under_test = "//test/starlark_tests/targets_under_test/apple:ios_static_xcframework_min_os_12",
binary_test_architecture = "x86_64",
binary_test_file = "$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcframework_min_os_12_ios_simulator.a",
binary_test_file = "$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcframework_min_os_12.a",
macho_load_commands_contain = ["cmd LC_BUILD_VERSION", "platform 7"],
macho_load_commands_not_contain = ["cmd LC_VERSION_MIN_IPHONEOS"],
tags = [name],
Expand All @@ -189,7 +188,7 @@ def apple_static_xcframework_test_suite(name):
name = "{}_ios_x86_64_arm64_below_12_0_macho_load_cmd_for_device".format(name),
build_type = "device",
target_under_test = "//test/starlark_tests/targets_under_test/apple:ios_static_xcframework",
binary_test_file = "$BUNDLE_ROOT/ios-arm64/ios_static_xcframework_ios_device.a",
binary_test_file = "$BUNDLE_ROOT/ios-arm64/ios_static_xcframework.a",
macho_load_commands_contain = ["cmd LC_VERSION_MIN_IPHONEOS"],
macho_load_commands_not_contain = ["cmd LC_BUILD_VERSION"],
tags = [name],
Expand All @@ -198,7 +197,7 @@ def apple_static_xcframework_test_suite(name):
name = "{}_ios_x86_64_arm64_above_12_0_macho_load_cmd_for_device".format(name),
build_type = "device",
target_under_test = "//test/starlark_tests/targets_under_test/apple:ios_static_xcframework_min_os_12",
binary_test_file = "$BUNDLE_ROOT/ios-arm64/ios_static_xcframework_min_os_12_ios_device.a",
binary_test_file = "$BUNDLE_ROOT/ios-arm64/ios_static_xcframework_min_os_12.a",
macho_load_commands_contain = ["cmd LC_BUILD_VERSION", "platform 2"],
macho_load_commands_not_contain = ["cmd LC_VERSION_MIN_IPHONEOS"],
tags = [name],
Expand All @@ -211,7 +210,7 @@ def apple_static_xcframework_test_suite(name):
target_features = ["cc_include_scanning"],
target_under_test = "//test/starlark_tests/targets_under_test/apple:ios_static_xcframework",
contains = [
"$BUNDLE_ROOT/ios-arm64/ios_static_xcframework_ios_device.a",
"$BUNDLE_ROOT/ios-arm64/ios_static_xcframework.a",
],
tags = [name],
)
Expand All @@ -224,8 +223,8 @@ def apple_static_xcframework_test_suite(name):
target_under_test = "//test/starlark_tests/targets_under_test/apple:ios_static_xcfmwk_with_swift_and_bundle_name",
contains = [
"$ARCHIVE_ROOT/ios_static_xcfmwk_with_custom_bundle_name.xcframework/",
"$BUNDLE_ROOT/ios-arm64/ios_static_xcfmwk_with_custom_bundle_name_ios_device.a",
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_custom_bundle_name_ios_simulator.a",
"$BUNDLE_ROOT/ios-arm64/ios_static_xcfmwk_with_custom_bundle_name.a",
"$BUNDLE_ROOT/ios-arm64_x86_64-simulator/ios_static_xcfmwk_with_custom_bundle_name.a",
],
text_test_file = "$BUNDLE_ROOT/ios-arm64/Headers/module.modulemap",
text_test_values = [
Expand Down
4 changes: 2 additions & 2 deletions test/starlark_tests/targets_under_test/apple/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ genrule(
]
for file in [
"Headers/shared.h",
"ios_static_xcframework_ios_{}.a".format(platform),
"ios_static_xcframework.a",
]
],
cmd = """
Expand All @@ -380,7 +380,7 @@ genrule(
for file in [
"Headers/shared.h",
"Modules/module.modulemap",
"ios_static_xcframework_with_module_map_ios_{}.a".format(platform),
"ios_static_xcframework_with_module_map.a",
]
],
# rules_apple can't generate static XCFrameworks that are importable from
Expand Down