From 81d1dbdcf04a4a759189973b665e8f8ac63a509f Mon Sep 17 00:00:00 2001 From: Glavo Date: Tue, 25 Jan 2022 05:13:22 +0800 Subject: [PATCH] fix the 'run' task of Gradle --- HMCL/build.gradle.kts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/HMCL/build.gradle.kts b/HMCL/build.gradle.kts index 3f7003d89..dc936842b 100644 --- a/HMCL/build.gradle.kts +++ b/HMCL/build.gradle.kts @@ -28,7 +28,6 @@ buildscript { } plugins { - application id("com.github.johnrengelman.shadow") version "7.0.0" } @@ -48,10 +47,6 @@ val versionType = System.getenv("VERSION_TYPE") ?: "nightly" version = "$versionRoot.$buildNumber" -application { - mainClass.set("org.jackhuang.hmcl.Main") -} - dependencies { implementation(project(":HMCLCore")) implementation("libs:JFoenix") @@ -147,7 +142,7 @@ tasks.getByName("sha manifest { attributes( "Created-By" to "Copyright(c) 2013-2021 huangyuhui.", - "Main-Class" to application.mainClass.get(), + "Main-Class" to "org.jackhuang.hmcl.Main", "Multi-Release" to "true", "Implementation-Version" to project.version, "Microsoft-Auth-Id" to microsoftAuthId, @@ -185,8 +180,6 @@ tasks.getByName("sha } } - - fun createExecutable(suffix: String, header: String) { val output = File(jarPath.parentFile, jarPath.nameWithoutExtension + '.' + suffix) @@ -275,4 +268,13 @@ val makeExecutables = tasks.create("makeExecutables") { tasks.build { dependsOn(makePackXz, makePackGz, makeExecutables) -} \ No newline at end of file +} + +tasks.create("run") { + dependsOn(tasks.jar) + + group = "application" + + classpath = files(jarPath) + workingDir = rootProject.rootDir +}