fix the 'run' task of Gradle

This commit is contained in:
Glavo 2022-01-25 05:13:22 +08:00 committed by Yuhui Huang
parent 23cb2655d1
commit 81d1dbdcf0

View File

@ -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<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("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<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("sha
}
}
fun createExecutable(suffix: String, header: String) {
val output = File(jarPath.parentFile, jarPath.nameWithoutExtension + '.' + suffix)
@ -276,3 +269,12 @@ val makeExecutables = tasks.create("makeExecutables") {
tasks.build {
dependsOn(makePackXz, makePackGz, makeExecutables)
}
tasks.create<JavaExec>("run") {
dependsOn(tasks.jar)
group = "application"
classpath = files(jarPath)
workingDir = rootProject.rootDir
}