diff options
author | 2018-02-20 09:48:10 -0800 | |
---|---|---|
committer | 2018-02-20 09:50:06 -0800 | |
commit | d399df930e089f23390b09f42f4f5b47fce02977 (patch) | |
tree | 47cec9cfbfd5f5ce69fdcbb6b14f7149574a96cb /src/main/java/com/google/devtools/build/lib/sandbox/LinuxSandboxedSpawnRunner.java | |
parent | b80158aca7f9cb99023e2f83effe2caefd0bb2d8 (diff) |
Inject the product name in the constructor where needed
...instead of passing it everywhere so we can rewrite the local env.
PiperOrigin-RevId: 186316859
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/sandbox/LinuxSandboxedSpawnRunner.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/sandbox/LinuxSandboxedSpawnRunner.java | 59 |
1 files changed, 1 insertions, 58 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/sandbox/LinuxSandboxedSpawnRunner.java b/src/main/java/com/google/devtools/build/lib/sandbox/LinuxSandboxedSpawnRunner.java index ad677f17ae..bd21c1b680 100644 --- a/src/main/java/com/google/devtools/build/lib/sandbox/LinuxSandboxedSpawnRunner.java +++ b/src/main/java/com/google/devtools/build/lib/sandbox/LinuxSandboxedSpawnRunner.java @@ -85,66 +85,12 @@ final class LinuxSandboxedSpawnRunner extends AbstractSandboxSpawnRunner { private final Path inaccessibleHelperDir; private final LocalEnvProvider localEnvProvider; private final Optional<Duration> timeoutKillDelay; - private final String productName; - - /** - * Creates a sandboxed spawn runner that uses the {@code linux-sandbox} tool. If a spawn exceeds - * its timeout, then it will be killed instantly. - * - * @param cmdEnv the command environment to use - * @param sandboxBase path to the sandbox base directory - * @param productName the product name to use - * @param inaccessibleHelperFile path to a file that is (already) inaccessible - * @param inaccessibleHelperDir path to a directory that is (already) inaccessible - */ - LinuxSandboxedSpawnRunner( - CommandEnvironment cmdEnv, - Path sandboxBase, - String productName, - Path inaccessibleHelperFile, - Path inaccessibleHelperDir) { - this( - cmdEnv, - sandboxBase, - productName, - inaccessibleHelperFile, - inaccessibleHelperDir, - Optional.empty()); - } - - /** - * Creates a sandboxed spawn runner that uses the {@code linux-sandbox} tool. If a spawn exceeds - * its timeout, then it will be killed after the specified delay. - * - * @param cmdEnv the command environment to use - * @param sandboxBase path to the sandbox base directory - * @param productName the product name to use - * @param inaccessibleHelperFile path to a file that is (already) inaccessible - * @param inaccessibleHelperDir path to a directory that is (already) inaccessible - * @param timeoutKillDelay an additional grace period before killing timing out commands - */ - LinuxSandboxedSpawnRunner( - CommandEnvironment cmdEnv, - Path sandboxBase, - String productName, - Path inaccessibleHelperFile, - Path inaccessibleHelperDir, - Duration timeoutKillDelay) { - this( - cmdEnv, - sandboxBase, - productName, - inaccessibleHelperFile, - inaccessibleHelperDir, - Optional.of(timeoutKillDelay)); - } /** * Creates a sandboxed spawn runner that uses the {@code linux-sandbox} tool. * * @param cmdEnv the command environment to use * @param sandboxBase path to the sandbox base directory - * @param productName the product name to use * @param inaccessibleHelperFile path to a file that is (already) inaccessible * @param inaccessibleHelperDir path to a directory that is (already) inaccessible * @param timeoutKillDelay an optional, additional grace period before killing timing out @@ -153,7 +99,6 @@ final class LinuxSandboxedSpawnRunner extends AbstractSandboxSpawnRunner { LinuxSandboxedSpawnRunner( CommandEnvironment cmdEnv, Path sandboxBase, - String productName, Path inaccessibleHelperFile, Path inaccessibleHelperDir, Optional<Duration> timeoutKillDelay) { @@ -161,7 +106,6 @@ final class LinuxSandboxedSpawnRunner extends AbstractSandboxSpawnRunner { this.fileSystem = cmdEnv.getRuntime().getFileSystem(); this.blazeDirs = cmdEnv.getDirectories(); this.execRoot = cmdEnv.getExecRoot(); - this.productName = productName; this.allowNetwork = SandboxHelpers.shouldAllowNetwork(cmdEnv.getOptions()); this.linuxSandbox = LinuxSandboxUtil.getLinuxSandbox(cmdEnv); this.inaccessibleHelperFile = inaccessibleHelperFile; @@ -182,8 +126,7 @@ final class LinuxSandboxedSpawnRunner extends AbstractSandboxSpawnRunner { Path tmpDir = sandboxExecRoot.getRelative("tmp"); Map<String, String> environment = - localEnvProvider.rewriteLocalEnv( - spawn.getEnvironment(), execRoot, tmpDir.getPathString(), productName); + localEnvProvider.rewriteLocalEnv(spawn.getEnvironment(), execRoot, tmpDir.getPathString()); Set<Path> writableDirs = getWritableDirs(sandboxExecRoot, environment); ImmutableSet<PathFragment> outputs = SandboxHelpers.getOutputFiles(spawn); |