-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
167 lines (138 loc) · 4.12 KB
/
build.gradle.kts
File metadata and controls
167 lines (138 loc) · 4.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.shadow)
alias(libs.plugins.runtime)
application
}
group = "me.josh"
version = "1.0.0"
repositories {
mavenCentral()
}
dependencies {
// LibGDX Core
implementation(libs.gdx.core)
// LibGDX Desktop Backend (LWJGL3)
implementation(libs.gdx.backend.lwjgl3)
implementation(libs.gdx.platform) {
artifact {
classifier = "natives-desktop"
}
}
// FreeType font rendering
implementation(libs.gdx.freetype)
implementation(libs.gdx.freetype.platform) {
artifact {
classifier = "natives-desktop"
}
}
// KTX - Kotlin extensions for LibGDX
implementation(libs.ktx.app)
implementation(libs.ktx.graphics)
implementation(libs.ktx.assets)
implementation(libs.ktx.async)
// Kotlin Coroutines & Serialization
implementation(libs.kotlinx.coroutines.core)
implementation(libs.kotlinx.serialization.json)
// HTTP Client
implementation(libs.okhttp)
// Noise generation for procedural terrain
implementation(libs.joise)
// Testing
testImplementation(libs.kotlin.test)
testImplementation(libs.kotest.runner.junit5)
testImplementation(libs.kotest.assertions.core)
testImplementation(libs.kotest.property)
}
kotlin {
jvmToolchain(21)
}
tasks.test {
useJUnitPlatform()
}
application {
mainClass.set("me.josh.axiom.AxiomKt")
}
tasks.shadowJar {
archiveBaseName.set("axiom-game")
archiveClassifier.set("")
archiveVersion.set("")
manifest {
attributes["Main-Class"] = "me.josh.axiom.AxiomKt"
}
// Merge service files from dependencies
mergeServiceFiles()
}
runtime {
options.addAll(listOf("--strip-debug", "--compress", "2", "--no-header-files", "--no-man-pages"))
modules.addAll(listOf(
"java.base",
"java.desktop",
"java.logging",
"java.management",
"java.naming",
"java.sql",
"jdk.unsupported"
))
jpackage {
jpackageHome = System.getProperty("java.home")
// Application icon and metadata for the executable
imageOptions.addAll(listOf(
"--icon", "src/main/resources/icon.ico",
"--vendor", "Josh Baker",
"--copyright", "Copyright 2026 Josh Baker",
"--description", "Axiom - 2D Top-Down Sandbox Game",
"--app-version", project.version.toString()
))
installerOptions.addAll(listOf(
"--win-dir-chooser",
"--win-menu",
"--win-shortcut",
"--win-per-user-install",
"--vendor", "Josh Baker",
"--copyright", "Copyright 2026"
))
installerType = "msi"
installerName = "Axiom-Installer"
appVersion = project.version.toString()
}
targetPlatform("win") {
jdkHome.set(System.getProperty("java.home"))
}
}
// Rename shadowJar output for runtime plugin
tasks.installShadowDist {
doLast {
val libDir = file("${destinationDir}/lib")
val sourceJar = file("${libDir}/axiom-game.jar")
val targetJar = file("${libDir}/${project.name}-${project.version}-all.jar")
if (sourceJar.exists() && !targetJar.exists()) {
sourceJar.renameTo(targetJar)
}
}
}
// Override installDist to use shadowJar
tasks.installDist {
dependsOn(tasks.installShadowDist)
doLast {
delete(destinationDir)
copy {
from(tasks.installShadowDist.get().destinationDir)
into(destinationDir)
}
}
}
// Create distributable ZIP of portable app with bundled JRE
tasks.register<Zip>("packagePortable") {
dependsOn("jpackageImage")
archiveBaseName.set("Axiom")
archiveVersion.set("")
destinationDirectory.set(file("${buildDir}/distributions"))
// Put files directly in ZIP root (no nested folder)
from("${buildDir}/jpackage/axiom-game")
doLast {
println("Created distributable ZIP: ${archiveFile.get().asFile}")
println("Size: ${archiveFile.get().asFile.length() / 1024 / 1024}MB")
}
}