Add -e argument to soong_zip to allow setting an explicit filename
soong_zip normally takes the name of the input source file as the name of the file in the zip, which is ideal for zipping up directories but not for constructing arbitrary zip files. Add a -e argument that explicitly sets the path in the zip file for the next -f argument. Bug: 254867347 Test: zip_test.go Change-Id: If9d62c1a0064a485aebddf6d2a661f63f3e60b0f
This commit is contained in:
@@ -78,6 +78,15 @@ func (rspFiles) Set(s string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
type explicitFile struct{}
|
||||
|
||||
func (explicitFile) String() string { return `""` }
|
||||
|
||||
func (explicitFile) Set(s string) error {
|
||||
fileArgsBuilder.ExplicitPathInZip(s)
|
||||
return nil
|
||||
}
|
||||
|
||||
type dir struct{}
|
||||
|
||||
func (dir) String() string { return `""` }
|
||||
@@ -173,6 +182,7 @@ func main() {
|
||||
flags.Var(&nonDeflatedFiles, "s", "file path to be stored within the zip without compression")
|
||||
flags.Var(&relativeRoot{}, "C", "path to use as relative root of files in following -f, -l, or -D arguments")
|
||||
flags.Var(&junkPaths{}, "j", "junk paths, zip files without directory names")
|
||||
flags.Var(&explicitFile{}, "e", "filename to use in the zip file for the next -f argument")
|
||||
|
||||
flags.Parse(expandedArgs[1:])
|
||||
|
||||
|
Reference in New Issue
Block a user