aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/analysis/CommandHelper.java
diff options
context:
space:
mode:
authorGravatar Damien Martin-Guillerez <dmarting@google.com>2016-01-29 15:22:51 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2016-01-29 15:36:41 +0000
commitfbd8333bbe73c03242d69815d6dceee333662f90 (patch)
treea765b2001fd27e4f5ee7ead4bad2678cde9ad8e4 /src/main/java/com/google/devtools/build/lib/analysis/CommandHelper.java
parent734e7f7b63c9c00a6aaa60769481a11bc4f76346 (diff)
*** Reason for rollback *** Break Java 1.7 builds of Bazel. See http://ci.bazel.io/job/Bazel/JAVA_VERSION=1.7,PLATFORM_NAME=linux-x86_64/327/console Test: git clone ... && git revert c0a8c58 && export JAVA_VERSION=1.7 && export BAZEL_COMPILE_TARGET=compile && bash -c "source scripts/ci/build.sh; bazel_build" *** Original change description *** Make Skylark dicts mutable Represent Skylark dict using a new subclass SkylarkDict<K, V> of Map<K, V>. Back it with a TreeMap to provide a deterministic iteration order. Also make SkylarkList generic in its element type <E>. Have Artifact implement Comparable<Object> so it can be used as TreeMap key. -- MOS_MIGRATED_REVID=113359718
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/analysis/CommandHelper.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/CommandHelper.java22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/CommandHelper.java b/src/main/java/com/google/devtools/build/lib/analysis/CommandHelper.java
index 41689a6761..b2523de047 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/CommandHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/CommandHelper.java
@@ -25,9 +25,6 @@ import com.google.devtools.build.lib.actions.BaseSpawn;
import com.google.devtools.build.lib.analysis.actions.FileWriteAction;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
-import com.google.devtools.build.lib.syntax.SkylarkDict;
-import com.google.devtools.build.lib.syntax.SkylarkList;
-import com.google.devtools.build.lib.syntax.SkylarkList.MutableList;
import com.google.devtools.build.lib.syntax.Type;
import com.google.devtools.build.lib.util.OS;
import com.google.devtools.build.lib.util.Pair;
@@ -72,14 +69,14 @@ public final class CommandHelper {
* A map of remote path prefixes and corresponding runfiles manifests for tools
* used by this rule.
*/
- private final SkylarkDict<PathFragment, Artifact> remoteRunfileManifestMap;
+ private final ImmutableMap<PathFragment, Artifact> remoteRunfileManifestMap;
/**
* Use labelMap for heuristically expanding labels (does not include "outs")
* This is similar to heuristic location expansion in LocationExpander
* and should be kept in sync.
*/
- private final SkylarkDict<Label, ImmutableCollection<Artifact>> labelMap;
+ private final ImmutableMap<Label, ImmutableCollection<Artifact>> labelMap;
/**
* The ruleContext this helper works on
@@ -89,7 +86,7 @@ public final class CommandHelper {
/**
* Output executable files from the 'tools' attribute.
*/
- private final SkylarkList<Artifact> resolvedTools;
+ private final ImmutableList<Artifact> resolvedTools;
/**
* Creates a {@link CommandHelper}.
@@ -139,21 +136,21 @@ public final class CommandHelper {
}
}
- this.resolvedTools = new MutableList(resolvedToolsBuilder.build());
- this.remoteRunfileManifestMap = SkylarkDict.copyOf(null, remoteRunfileManifestBuilder.build());
+ this.resolvedTools = resolvedToolsBuilder.build();
+ this.remoteRunfileManifestMap = remoteRunfileManifestBuilder.build();
ImmutableMap.Builder<Label, ImmutableCollection<Artifact>> labelMapBuilder =
ImmutableMap.builder();
for (Entry<Label, Collection<Artifact>> entry : tempLabelMap.entrySet()) {
labelMapBuilder.put(entry.getKey(), ImmutableList.copyOf(entry.getValue()));
}
- this.labelMap = SkylarkDict.copyOf(null, labelMapBuilder.build());
+ this.labelMap = labelMapBuilder.build();
}
- public SkylarkList<Artifact> getResolvedTools() {
+ public List<Artifact> getResolvedTools() {
return resolvedTools;
}
- public SkylarkDict<PathFragment, Artifact> getRemoteRunfileManifestMap() {
+ public ImmutableMap<PathFragment, Artifact> getRemoteRunfileManifestMap() {
return remoteRunfileManifestMap;
}
@@ -180,8 +177,7 @@ public final class CommandHelper {
@Nullable String attribute,
Boolean supportLegacyExpansion,
Boolean allowDataInLabel) {
- LocationExpander expander = new LocationExpander(
- ruleContext, ImmutableMap.copyOf(labelMap), allowDataInLabel);
+ LocationExpander expander = new LocationExpander(ruleContext, labelMap, allowDataInLabel);
if (attribute != null) {
command = expander.expandAttribute(attribute, command);
} else {