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,6 +111,12 @@ staticLibraries = []
rootStaticArchives = [] rootStaticArchives = []
linker_inputs = cc_info.linking_context.linker_inputs.to_list() linker_inputs = cc_info.linking_context.linker_inputs.to_list()
static_info_tag = "//build/bazel/rules:cc_library_static.bzl%CcStaticLibraryInfo"
if static_info_tag in providers(target):
static_info = providers(target)[static_info_tag]
ccObjectFiles = [f.path for f in static_info.objects]
rootStaticArchives = [static_info.root_static_archive.path]
else:
for linker_input in linker_inputs: for linker_input in linker_inputs:
for library in linker_input.libraries: for library in linker_input.libraries:
for object in library.objects: for object in library.objects:
@ -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.