aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/sandbox/NamespaceSandboxRunner.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/sandbox/NamespaceSandboxRunner.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/sandbox/NamespaceSandboxRunner.java21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/sandbox/NamespaceSandboxRunner.java b/src/main/java/com/google/devtools/build/lib/sandbox/NamespaceSandboxRunner.java
index 7fae775e33..239d3acef6 100644
--- a/src/main/java/com/google/devtools/build/lib/sandbox/NamespaceSandboxRunner.java
+++ b/src/main/java/com/google/devtools/build/lib/sandbox/NamespaceSandboxRunner.java
@@ -18,7 +18,6 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.io.ByteStreams;
import com.google.common.io.Files;
-import com.google.devtools.build.lib.actions.ActionInput;
import com.google.devtools.build.lib.actions.ExecException;
import com.google.devtools.build.lib.actions.UserExecException;
import com.google.devtools.build.lib.analysis.config.BinTools;
@@ -115,6 +114,7 @@ public class NamespaceSandboxRunner {
* @param env - environment to run sandbox in
* @param cwd - current working directory
* @param outErr - error output to capture sandbox's and command's stderr
+ * @param outputs - files to extract from the sandbox, paths are relative to the exec root
* @throws ExecException
*/
public void run(
@@ -122,7 +122,7 @@ public class NamespaceSandboxRunner {
ImmutableMap<String, String> env,
File cwd,
FileOutErr outErr,
- Collection<? extends ActionInput> outputs,
+ Collection<PathFragment> outputs,
int timeout,
boolean blockNetwork)
throws IOException, ExecException {
@@ -205,21 +205,20 @@ public class NamespaceSandboxRunner {
copyOutputs(outputs);
}
- private void createFileSystem(Collection<? extends ActionInput> outputs) throws IOException {
+ private void createFileSystem(Collection<PathFragment> outputs) throws IOException {
FileSystemUtils.createDirectoryAndParents(sandboxPath);
// Prepare the output directories in the sandbox.
- for (ActionInput output : outputs) {
- PathFragment parentDirectory =
- new PathFragment(output.getExecPathString()).getParentDirectory();
- FileSystemUtils.createDirectoryAndParents(sandboxExecRoot.getRelative(parentDirectory));
+ for (PathFragment output : outputs) {
+ FileSystemUtils.createDirectoryAndParents(
+ sandboxExecRoot.getRelative(output.getParentDirectory()));
}
}
- private void copyOutputs(Collection<? extends ActionInput> outputs) throws IOException {
- for (ActionInput output : outputs) {
- Path source = sandboxExecRoot.getRelative(output.getExecPathString());
- Path target = execRoot.getRelative(output.getExecPathString());
+ private void copyOutputs(Collection<PathFragment> outputs) throws IOException {
+ for (PathFragment output : outputs) {
+ Path source = sandboxExecRoot.getRelative(output);
+ Path target = execRoot.getRelative(output);
FileSystemUtils.createDirectoryAndParents(target.getParentDirectory());
if (source.isFile() || source.isSymbolicLink()) {
Files.move(source.getPathFile(), target.getPathFile());