diff options
author | 2015-05-07 20:09:14 +0000 | |
---|---|---|
committer | 2015-05-08 16:59:24 +0000 | |
commit | 9c5695775a1ad9bcac3484881d8286abfce96d21 (patch) | |
tree | 06ffdb55ef43ec3f12f7837b567e6d3f6c34a2ba /src/main/java/com/google/devtools/build/lib/analysis/SourceManifestAction.java | |
parent | 3bf3bbe8ca0c8b54ef22f5eb3d944017a6e8d1cd (diff) |
Return all mappings in one Map from Runfiles#getRunfilesInputs(...)
We wind up combining them anyway in the manifest file and it seems that
this is consistent with how we read them back. Return them all at once
to avoid tedious duplication in handling of them.
--
MOS_MIGRATED_REVID=93058482
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/analysis/SourceManifestAction.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/analysis/SourceManifestAction.java | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/SourceManifestAction.java b/src/main/java/com/google/devtools/build/lib/analysis/SourceManifestAction.java index 7ddf308c0a..5d573e5e86 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/SourceManifestAction.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/SourceManifestAction.java @@ -23,7 +23,6 @@ import com.google.devtools.build.lib.actions.Executor; import com.google.devtools.build.lib.analysis.actions.AbstractFileWriteAction; import com.google.devtools.build.lib.events.EventHandler; import com.google.devtools.build.lib.util.Fingerprint; -import com.google.devtools.build.lib.util.Pair; import com.google.devtools.build.lib.vfs.PathFragment; import java.io.BufferedWriter; @@ -116,7 +115,7 @@ public class SourceManifestAction extends AbstractFileWriteAction { @Override public DeterministicWriter newDeterministicWriter(EventHandler eventHandler, Executor executor) throws IOException { - final Pair<Map<PathFragment, Artifact>, Map<PathFragment, Artifact>> runfilesInputs = + final Map<PathFragment, Artifact> runfilesInputs = runfiles.getRunfilesInputs(eventHandler, getOwner().getLocation()); return new DeterministicWriter() { @Override @@ -154,9 +153,7 @@ public class SourceManifestAction extends AbstractFileWriteAction { * @param output The actual mapping of the output manifest. * @throws IOException */ - private void writeFile(OutputStream out, - Pair<Map<PathFragment, Artifact>, Map<PathFragment, Artifact>> output) - throws IOException { + private void writeFile(OutputStream out, Map<PathFragment, Artifact> output) throws IOException { Writer manifestFile = new BufferedWriter(new OutputStreamWriter(out, ISO_8859_1)); Comparator<Map.Entry<PathFragment, Artifact>> fragmentComparator = @@ -168,21 +165,13 @@ public class SourceManifestAction extends AbstractFileWriteAction { } }; - List<Map.Entry<PathFragment, Artifact>> sortedRootLinks = - new ArrayList<>(output.second.entrySet()); - Collections.sort(sortedRootLinks, fragmentComparator); - - List<Map.Entry<PathFragment, Artifact>> sortedManifest = - new ArrayList<>(output.first.entrySet()); + List<Map.Entry<PathFragment, Artifact>> sortedManifest = new ArrayList<>(output.entrySet()); Collections.sort(sortedManifest, fragmentComparator); - for (Map.Entry<PathFragment, Artifact> line : sortedRootLinks) { - manifestWriter.writeEntry(manifestFile, line.getKey(), line.getValue()); - } - for (Map.Entry<PathFragment, Artifact> line : sortedManifest) { manifestWriter.writeEntry(manifestFile, line.getKey(), line.getValue()); } + manifestFile.flush(); } |