commit | 41a8dfd2c511933a8d7d7b5014da1258b8e5b07d | [log] [tgz] |
---|---|---|
author | gregce <gregce@google.com> | Thu Sep 12 11:43:43 2019 -0700 |
committer | Copybara-Service <copybara-worker@google.com> | Thu Sep 12 11:45:16 2019 -0700 |
tree | 16621a92250aa75bd6f8a644b5c6edd1e13204b4 | |
parent | de8d4c7bddb729d3703c97c6bee58062e154ec34 [diff] |
Revert "cquery --nohost_deps" to include source files. This was switched in https://github.com/bazelbuild/bazel/commit/171a7ebd9a28c4169f2c3018b9c4d740dadcf324. It makes more sense to include source files. This isn't strictly correct: https://github.com/bazelbuild/bazel/issues/9334#issuecomment-530562016. But given the inherent ambiguity it's better to return too many results than too few. Fixes https://github.com/bazelbuild/bazel/issues/9334. PiperOrigin-RevId: 268731551
diff --git a/src/main/java/com/google/devtools/build/lib/query2/PostAnalysisQueryEnvironment.java b/src/main/java/com/google/devtools/build/lib/query2/PostAnalysisQueryEnvironment.java index 783298b..0048197 100644 --- a/src/main/java/com/google/devtools/build/lib/query2/PostAnalysisQueryEnvironment.java +++ b/src/main/java/com/google/devtools/build/lib/query2/PostAnalysisQueryEnvironment.java
@@ -341,8 +341,12 @@ deps.stream() .filter( dep -> - getConfiguration(dep) != null - && !getConfiguration(dep).isToolConfiguration()) + // We include source files, which have null configuration, even though + // they can also appear on host-configured attributes like genrule#tools. + // While this may not be strictly correct, it's better to overapproximate + // than underapproximate the results. + getConfiguration(dep) == null + || !getConfiguration(dep).isToolConfiguration()) .collect(Collectors.toList()); } }