aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar ulfjack <ulfjack@google.com>2017-04-10 08:23:18 +0000
committerGravatar Jakob Buchgraber <buchgr@google.com>2017-04-10 11:48:49 +0200
commit25b17db6c159abc112e89ca1e4dce622be1f147b (patch)
tree15991d880a9511d61e50d1606f6a03e566abe928 /src
parent6ac454a99672547a8d9709e326e573fd51b6bf8a (diff)
Fix the SpawnInputExpander to compute the manifest path correctly
PiperOrigin-RevId: 152663008
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/google/devtools/build/lib/exec/SpawnInputExpander.java3
-rw-r--r--src/test/java/com/google/devtools/build/lib/exec/SpawnInputExpanderTest.java26
2 files changed, 15 insertions, 14 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/exec/SpawnInputExpander.java b/src/main/java/com/google/devtools/build/lib/exec/SpawnInputExpander.java
index 351f8c7e10..ef538a0c2d 100644
--- a/src/main/java/com/google/devtools/build/lib/exec/SpawnInputExpander.java
+++ b/src/main/java/com/google/devtools/build/lib/exec/SpawnInputExpander.java
@@ -113,7 +113,8 @@ public class SpawnInputExpander {
Map<PathFragment, ActionInput> inputMappings, Artifact manifest, String workspaceName)
throws IOException {
Path file = manifest.getRoot().getPath().getRelative(
- AnalysisUtils.getManifestPathFromFilesetPath(manifest.getExecPath()).getPathString());
+ AnalysisUtils.getManifestPathFromFilesetPath(
+ manifest.getRootRelativePath()).getPathString());
FileSystemUtils.asByteSource(file).asCharSource(UTF_8)
.readLines(new ManifestLineProcessor(inputMappings, workspaceName, manifest.getExecPath()));
}
diff --git a/src/test/java/com/google/devtools/build/lib/exec/SpawnInputExpanderTest.java b/src/test/java/com/google/devtools/build/lib/exec/SpawnInputExpanderTest.java
index 5b6db72c27..355e914bcc 100644
--- a/src/test/java/com/google/devtools/build/lib/exec/SpawnInputExpanderTest.java
+++ b/src/test/java/com/google/devtools/build/lib/exec/SpawnInputExpanderTest.java
@@ -191,52 +191,52 @@ public class SpawnInputExpanderTest {
public void testManifestWithSingleFile() throws Exception {
// See AnalysisUtils for the mapping from "foo" to "_foo/MANIFEST".
scratchFile(
- "/root/_foo/MANIFEST",
+ "/root/out/_foo/MANIFEST",
"workspace/bar /dir/file",
"<some digest>");
- Artifact artifact =
- new Artifact(fs.getPath("/root/foo"), Root.asSourceRoot(fs.getPath("/root")));
+ Root outputRoot = Root.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"), true);
+ Artifact artifact = new Artifact(fs.getPath("/root/out/foo"), outputRoot);
expander.parseFilesetManifest(inputMappings, artifact, "workspace");
assertThat(inputMappings).hasSize(1);
assertThat(inputMappings)
- .containsEntry(PathFragment.create("foo/bar"), ActionInputHelper.fromPath("/dir/file"));
+ .containsEntry(PathFragment.create("out/foo/bar"), ActionInputHelper.fromPath("/dir/file"));
}
@Test
public void testManifestWithTwoFiles() throws Exception {
// See AnalysisUtils for the mapping from "foo" to "_foo/MANIFEST".
scratchFile(
- "/root/_foo/MANIFEST",
+ "/root/out/_foo/MANIFEST",
"workspace/bar /dir/file",
"<some digest>",
"workspace/baz /dir/file",
"<some digest>");
- Artifact artifact =
- new Artifact(fs.getPath("/root/foo"), Root.asSourceRoot(fs.getPath("/root")));
+ Root outputRoot = Root.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"), true);
+ Artifact artifact = new Artifact(fs.getPath("/root/out/foo"), outputRoot);
expander.parseFilesetManifest(inputMappings, artifact, "workspace");
assertThat(inputMappings).hasSize(2);
assertThat(inputMappings)
- .containsEntry(PathFragment.create("foo/bar"), ActionInputHelper.fromPath("/dir/file"));
+ .containsEntry(PathFragment.create("out/foo/bar"), ActionInputHelper.fromPath("/dir/file"));
assertThat(inputMappings)
- .containsEntry(PathFragment.create("foo/baz"), ActionInputHelper.fromPath("/dir/file"));
+ .containsEntry(PathFragment.create("out/foo/baz"), ActionInputHelper.fromPath("/dir/file"));
}
@Test
public void testManifestWithDirectory() throws Exception {
// See AnalysisUtils for the mapping from "foo" to "_foo/MANIFEST".
scratchFile(
- "/root/_foo/MANIFEST",
+ "/root/out/_foo/MANIFEST",
"workspace/bar /some",
"<some digest>");
- Artifact artifact =
- new Artifact(fs.getPath("/root/foo"), Root.asSourceRoot(fs.getPath("/root")));
+ Root outputRoot = Root.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"), true);
+ Artifact artifact = new Artifact(fs.getPath("/root/out/foo"), outputRoot);
expander.parseFilesetManifest(inputMappings, artifact, "workspace");
assertThat(inputMappings).hasSize(1);
assertThat(inputMappings)
.containsEntry(
- PathFragment.create("foo/bar"), ActionInputHelper.fromPath("/some"));
+ PathFragment.create("out/foo/bar"), ActionInputHelper.fromPath("/some"));
}
}