From b5a410a0a560dd48d3305b22607370c6d2f5279a Mon Sep 17 00:00:00 2001 From: Josh Faust Date: Tue, 18 Jun 2019 18:58:01 -0700 Subject: [PATCH] Add cc_library deps to the force_load list if they have a .lo extension --- swift/internal/compiling.bzl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/swift/internal/compiling.bzl b/swift/internal/compiling.bzl index 41a96020f..5fb9324e7 100644 --- a/swift/internal/compiling.bzl +++ b/swift/internal/compiling.bzl @@ -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, @@ -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)