aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib
diff options
context:
space:
mode:
authorGravatar Miguel Alcon Pinto <malcon@google.com>2015-09-16 18:37:45 +0000
committerGravatar Florian Weikert <fwe@google.com>2015-09-16 20:05:54 +0000
commit933c13ac4602aa5e40c41d91f5d7deda48710684 (patch)
tree5143d6585c6b97c24aa3561329771d7618ad531f /src/main/java/com/google/devtools/build/lib
parent54b6920c3ffafd3a837a319de959c181a4320c7c (diff)
Remove comment
Also includes the following changes: Fix a bug in which the dead code pruner throws if users specify J2ObjC proto classes as entry classes. -- Make skyquery more optimal. -- MOS_MIGRATED_REVID=103213483
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib')
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java b/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java
index 6171081fd6..683c06d69d 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java
@@ -26,6 +26,7 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
+import com.google.common.collect.Sets;
import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import com.google.devtools.build.lib.cmdline.PackageIdentifier;
import com.google.devtools.build.lib.cmdline.TargetParsingException;
@@ -88,12 +89,6 @@ import javax.annotation.Nullable;
*/
public class SkyQueryEnvironment extends AbstractBlazeQueryEnvironment<Target> {
- private static final Predicate<Exception> NON_NULL_EXCEPTION = new Predicate<Exception>() {
- @Override
- public boolean apply(@Nullable Exception e) {
- return e != null;
- }
- };
private WalkableGraph graph;
private ImmutableList<TargetPatternKey> universeTargetPatternKeys;
@@ -177,9 +172,20 @@ public class SkyQueryEnvironment extends AbstractBlazeQueryEnvironment<Target> {
private Map<Target, Collection<Target>> makeTargetsMap(Map<SkyKey, Iterable<SkyKey>> input) {
ImmutableMap.Builder<Target, Collection<Target>> result = ImmutableMap.builder();
+
+ Map<SkyKey, Target> allTargets = makeTargetsWithAssociations(
+ Sets.newHashSet(Iterables.concat(input.values())));
for (Map.Entry<SkyKey, Target> entry : makeTargetsWithAssociations(input.keySet()).entrySet()) {
- result.put(entry.getValue(), makeTargets(input.get(entry.getKey())));
+ Iterable<SkyKey> skyKeys = input.get(entry.getKey());
+ Set<Target> targets = CompactHashSet.createWithExpectedSize(Iterables.size(skyKeys));
+ for (SkyKey key : skyKeys) {
+ Target target = allTargets.get(key);
+ if (target != null) {
+ targets.add(target);
+ }
+ }
+ result.put(entry.getValue(), targets);
}
return result.build();
}
@@ -460,10 +466,6 @@ public class SkyQueryEnvironment extends AbstractBlazeQueryEnvironment<Target> {
return result;
}
- private Collection<Target> makeTargets(Iterable<SkyKey> keys) {
- return makeTargetsWithAssociations(keys).values();
- }
-
private static final Function<SkyKey, Label> SKYKEY_TO_LABEL = new Function<SkyKey, Label>() {
@Nullable
@Override