Use com.github.johnrengelman.shadow plugin

This commit is contained in:
yushijinhun
2018-08-05 11:06:50 +08:00
parent 055379f569
commit 7f2a392a33

View File

@@ -1,3 +1,7 @@
plugins {
id 'com.github.johnrengelman.shadow' version '2.0.4'
}
import java.nio.file.FileSystems import java.nio.file.FileSystems
import java.security.KeyFactory import java.security.KeyFactory
import java.security.MessageDigest import java.security.MessageDigest
@@ -67,19 +71,30 @@ def repack(File file) {
} }
jar { jar {
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
manifest { manifest {
attributes 'Created-By': 'Copyright(c) 2013-2018 huangyuhui.', attributes 'Created-By': 'Copyright(c) 2013-2018 huangyuhui.',
'Main-Class': 'org.jackhuang.hmcl.Main', 'Main-Class': 'org.jackhuang.hmcl.Main',
'Multi-Release': 'true', 'Multi-Release': 'true',
'Implementation-Version': version '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 { doLast {
repack(archivePath) repack(jar.archivePath)
attachSignature(archivePath) attachSignature(jar.archivePath)
createChecksum(archivePath) createChecksum(jar.archivePath)
} }
} }