Skip to content

Commit 97e3526

Browse files
committed
Fix FRAMEWORK_SEARCH_PATHS for headerless frameworks
We need to use `ObjCProvider` for this for now.
1 parent a0e1a09 commit 97e3526

File tree

1 file changed

+34
-16
lines changed

1 file changed

+34
-16
lines changed

xcodeproj/internal/target.bzl

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -598,12 +598,14 @@ The xcodeproj rule requires {} rules to have a single library dep. {} has {}.\
598598
)
599599

600600
cc_info = target[CcInfo] if CcInfo in target else None
601+
objc = target[apple_common.Objc] if apple_common.Objc in target else None
601602
_process_defines(
602603
cc_info = cc_info,
603604
build_settings = build_settings,
604605
)
605606
search_paths = _process_search_paths(
606607
cc_info = cc_info,
608+
objc = objc,
607609
opts_search_paths = opts_search_paths,
608610
)
609611

@@ -701,9 +703,9 @@ def _process_library_target(*, ctx, target, transitive_infos):
701703
transitive_infos = transitive_infos,
702704
)
703705
linker_inputs = _get_linker_inputs(cc_info = target[CcInfo])
704-
static_framework_files = _get_static_framework_files(objc = (
705-
target[apple_common.Objc] if apple_common.Objc in target else None
706-
))
706+
707+
objc = target[apple_common.Objc] if apple_common.Objc in target else None
708+
static_framework_files = _get_static_framework_files(objc = objc)
707709

708710
cpp = ctx.fragments.cpp
709711

@@ -767,6 +769,7 @@ def _process_library_target(*, ctx, target, transitive_infos):
767769
)
768770
search_paths = _process_search_paths(
769771
cc_info = cc_info,
772+
objc = objc,
770773
opts_search_paths = opts_search_paths,
771774
)
772775

@@ -893,6 +896,7 @@ def _process_resource_target(*, ctx, target, transitive_infos):
893896

894897
search_paths = _process_search_paths(
895898
cc_info = None,
899+
objc = None,
896900
opts_search_paths = create_opts_search_paths(
897901
quote_includes = [],
898902
includes = [],
@@ -957,13 +961,14 @@ def _process_non_xcode_target(*, ctx, target, transitive_infos):
957961
The value returned from `_processed_target()`.
958962
"""
959963
if CcInfo in target:
960-
linker_inputs = _get_linker_inputs(cc_info = target[CcInfo])
964+
cc_info = target[CcInfo]
965+
linker_inputs = _get_linker_inputs(cc_info = cc_info)
961966
else:
967+
cc_info = None
962968
linker_inputs = depset()
963969

964-
static_framework_files = _get_static_framework_files(objc = (
965-
target[apple_common.Objc] if apple_common.Objc in target else None
966-
))
970+
objc = target[apple_common.Objc] if apple_common.Objc in target else None
971+
static_framework_files = _get_static_framework_files(objc = objc)
967972

968973
attrs_info = target[InputFileAttributesInfo]
969974
resource_owner = None
@@ -992,7 +997,8 @@ def _process_non_xcode_target(*, ctx, target, transitive_infos):
992997
transitive_infos = transitive_infos,
993998
),
994999
search_paths = _process_search_paths(
995-
cc_info = target[CcInfo] if CcInfo in target else None,
1000+
cc_info = cc_info,
1001+
objc = objc,
9961002
opts_search_paths = create_opts_search_paths(
9971003
quote_includes = [],
9981004
includes = [],
@@ -1134,6 +1140,7 @@ def _skip_target(*, target, transitive_infos):
11341140
),
11351141
search_paths = _process_search_paths(
11361142
cc_info = None,
1143+
objc = None,
11371144
opts_search_paths = create_opts_search_paths(
11381145
quote_includes = [],
11391146
includes = [],
@@ -1210,18 +1217,11 @@ def _process_defines(
12101217
def _process_search_paths(
12111218
*,
12121219
cc_info,
1220+
objc,
12131221
opts_search_paths):
12141222
search_paths = {}
12151223
if cc_info:
12161224
compilation_context = cc_info.compilation_context
1217-
set_if_true(
1218-
search_paths,
1219-
"framework_includes",
1220-
[
1221-
file_path_to_dto(parsed_file_path(path))
1222-
for path in compilation_context.framework_includes.to_list()
1223-
],
1224-
)
12251225
set_if_true(
12261226
search_paths,
12271227
"quote_includes",
@@ -1240,6 +1240,24 @@ def _process_search_paths(
12401240
opts_search_paths.includes)
12411241
],
12421242
)
1243+
1244+
if objc:
1245+
framework_paths = depset(
1246+
transitive = [
1247+
objc.static_framework_paths,
1248+
objc.dynamic_framework_paths,
1249+
],
1250+
)
1251+
1252+
set_if_true(
1253+
search_paths,
1254+
"framework_includes",
1255+
[
1256+
file_path_to_dto(parsed_file_path(path))
1257+
for path in framework_paths.to_list()
1258+
],
1259+
)
1260+
12431261
return search_paths
12441262

12451263
def _farthest_parent_file_path(file, extension):

0 commit comments

Comments
 (0)