Use com.github.johnrengelman.shadow plugin

This commit is contained in:
yushijinhun 2018-08-05 11:06:50 +08:00
parent 055379f569
commit 7f2a392a33
No known key found for this signature in database
GPG Key ID: 5BC167F73EA558E4

View File

@ -1,3 +1,7 @@
plugins {
id 'com.github.johnrengelman.shadow' version '2.0.4'
}
import java.nio.file.FileSystems
import java.security.KeyFactory
import java.security.MessageDigest
@ -67,19 +71,30 @@ def repack(File file) {
}
jar {
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
manifest {
attributes 'Created-By': 'Copyright(c) 2013-2018 huangyuhui.',
'Main-Class': 'org.jackhuang.hmcl.Main',
'Multi-Release': 'true',
'Implementation-Version': version
}
finalizedBy shadowJar
}
shadowJar {
classifier = null
exclude 'META-INF/maven/**'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE.txt'
dependencies {
exclude(dependency('org.jetbrains:annotations'))
}
doLast {
repack(archivePath)
attachSignature(archivePath)
createChecksum(archivePath)
repack(jar.archivePath)
attachSignature(jar.archivePath)
createChecksum(jar.archivePath)
}
}