Pass rsp files into sbox and rewrapper

The current implementation causes inputs listed in an rsp file used with
sbox to be duplicated 3 times in the build.ninja file; once as a
dependency of the rule, once in the rspfile_content field of the rule
with the paths rewritten to be relative to the sandbox, and once in the
rule to write the sbox manifest.  When RBE is enabled it also gets a
fourth copy in the list of files to be treated as inputs by rewrapper.

Reduce this to a single copy by using "$in" for the rspfile_content so
that the files only have to be listed in the input dependencies of the
rule, and then add support to sbox to rewrite the rsp file while copying
it into the sandbox, and pass it to rewrapper as well.

Test: m lint-check
Change-Id: I3f46f61119508d39a8bb231c99fc130153fb6f04
diff --git a/cmd/sbox/sbox_proto/sbox.proto b/cmd/sbox/sbox_proto/sbox.proto
index 695b0e8..bdf92c6 100644
--- a/cmd/sbox/sbox_proto/sbox.proto
+++ b/cmd/sbox/sbox_proto/sbox.proto
@@ -47,6 +47,10 @@
   // An optional hash of the input files to ensure the textproto files and the sbox rule reruns
   // when the lists of inputs changes, even if the inputs are not on the command line.
   optional string input_hash = 5;
+
+  // A list of files that will be copied before the sandboxed command, and whose contents should be
+  // copied as if they were listed in copy_before.
+  repeated RspFile rsp_files = 6;
 }
 
 // Copy describes a from-to pair of files to copy.  The paths may be relative, the root that they
@@ -58,4 +62,19 @@
 
   // If true, make the file executable after copying it.
   optional bool executable = 3;
-}
\ No newline at end of file
+}
+
+// RspFile describes an rspfile that should be copied into the sandbox directory.
+message RspFile {
+  // The path to the rsp file.
+  required string file = 1;
+
+  // A list of path mappings that should be applied to each file listed in the rsp file.
+  repeated PathMapping path_mappings = 2;
+}
+
+// PathMapping describes a mapping from a path outside the sandbox to the path inside the sandbox.
+message PathMapping {
+  required string from = 1;
+  required string to = 2;
+}