aboutsummaryrefslogtreecommitdiffstats
path: root/zip
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2018-09-18 17:05:15 -0700
committerColin Cross <ccross@android.com>2018-09-21 16:08:16 -0700
commit08e28abc4ecd10a0e0ab2dcb683560f9c6331e1b (patch)
tree1c001d1aa0e8a5c60c8ce67f842ee8fc448b7d4f /zip
parent3f4d116496ac1dd6a844f8706fb547126f8211ef (diff)
downloadbuild_soong-08e28abc4ecd10a0e0ab2dcb683560f9c6331e1b.tar.gz
build_soong-08e28abc4ecd10a0e0ab2dcb683560f9c6331e1b.tar.bz2
build_soong-08e28abc4ecd10a0e0ab2dcb683560f9c6331e1b.zip
soong_zip: support globs in -f and -D arguments
-f and -D arguments can now take globs in the Soong format. Also update the use of soong_zip that jars resources to escape the globs in the arguments, and then shell-escape them when writing to the rsp file so the glob escape are not intepreted by ReadRespFile. Also remove an unused argument to the buildAAR rule that could have contained values that needed escaping. Test: m checkbuild Change-Id: I7f20bb169dc01f952d2a7681ec6ee9c05737ed37
Diffstat (limited to 'zip')
-rw-r--r--zip/cmd/main.go5
-rw-r--r--zip/zip.go15
2 files changed, 18 insertions, 2 deletions
diff --git a/zip/cmd/main.go b/zip/cmd/main.go
index dfd56dc6..f49105a6 100644
--- a/zip/cmd/main.go
+++ b/zip/cmd/main.go
@@ -199,6 +199,11 @@ func main() {
flags.Parse(expandedArgs[1:])
+ if flags.NArg() > 0 {
+ fmt.Fprintf(os.Stderr, "unexpected arguments %s\n", strings.Join(flags.Args(), " "))
+ usage()
+ }
+
err := zip.Run(zip.ZipArgs{
FileArgs: fArgs,
OutputFilePath: *out,
diff --git a/zip/zip.go b/zip/zip.go
index 6b36e102..4a02531e 100644
--- a/zip/zip.go
+++ b/zip/zip.go
@@ -224,9 +224,20 @@ func Run(args ZipArgs) (err error) {
noCompression := args.CompressionLevel == 0
for _, fa := range args.FileArgs {
- srcs := fa.SourceFiles
+ var srcs []string
+ for _, s := range fa.SourceFiles {
+ globbed, _, err := pathtools.Glob(s, nil, pathtools.DontFollowSymlinks)
+ if err != nil {
+ return err
+ }
+ srcs = append(srcs, globbed...)
+ }
if fa.GlobDir != "" {
- srcs = append(srcs, recursiveGlobFiles(fa.GlobDir)...)
+ globbed, _, err := pathtools.Glob(filepath.Join(fa.GlobDir, "**/*"), nil, pathtools.DontFollowSymlinks)
+ if err != nil {
+ return err
+ }
+ srcs = append(srcs, globbed...)
}
for _, src := range srcs {
err := fillPathPairs(fa, src, &pathMappings, args.NonDeflatedFiles, noCompression)