blob: 096f564ad86b9e06038c08405cc92ff8519e4e27 [file] [log] [blame]
Philipp Wollermann21c10732017-03-24 21:26:02 +00001// Copyright 2017 The Bazel Authors. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package com.google.devtools.build.lib.sandbox;
16
Philipp Wollermann21c10732017-03-24 21:26:02 +000017import com.google.devtools.build.lib.actions.ExecutionStrategy;
Philipp Wollermann21c10732017-03-24 21:26:02 +000018import com.google.devtools.build.lib.actions.SpawnActionContext;
ulfjack19befaf2017-07-24 11:09:40 +020019import com.google.devtools.build.lib.exec.AbstractSpawnStrategy;
20import com.google.devtools.build.lib.exec.SpawnRunner;
tomlu1a19b622018-01-11 15:17:28 -080021import com.google.devtools.build.lib.vfs.Path;
Philipp Wollermann21c10732017-03-24 21:26:02 +000022
23/** Strategy that uses sandboxing to execute a process. */
ulfjacka63da8e2017-07-12 16:51:20 +020024//TODO(ulfjack): This class only exists for this annotation. Find a better way to handle this!
Philipp Wollermann21c10732017-03-24 21:26:02 +000025@ExecutionStrategy(
philwo0c613be2017-04-21 16:39:30 +020026 name = {"sandboxed", "processwrapper-sandbox"},
Philipp Wollermann21c10732017-03-24 21:26:02 +000027 contextType = SpawnActionContext.class
28)
ulfjack19befaf2017-07-24 11:09:40 +020029final class ProcessWrapperSandboxedStrategy extends AbstractSpawnStrategy {
tomlu1a19b622018-01-11 15:17:28 -080030 ProcessWrapperSandboxedStrategy(Path execRoot, SpawnRunner spawnRunner) {
31 super(execRoot, spawnRunner);
ulfjack19befaf2017-07-24 11:09:40 +020032 }
33
34 @Override
35 public String toString() {
philwod3de5cc2018-04-16 06:40:19 -070036 return "processwrapper-sandbox";
Philipp Wollermann21c10732017-03-24 21:26:02 +000037 }
38}