1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-25 07:57:12 -07:00

Exclude MANIFESTS from other jar files.

This commit is contained in:
Cedric Beust 2018-02-03 11:17:44 -08:00
parent c1364c82a0
commit 7d27cd144d
2 changed files with 5 additions and 2 deletions

View file

@ -64,7 +64,7 @@ class MetaArchive(private val outputFile: File, val manifest: Manifest?) : Close
}
private val DEFAULT_JAR_EXCLUDES =
Glob("META-INF/*.SF", "META-INF/*.DSA", "META-INF/*.RSA")
Glob("META-INF/*.SF", "META-INF/*.DSA", "META-INF/*.RSA", "META-INF/MANIFEST.MF")
private val seen = hashSetOf<String>()

View file

@ -90,7 +90,10 @@ class OsgiPlugin @Inject constructor(val configActor: ConfigActor<OsgiConfig>, v
val fileSystem = FileSystems.newFileSystem(toFile, null)
fileSystem.use { fs ->
JarFile(jarFile).use { jf ->
val mf = jf.getEntry(MetaArchive.MANIFEST_MF) ?: Files.createDirectories(fs.getPath("META-INF/"))
val mf = jf.getEntry(MetaArchive.MANIFEST_MF)
if (mf == null) {
Files.createDirectories(fs.getPath("META-INF/"))
}
val jarManifest = fs.getPath(MetaArchive.MANIFEST_MF)
Files.write(jarManifest, listOf(lines2),
if (mf != null) StandardOpenOption.APPEND else StandardOpenOption.CREATE)