soong_jar: ignore directories passed to jar unless -d is set

Java resource lists created by globs like "**/*" may include
directories.  Ignore them when creating the zip file unless
-d was passed on the command line.  Fixes read: is a directory
errors.

Change-Id: Ifa6fd4fbd8262f700bed1f4a7268f11618dc305c
This commit is contained in:
Colin Cross 2015-04-24 15:10:32 -07:00
parent e19c79310d
commit 957cc4e20d

View file

@ -176,6 +176,13 @@ func (z *zipWriter) writeRelFile(root, file string) error {
}
func (z *zipWriter) writeFile(rel, file string) error {
if s, _ := os.Stat(file); s.IsDir() {
if z.directories {
return z.writeDirectory(file)
}
return nil
}
if z.directories {
dir, _ := filepath.Split(rel)
err := z.writeDirectory(dir)