From 7f2a392a337849e7c8b6a8134685ca40251e8efd Mon Sep 17 00:00:00 2001 From: yushijinhun Date: Sun, 5 Aug 2018 11:06:50 +0800 Subject: [PATCH] Use com.github.johnrengelman.shadow plugin --- HMCL/build.gradle | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/HMCL/build.gradle b/HMCL/build.gradle index 5042b3985..eba7524a3 100644 --- a/HMCL/build.gradle +++ b/HMCL/build.gradle @@ -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) } }