blob: ab95545a57aa0acad77ad35092f1fe8fe71e13a8 [file] [log] [blame]
Colin Crosse16ce362020-11-12 08:29:30 -08001// Copyright 2020 Google Inc. 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
15syntax = "proto2";
16
17package sbox;
18option go_package = "sbox_proto";
19
20// A set of commands to run in a sandbox.
21message Manifest {
22 // A list of commands to run in the sandbox.
23 repeated Command commands = 1;
24
25 // If set, GCC-style dependency files from any command that references __SBOX_DEPFILE__ will be
26 // merged into the given output file relative to the $PWD when sbox was started.
27 optional string output_depfile = 2;
28}
29
30// SandboxManifest describes a command to run in the sandbox.
31message Command {
32 // A list of copy rules to run before the sandboxed command. The from field is relative to the
33 // $PWD when sbox was run, the to field is relative to the top of the temporary sandbox directory.
34 repeated Copy copy_before = 1;
35
36 // If true, change the working directory to the top of the temporary sandbox directory before
37 // running the command. If false, leave the working directory where it was when sbox was started.
38 optional bool chdir = 2;
39
40 // The command to run.
41 required string command = 3;
42
43 // A list of copy rules to run after the sandboxed command. The from field is relative to the
44 // top of the temporary sandbox directory, the to field is relative to the $PWD when sbox was run.
45 repeated Copy copy_after = 4;
46
47 // An optional hash of the input files to ensure the textproto files and the sbox rule reruns
48 // when the lists of inputs changes, even if the inputs are not on the command line.
49 optional string input_hash = 5;
50}
51
52// Copy describes a from-to pair of files to copy. The paths may be relative, the root that they
53// are relative to is specific to the context the Copy is used in and will be different for
54// from and to.
55message Copy {
56 required string from = 1;
57 required string to = 2;
58}