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
This commit is contained in:
Colin Cross
2020-08-19 13:51:47 -07:00
parent 2d815963ba
commit 053fca10c9
8 changed files with 64 additions and 9 deletions

View File

@@ -150,6 +150,30 @@ func (b *FileArgsBuilder) List(name string) *FileArgsBuilder {
return b
}
func (b *FileArgsBuilder) RspFile(name string) *FileArgsBuilder {
if b.err != nil {
return b
}
f, err := b.fs.Open(name)
if err != nil {
b.err = err
return b
}
defer f.Close()
list, err := ioutil.ReadAll(f)
if err != nil {
b.err = err
return b
}
arg := b.state
arg.SourceFiles = ReadRespFile(list)
b.fileArgs = append(b.fileArgs, arg)
return b
}
func (b *FileArgsBuilder) Error() error {
if b == nil {
return nil