Skip to content

Commit

Permalink
Add cc_library deps to the force_load list if they have a .lo extension
Browse files Browse the repository at this point in the history
  • Loading branch information
jfaust committed Jun 19, 2019
1 parent d0e5f4f commit b5a410a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions swift/internal/compiling.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,15 @@ def new_objc_provider(
# for libraries to link. Until that rule is migrated over, we need to collect libraries from
# `CcInfo` (which will include Swift and C++) and put them into the new `Objc` provider.
transitive_cc_libs = []
force_loaded_libraries = []
for cc_info in get_providers(deps, CcInfo):
static_libs = collect_cc_libraries(cc_info = cc_info, include_static = True)
transitive_cc_libs.append(depset(static_libs, order = "topological"))
force_loaded_libraries.extend([
archive
for archive in static_libs
if archive.basename.endswith(".lo")
])
objc_provider_args["library"] = depset(
static_archives,
transitive = transitive_cc_libs,
Expand All @@ -314,11 +320,12 @@ def new_objc_provider(
if linkopts:
objc_provider_args["linkopt"] = depset(direct = linkopts)

force_loaded_libraries = [
force_loaded_libraries.extend([
archive
for archive in static_archives
if archive.basename.endswith(".lo")
]
])

if force_loaded_libraries:
objc_provider_args["force_load_library"] = depset(direct = force_loaded_libraries)

Expand Down

0 comments on commit b5a410a

Please sign in to comment.