1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 00:17:11 -07:00

Add MANIFEST.MF at the top of the jar file

This commit is contained in:
Cedric Beust 2018-02-03 10:28:45 -08:00
parent 7a2c4f34da
commit 52f5ceb3d6
2 changed files with 18 additions and 19 deletions

View file

@ -90,10 +90,7 @@ 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)
if (mf == null) {
Files.createDirectories(fs.getPath("META-INF/"))
}
val mf = jf.getEntry(MetaArchive.MANIFEST_MF) ?: 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)