diff options
author | Googler <noreply@google.com> | 2017-05-19 23:40:41 +0200 |
---|---|---|
committer | Irina Iancu <elenairina@google.com> | 2017-05-22 14:39:59 +0200 |
commit | 68f1fe008d6d99d518921d12c39494a055c769ea (patch) | |
tree | bd3d5be8eb7aa1df71f701a0418dd9cee7d60b05 /tools | |
parent | ce6dea90b8c9eec9ebba41db25117dfb5527414f (diff) |
Include input header files in CIdeInfo
A precursor to prefetching source files outside the project.
PiperOrigin-RevId: 156598992
Diffstat (limited to 'tools')
-rw-r--r-- | tools/ide/intellij_info_impl.bzl | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/tools/ide/intellij_info_impl.bzl b/tools/ide/intellij_info_impl.bzl index 024120af0d..54fba4fff0 100644 --- a/tools/ide/intellij_info_impl.bzl +++ b/tools/ide/intellij_info_impl.bzl @@ -173,12 +173,13 @@ def replace_empty_path_with_dot(path): def sources_from_target(ctx): """Get the list of sources from a target as artifact locations.""" + return artifacts_from_target_list_attr(ctx, "srcs") - if hasattr(ctx.rule.attr, "srcs"): - return [artifact_location(f) - for src in ctx.rule.attr.srcs - for f in src.files] - return [] +def artifacts_from_target_list_attr(ctx, attr_name): + """Converts a list of targets to a list of artifact locations.""" + return [artifact_location(f) + for target in getattr(ctx.rule.attr, attr_name, []) + for f in target.files] def _collect_target_from_attr(rule_attrs, attr_name, result): """Collects the targets from the given attr into the result.""" @@ -266,7 +267,8 @@ def build_c_ide_info(target, ctx): if not hasattr(target, "cc"): return (None, set()) - sources = sources_from_target(ctx) + sources = artifacts_from_target_list_attr(ctx, "srcs") + sources.extend(artifacts_from_target_list_attr(ctx, "hdrs")) target_includes = [] if hasattr(ctx.rule.attr, "includes"): |