Support ninja rsp files in soong_zip
Add a -r argument to soong_zip that reads a list of files from a file
like the -l argument but treats it as a Ninja rsp file with escaping.
Replace the -l arguments in Soong that are using rsp files with -r.
Fixes: 162435077
Test: TestReadRespFile, TestZip
Change-Id: I4605312e99406ab1bd0c37af9c5ad212393f0403
diff --git a/zip/zip_test.go b/zip/zip_test.go
index 9705d6c..302a749 100644
--- a/zip/zip_test.go
+++ b/zip/zip_test.go
@@ -49,6 +49,9 @@
"l_nl": []byte("a/a/a\na/a/b\nc\n"),
"l_sp": []byte("a/a/a a/a/b c"),
"l2": []byte("missing\n"),
+ "rsp": []byte("'a/a/a'\na/a/b\n'@'\n'foo'\\''bar'"),
+ "@ -> c": nil,
+ "foo'bar -> c": nil,
"manifest.txt": fileCustomManifest,
})
@@ -247,6 +250,19 @@
},
},
{
+ name: "rsp",
+ args: fileArgsBuilder().
+ RspFile("rsp"),
+ compressionLevel: 9,
+
+ files: []zip.FileHeader{
+ fh("a/a/a", fileA, zip.Deflate),
+ fh("a/a/b", fileB, zip.Deflate),
+ fh("@", fileC, zip.Deflate),
+ fh("foo'bar", fileC, zip.Deflate),
+ },
+ },
+ {
name: "prefix in zip",
args: fileArgsBuilder().
PathPrefixInZip("foo").
@@ -568,6 +584,11 @@
in: `./cmd "\""-C`,
out: []string{"./cmd", `"-C`},
},
+ {
+ name: "ninja rsp file",
+ in: "'a'\nb\n'@'\n'foo'\\''bar'\n'foo\"bar'",
+ out: []string{"a", "b", "@", "foo'bar", `foo"bar`},
+ },
}
for _, testCase := range testCases {