Skip to content

Commit 232d74c

Browse files
authored
Include Cache: update cquery scripts (#7925)
1 parent 0af4189 commit 232d74c

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

tools/cquery/cc_info.bzl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33

44
CC_INFO = "CcInfo"
55

6+
def file_list_to_paths(files):
7+
return [getattr(f, "path", f) for f in files]
8+
69
def compilation_context_to_struct(ctx):
710
return struct(
811
defines = ctx.defines.to_list(),
9-
direct_headers = ctx.direct_headers,
10-
direct_private_headers = ctx.direct_private_headers,
11-
derect_textutal_headers = ctx.direct_textual_headers,
12+
headers = file_list_to_paths(ctx.headers.to_list()),
13+
direct_headers = file_list_to_paths(ctx.direct_headers),
14+
direct_private_headers = file_list_to_paths(ctx.direct_private_headers),
15+
derect_textutal_headers = file_list_to_paths(ctx.direct_textual_headers),
1216
external_includes = ctx.external_includes.to_list(),
1317
framework_includes = ctx.framework_includes.to_list(),
1418
includes = ctx.includes.to_list(),
@@ -40,7 +44,7 @@ def format_cc_info(info):
4044
def format(target):
4145
buffer = "%s: " % target.label
4246

43-
if CC_INFO in providers(target):
47+
if CC_INFO in (providers(target) or []):
4448
buffer += format_cc_info(providers(target)[CC_INFO])
4549
else:
4650
buffer += "NO CcInfo"

tools/cquery/cc_toolchain.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ def format_cc_toolchain(toolchain):
1818
def format(target):
1919
buffer = "%s: " % target.label
2020

21-
if CC_TOOLCHAIN_INFO in providers(target):
21+
if CC_TOOLCHAIN_INFO in (providers(target) or []):
2222
buffer += format_cc_toolchain(providers(target)[CC_TOOLCHAIN_INFO])
2323
else:
2424
buffer += "NO CcTolchainInfo"
2525

26-
return buffer
26+
return buffer

0 commit comments

Comments
 (0)