Philipp Wollermann | 21c1073 | 2017-03-24 21:26:02 +0000 | [diff] [blame] | 1 | // 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 | |
| 15 | package com.google.devtools.build.lib.sandbox; |
| 16 | |
Philipp Wollermann | 21c1073 | 2017-03-24 21:26:02 +0000 | [diff] [blame] | 17 | import com.google.devtools.build.lib.actions.ExecutionStrategy; |
Philipp Wollermann | 21c1073 | 2017-03-24 21:26:02 +0000 | [diff] [blame] | 18 | import com.google.devtools.build.lib.actions.SpawnActionContext; |
ulfjack | 19befaf | 2017-07-24 11:09:40 +0200 | [diff] [blame] | 19 | import com.google.devtools.build.lib.exec.AbstractSpawnStrategy; |
| 20 | import com.google.devtools.build.lib.exec.SpawnRunner; |
tomlu | 1a19b62 | 2018-01-11 15:17:28 -0800 | [diff] [blame] | 21 | import com.google.devtools.build.lib.vfs.Path; |
Philipp Wollermann | 21c1073 | 2017-03-24 21:26:02 +0000 | [diff] [blame] | 22 | |
| 23 | /** Strategy that uses sandboxing to execute a process. */ |
ulfjack | a63da8e | 2017-07-12 16:51:20 +0200 | [diff] [blame] | 24 | //TODO(ulfjack): This class only exists for this annotation. Find a better way to handle this! |
Philipp Wollermann | 21c1073 | 2017-03-24 21:26:02 +0000 | [diff] [blame] | 25 | @ExecutionStrategy( |
philwo | 0c613be | 2017-04-21 16:39:30 +0200 | [diff] [blame] | 26 | name = {"sandboxed", "processwrapper-sandbox"}, |
Philipp Wollermann | 21c1073 | 2017-03-24 21:26:02 +0000 | [diff] [blame] | 27 | contextType = SpawnActionContext.class |
| 28 | ) |
ulfjack | 19befaf | 2017-07-24 11:09:40 +0200 | [diff] [blame] | 29 | final class ProcessWrapperSandboxedStrategy extends AbstractSpawnStrategy { |
tomlu | 1a19b62 | 2018-01-11 15:17:28 -0800 | [diff] [blame] | 30 | ProcessWrapperSandboxedStrategy(Path execRoot, SpawnRunner spawnRunner) { |
| 31 | super(execRoot, spawnRunner); |
ulfjack | 19befaf | 2017-07-24 11:09:40 +0200 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | @Override |
| 35 | public String toString() { |
philwo | d3de5cc | 2018-04-16 06:40:19 -0700 | [diff] [blame] | 36 | return "processwrapper-sandbox"; |
Philipp Wollermann | 21c1073 | 2017-03-24 21:26:02 +0000 | [diff] [blame] | 37 | } |
| 38 | } |