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
diff --git a/cmd/soong_jar/soong_jar.go b/cmd/soong_jar/soong_jar.go
index 95c86c3..4a4a3ab 100644
--- a/cmd/soong_jar/soong_jar.go
+++ b/cmd/soong_jar/soong_jar.go
@@ -176,6 +176,13 @@
 }
 
 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)