aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Sergio Campama <kaipi@google.com>2016-08-23 21:57:42 +0000
committerGravatar John Cater <jcater@google.com>2016-08-23 23:00:45 +0000
commite96c132642d681bdba5be2ad50d11e986ee06f25 (patch)
tree4c7ca2b728a6c3ed090a930ac595b0c844255255
parent44e1e3a75c76a8fd3d73a79ce67975958f9cac55 (diff)
*** Reason for rollback *** Breaks tachyon because of the fact that it has duplicate symbol errors but they get discarded when compiled into the same archive, which is not the case anymore as we are being more clever with dependencies.... *** Original change description *** Instead of using the smallest group as the inputs for the generation actions, use instead the intersection of all the groups in which each proto appears. This further minimizes the average number of inputs per generation/compilation action. -- MOS_MIGRATED_REVID=131099657
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ProtobufSupport.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ProtobufSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ProtobufSupport.java
index 0af84d64d1..9187d41d2f 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ProtobufSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ProtobufSupport.java
@@ -24,7 +24,6 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSetMultimap;
import com.google.common.collect.Ordering;
-import com.google.common.collect.Sets;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.analysis.RuleConfiguredTarget.Mode;
import com.google.devtools.build.lib.analysis.RuleContext;
@@ -41,7 +40,6 @@ import com.google.devtools.build.lib.vfs.FileSystemUtils;
import com.google.devtools.build.lib.vfs.PathFragment;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Set;
/**
* Support for generating Objective C proto static libraries that registers actions which generate
@@ -332,7 +330,8 @@ final class ProtobufSupport {
protoSets.add(protoProvider.getTransitiveProtoSources());
}
- HashMap<Artifact, Set<Artifact>> protoToGroupMap = new HashMap<>();
+ HashMap<Artifact, ImmutableSet<Artifact>> protoToGroupMap =
+ new HashMap<Artifact, ImmutableSet<Artifact>>();
// For each proto in each proto group, store the smallest group in which it is contained. This
// group will be considered the smallest input group with which the proto can be generated.
@@ -344,10 +343,9 @@ final class ProtobufSupport {
if (attributes.isProtoWellKnown(proto)) {
continue;
}
- if (!protoToGroupMap.containsKey(proto)) {
+ if (!protoToGroupMap.containsKey(proto)
+ || protoToGroupMap.get(proto).size() > protoSet.size()) {
protoToGroupMap.put(proto, protoSet);
- } else {
- protoToGroupMap.put(proto, Sets.intersection(protoSet, protoToGroupMap.get(proto)));
}
}
}
@@ -363,7 +361,7 @@ final class ProtobufSupport {
ImmutableSetMultimap.builder();
for (Artifact proto : protoToGroupMap.keySet()) {
- inputsToOutputsMapBuilder.put(ImmutableSet.copyOf(protoToGroupMap.get(proto)), proto);
+ inputsToOutputsMapBuilder.put(protoToGroupMap.get(proto), proto);
}
return inputsToOutputsMapBuilder.build();
}