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

Refactor _xcodeproj_is_mixed to _target_is_mixed #725

Merged
merged 1 commit into from
May 19, 2023
Merged
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
8 changes: 3 additions & 5 deletions rules/legacy_xcodeproj.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -783,10 +783,8 @@ def _set_target_settings_by_config(ctx, target_settings):

return updated_target_settings

def _xcodeproj_is_mixed(targets):
all_srcs = []
for t in targets:
all_srcs.extend(t.srcs.to_list() + t.non_arc_srcs.to_list())
def _target_is_mixed(target_info):
all_srcs = target_info.srcs.to_list() + target_info.non_arc_srcs.to_list()
has_swift = len([s for s in all_srcs if s.path.endswith(".swift")]) > 0
has_objc = len([s for s in all_srcs if s.path.endswith(".m") or s.path.endswith(".h")]) > 0
return has_swift and has_objc
Expand All @@ -808,9 +806,9 @@ def _populate_xcodeproj_targets_and_schemes(ctx, targets, src_dot_dots, all_tran
"""
xcodeproj_targets_by_name = {}
xcodeproj_schemes_by_name = {}
mixed = _xcodeproj_is_mixed(targets)

for target_info in targets:
mixed = _target_is_mixed(target_info)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, when I originally added that to detect mixed = True/False and then conditionally set -import-underlying-module later and didn't consider that we might want this per-target 😓.

target_name = target_info.name
product_type = target_info.product_type
lldbinit_file = "$CONFIGURATION_TEMP_DIR/%s.lldbinit" % target_name
Expand Down