Allow some duplicates in merged jars
Only take the first MANIFEST.MF or module-info.class file.
Test: m -j checkbuild
Change-Id: Ifbf9fe272437ef2c2bd51ab4849ac8d7ef37b6fc
diff --git a/cmd/soong_zip/soong_zip.go b/cmd/soong_zip/soong_zip.go
index ae176df..4cf0764 100644
--- a/cmd/soong_zip/soong_zip.go
+++ b/cmd/soong_zip/soong_zip.go
@@ -62,9 +62,6 @@
io.Closer
}
-// the file path in the zip at which a Java manifest file gets written
-const manifestDest = "META-INF/MANIFEST.MF"
-
type fileArg struct {
pathPrefixInZip, sourcePrefixToStrip string
sourceFiles []string
@@ -360,7 +357,7 @@
if !*emulateJar {
return errors.New("must specify --jar when specifying a manifest via -m")
}
- pathMappings = append(pathMappings, pathMapping{manifestDest, manifest, zip.Deflate})
+ pathMappings = append(pathMappings, pathMapping{jar.ManifestFile, manifest, zip.Deflate})
}
if *emulateJar {
@@ -372,7 +369,7 @@
defer close(z.writeOps)
for _, ele := range pathMappings {
- if *emulateJar && ele.dest == manifestDest {
+ if *emulateJar && ele.dest == jar.ManifestFile {
err = z.addManifest(ele.dest, ele.src, ele.zipMethod)
} else {
err = z.addFile(ele.dest, ele.src, ele.zipMethod)