From 00d781ae78a8bd51d3c61b621d79f0bb095aff9e Mon Sep 17 00:00:00 2001 From: mjhalupka Date: Wed, 31 Jan 2018 14:42:22 -0800 Subject: [PATCH] Cleaning up a missed reference to getTarget in ConfiguredTargetQueryEnvironment. Follow up to https://github.com/bazelbuild/bazel/commit/426ab9067374bfe5af033e22153507c3f38e7221 PiperOrigin-RevId: 184049987 --- .../lib/query2/ConfiguredTargetQueryEnvironment.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 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 b48bc1db35876e..0dfff29072d9ca 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 @@ -32,6 +32,7 @@ import com.google.devtools.build.lib.events.Event; import com.google.devtools.build.lib.events.ExtendedEventHandler; import com.google.devtools.build.lib.packages.DependencyFilter; +import com.google.devtools.build.lib.packages.NoSuchTargetException; import com.google.devtools.build.lib.packages.Rule; import com.google.devtools.build.lib.packages.Target; import com.google.devtools.build.lib.pkgcache.FilteringPolicies; @@ -54,6 +55,7 @@ import com.google.devtools.build.lib.skyframe.ConfiguredTargetKey; import com.google.devtools.build.lib.skyframe.ConfiguredTargetValue; import com.google.devtools.build.lib.skyframe.GraphBackedRecursivePackageProvider; +import com.google.devtools.build.lib.skyframe.PackageValue; import com.google.devtools.build.lib.skyframe.RecursivePackageProviderBackedTargetPatternResolver; import com.google.devtools.build.lib.skyframe.SkyFunctions; import com.google.devtools.build.lib.skyframe.TargetPatternValue; @@ -432,8 +434,14 @@ public TargetAccessor getAccessor() { @Override public Target getTarget(Label label) throws TargetNotFoundException, QueryException, InterruptedException { - ConfiguredTarget configuredTarget = getConfiguredTarget(label); - return configuredTarget == null ? null : configuredTarget.getTarget(); + try { + return ((PackageValue) + walkableGraphSupplier.get().getValue(PackageValue.key(label.getPackageIdentifier()))) + .getPackage() + .getTarget(label.getName()); + } catch (NoSuchTargetException e) { + throw new TargetNotFoundException(e); + } } @Override