Merge "cquery: obtain objects from custom provider"

This commit is contained in:
Christopher Parsons 2021-09-23 17:11:25 +00:00 committed by Gerrit Code Review
commit 798e8876c8

View file

@ -111,14 +111,20 @@ staticLibraries = []
rootStaticArchives = [] rootStaticArchives = []
linker_inputs = cc_info.linking_context.linker_inputs.to_list() linker_inputs = cc_info.linking_context.linker_inputs.to_list()
for linker_input in linker_inputs: static_info_tag = "//build/bazel/rules:cc_library_static.bzl%CcStaticLibraryInfo"
for library in linker_input.libraries: if static_info_tag in providers(target):
for object in library.objects: static_info = providers(target)[static_info_tag]
ccObjectFiles += [object.path] ccObjectFiles = [f.path for f in static_info.objects]
if library.static_library: rootStaticArchives = [static_info.root_static_archive.path]
staticLibraries.append(library.static_library.path) else:
if linker_input.owner == target.label: for linker_input in linker_inputs:
rootStaticArchives.append(library.static_library.path) for library in linker_input.libraries:
for object in library.objects:
ccObjectFiles += [object.path]
if library.static_library:
staticLibraries.append(library.static_library.path)
if linker_input.owner == target.label:
rootStaticArchives.append(library.static_library.path)
rootDynamicLibraries = [] rootDynamicLibraries = []
@ -141,9 +147,10 @@ returns = [
system_includes, system_includes,
rootStaticArchives, rootStaticArchives,
rootDynamicLibraries, rootDynamicLibraries,
[toc_file]
] ]
return "|".join([", ".join(r) for r in returns] + [toc_file])` return "|".join([", ".join(r) for r in returns])`
} }
// ParseResult returns a value obtained by parsing the result of the request's Starlark function. // ParseResult returns a value obtained by parsing the result of the request's Starlark function.