Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add/omit the HeadersPath Info.plist key for XCFramework with static libraries. #2115

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
97 changes: 97 additions & 0 deletions test/starlark_tests/apple_static_xcframework_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,110 @@ load(
"//test/starlark_tests/rules:common_verification_tests.bzl",
"archive_contents_test",
)
load(
"//test/starlark_tests/rules:infoplist_contents_test.bzl",
"infoplist_contents_test",
)

def apple_static_xcframework_test_suite(name):
"""Test suite for apple_static_xcframework.

Args:
name: the base name to be used in things created by this macro
"""

# Test Objective-C(++) XCFramework Info.plist contents with and without public headers.
infoplist_contents_test(
name = "{}_objc_without_public_headers_infoplist_test".format(name),
target_under_test = "//test/starlark_tests/targets_under_test/apple:ios_static_xcframework_objc_with_no_public_headers",
expected_values = {
"AvailableLibraries:0:LibraryIdentifier": "ios-arm64",
"AvailableLibraries:0:LibraryPath": "ios_static_xcframework_objc_with_no_public_headers.a",
"AvailableLibraries:0:SupportedArchitectures:0": "arm64",
"AvailableLibraries:0:SupportedPlatform": "ios",
"AvailableLibraries:1:LibraryIdentifier": "ios-arm64_x86_64-simulator",
"AvailableLibraries:1:LibraryPath": "ios_static_xcframework_objc_with_no_public_headers.a",
"AvailableLibraries:1:SupportedArchitectures:0": "arm64",
"AvailableLibraries:1:SupportedArchitectures:1": "x86_64",
"AvailableLibraries:1:SupportedPlatform": "ios",
"AvailableLibraries:1:SupportedPlatformVariant": "simulator",
"CFBundlePackageType": "XFWK",
"XCFrameworkFormatVersion": "1.0",
},
not_expected_keys = [
"AvailableLibraries:0:HeadersPath",
"AvailableLibraries:1:HeadersPath",
],
tags = [name],
)
infoplist_contents_test(
name = "{}_objc_with_public_headers_infoplist_test".format(name),
target_under_test = "//test/starlark_tests/targets_under_test/apple:ios_static_xcframework_oldest_supported",
expected_values = {
"AvailableLibraries:0:LibraryIdentifier": "ios-arm64",
"AvailableLibraries:0:LibraryPath": "ios_static_xcframework_oldest_supported.a",
"AvailableLibraries:0:SupportedArchitectures:0": "arm64",
"AvailableLibraries:0:SupportedPlatform": "ios",
"AvailableLibraries:0:HeadersPath": "Headers",
"AvailableLibraries:1:LibraryIdentifier": "ios-arm64_x86_64-simulator",
"AvailableLibraries:1:LibraryPath": "ios_static_xcframework_oldest_supported.a",
"AvailableLibraries:1:SupportedArchitectures:0": "arm64",
"AvailableLibraries:1:SupportedArchitectures:1": "x86_64",
"AvailableLibraries:1:SupportedPlatform": "ios",
"AvailableLibraries:1:SupportedPlatformVariant": "simulator",
"AvailableLibraries:1:HeadersPath": "Headers",
"CFBundlePackageType": "XFWK",
"XCFrameworkFormatVersion": "1.0",
},
tags = [name],
)

# Test Swift XCFramework Info.plist contents with and without Swift generated headers.
infoplist_contents_test(
name = "{}_swift_without_generated_headers_infoplist_test".format(name),
target_under_test = "//test/starlark_tests/targets_under_test/apple:ios_static_xcfmwk_with_swift",
expected_values = {
"AvailableLibraries:0:LibraryIdentifier": "ios-arm64",
"AvailableLibraries:0:LibraryPath": "ios_static_xcfmwk_with_swift.a",
"AvailableLibraries:0:SupportedArchitectures:0": "arm64",
"AvailableLibraries:0:SupportedPlatform": "ios",
"AvailableLibraries:1:LibraryIdentifier": "ios-arm64_x86_64-simulator",
"AvailableLibraries:1:LibraryPath": "ios_static_xcfmwk_with_swift.a",
"AvailableLibraries:1:SupportedArchitectures:0": "arm64",
"AvailableLibraries:1:SupportedArchitectures:1": "x86_64",
"AvailableLibraries:1:SupportedPlatform": "ios",
"AvailableLibraries:1:SupportedPlatformVariant": "simulator",
"CFBundlePackageType": "XFWK",
"XCFrameworkFormatVersion": "1.0",
},
not_expected_keys = [
"AvailableLibraries:0:HeadersPath",
"AvailableLibraries:1:HeadersPath",
],
tags = [name],
)
infoplist_contents_test(
name = "{}_with_swift_generated_header_infoplist_test".format(name),
target_under_test = "//test/starlark_tests/targets_under_test/apple:ios_static_xcfmwk_with_swift_generated_headers",
expected_values = {
"AvailableLibraries:0:LibraryIdentifier": "ios-arm64",
"AvailableLibraries:0:LibraryPath": "ios_static_xcfmwk_with_swift_generated_headers.a",
"AvailableLibraries:0:SupportedArchitectures:0": "arm64",
"AvailableLibraries:0:SupportedPlatform": "ios",
"AvailableLibraries:0:HeadersPath": "Headers",
"AvailableLibraries:1:LibraryIdentifier": "ios-arm64_x86_64-simulator",
"AvailableLibraries:1:LibraryPath": "ios_static_xcfmwk_with_swift_generated_headers.a",
"AvailableLibraries:1:SupportedArchitectures:0": "arm64",
"AvailableLibraries:1:SupportedArchitectures:1": "x86_64",
"AvailableLibraries:1:SupportedPlatform": "ios",
"AvailableLibraries:1:SupportedPlatformVariant": "simulator",
"AvailableLibraries:1:HeadersPath": "Headers",
"CFBundlePackageType": "XFWK",
"XCFrameworkFormatVersion": "1.0",
},
tags = [name],
)

archive_contents_test(
name = "{}_ios_root_plist_test".format(name),
build_type = "device",
Expand Down
22 changes: 19 additions & 3 deletions test/starlark_tests/targets_under_test/apple/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,25 @@ apple_static_xcframework(
deps = [":fmwk_lib"],
)

apple_static_xcframework(
name = "ios_static_xcframework_objc_with_no_public_headers",
# TODO(b/239957001): Remove this when the rule no longer forces library
# evolution.
features = ["apple.no_legacy_swiftinterface"],
ios = {
"simulator": [
"x86_64",
"arm64",
],
"device": ["arm64"],
},
minimum_os_versions = {
"ios": common.min_os_ios.oldest_supported,
},
tags = common.fixture_tags,
deps = [":fmwk_lib"],
)

apple_static_xcframework(
name = "ios_static_xcfmwk_with_avoid_deps",
avoid_deps = [":StaticFmwkLowerLib"],
Expand Down Expand Up @@ -1078,9 +1097,6 @@ apple_static_xcframework(
minimum_os_versions = {
"ios": common.min_os_ios.baseline,
},
public_hdrs = [
"//test/starlark_tests/resources:shared.h",
],
tags = common.fixture_tags,
deps = [":swift_lib_for_static_xcfmwk_with_headers"],
)
Expand Down