aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java
diff options
context:
space:
mode:
authorGravatar juliexxia <juliexxia@google.com>2018-02-07 11:28:35 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-02-07 11:30:12 -0800
commit5b35c5cea86d45c382f8e13c07a59f961ded4070 (patch)
tree0c4573a00a193c3081a8059c55700182ed3bb265 /src/main/java
parente1ed133298cb65189fb7e2339a0920bbc4d42f07 (diff)
When requesting nodes* look first in target configuration, then host (used to be the other way around).
This fixes b/72817591 which saw the following - (1) somepath(//foo, //bar) --nohost_deps -> empty query results (2) deps(//foo) --nohost_deps | grep '//bar' -> found //bar This happened because //bar was configured in both the host and the target config. There was no path from //foo-target -> //bar-host because of the --nohost_deps setting (1) but //bar-target did exist in the results of (2) PiperOrigin-RevId: 184868484
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/ConfiguredTargetQueryEnvironment.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/query2/ConfiguredTargetQueryEnvironment.java b/src/main/java/com/google/devtools/build/lib/query2/ConfiguredTargetQueryEnvironment.java
index 0dfff29072..c87583db36 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/ConfiguredTargetQueryEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/ConfiguredTargetQueryEnvironment.java
@@ -180,14 +180,17 @@ public class ConfiguredTargetQueryEnvironment
}
private ConfiguredTarget getConfiguredTarget(Label label) throws InterruptedException {
- // Try with host configuration.
+ // Try with target configuration.
ConfiguredTarget configuredTarget =
- getConfiguredTarget(ConfiguredTargetValue.key(label, hostConfiguration));
+ getConfiguredTarget(ConfiguredTargetValue.key(label, defaultTargetConfiguration));
if (configuredTarget != null) {
return configuredTarget;
}
+ // Try with host configuration (even when --nohost_deps is set in the case that top-level
+ // targets are configured in the host configuration so we are doing a host-configuration-only
+ // query).
configuredTarget =
- getConfiguredTarget(ConfiguredTargetValue.key(label, defaultTargetConfiguration));
+ getConfiguredTarget(ConfiguredTargetValue.key(label, hostConfiguration));
if (configuredTarget != null) {
return configuredTarget;
}