Created
March 5, 2021 09:53
-
-
Save veiset/5f33449913f19dcd3f58436f3073510f to your computer and use it in GitHub Desktop.
Gradle Kotlin Windows Executable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins { | |
kotlin("jvm") version "1.4.31" | |
id("edu.sc.seis.launch4j") version "2.4.9" | |
id("de.undercouch.download") version "4.1.1" | |
} | |
task("createExecutableWindows") { | |
val jdkVersion = "15.0.2" | |
val downloadUrl = | |
"https://download.java.net/java/GA/jdk15.0.2/0d1cfde4252546c6931946de8db48ee2/7/GPL/openjdk-15.0.2_windows-x64_bin.zip" | |
val downloadPath = "build/dist/jdk.zip" | |
val execPath = "exec/win" | |
dependsOn("build") | |
task<de.undercouch.gradle.tasks.download.Download>("download-jdk-task") { | |
src(downloadUrl) | |
dest(downloadPath) | |
overwrite(false) | |
} | |
dependsOn("download-jdk-task") | |
copy { | |
from(zipTree(downloadPath)) | |
into("build/$execPath") | |
} | |
val createExec = tasks.withType<edu.sc.seis.launch4j.tasks.DefaultLaunch4jTask> { | |
outfile = "MyGame.exe" | |
mainClassName = "org.veiset.game.MainKt" | |
productName = "Rogue Tower" | |
outputDir = execPath | |
bundledJre64Bit = true | |
jdkPreference = "preferJdk" | |
bundledJrePath = "jdk-$jdkVersion" | |
} | |
dependsOn(createExec) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment