11import org.jetbrains.kotlin.gradle.dsl.JvmTarget
22
33plugins {
4- alias(libs.plugins.kotlin)
4+ alias(libs.plugins.kotlin.jvm)
5+ alias(libs.plugins.kotlin.compose)
56 alias(libs.plugins.kotlin.serialization)
7+ alias(libs.plugins.compose)
68 alias(libs.plugins.shadow)
79 application
810 `maven- publish`
@@ -11,10 +13,33 @@ plugins {
1113
1214group = " app.morphe"
1315
16+ // ============================================================================
17+ // JVM / Kotlin Configuration
18+ // ============================================================================
19+ kotlin {
20+ jvmToolchain {
21+ languageVersion.set(JavaLanguageVersion .of(17 ))
22+ vendor.set(JvmVendorSpec .ADOPTIUM )
23+ }
24+ compilerOptions {
25+ jvmTarget.set(JvmTarget .JVM_17 )
26+ }
27+ }
28+
29+ // ============================================================================
30+ // Application Entry Point
31+ // ============================================================================
32+ // Shadow JAR reads this for Main-Class manifest attribute.
33+ //
34+ // No args / double-click → GUI (Compose Desktop)
35+ // With args (terminal) → CLI (PicoCLI)
1436application {
15- mainClass = " app.morphe.cli.command.MainCommandKt "
37+ mainClass.set( " app.morphe.MorpheLauncherKt " )
1638}
1739
40+ // ============================================================================
41+ // Repositories
42+ // ============================================================================
1843repositories {
1944 mavenLocal()
2045 mavenCentral()
@@ -32,6 +57,9 @@ repositories {
3257 maven { url = uri(" https://jitpack.io" ) }
3358}
3459
60+ // ============================================================================
61+ // Dependencies
62+ // ============================================================================
3563val apkEditorLib by configurations.creating
3664
3765val strippedApkEditorLib by tasks.registering(org.gradle.jvm.tasks.Jar ::class ) {
@@ -54,27 +82,69 @@ val strippedApkEditorLib by tasks.registering(org.gradle.jvm.tasks.Jar::class) {
5482dependencies {
5583 api(libs.morphe.patcher)
5684 implementation(libs.morphe.library)
57- implementation(libs.kotlinx.coroutines.core)
58- implementation(libs.kotlinx.serialization.json)
5985 implementation(libs.picocli)
6086 apkEditorLib(files(" $rootDir /libs/APKEditor-1.4.7.jar" ))
6187 implementation(files(strippedApkEditorLib))
6288
89+ // -- Compose Desktop ---------------------------------------------------
90+ // Platform-independent: single JAR runs on all supported OSes.
91+ // Skiko auto-detects the OS at runtime and loads the correct native library.
92+ implementation(compose.desktop.macos_arm64)
93+ implementation(compose.desktop.macos_x64)
94+ implementation(compose.desktop.linux_x64)
95+ implementation(compose.desktop.linux_arm64)
96+ implementation(compose.desktop.windows_x64)
97+ implementation(compose.components.resources)
98+ @Suppress(" DEPRECATION" )
99+ implementation(compose.material3)
100+ implementation(compose.materialIconsExtended)
101+
102+ // -- Async / Serialization ---------------------------------------------
103+ implementation(libs.kotlinx.coroutines.core)
104+ implementation(libs.kotlinx.coroutines.swing)
105+ implementation(libs.kotlinx.serialization.json)
106+ // testImplementation(libs.kotlin.test)
107+ // }
108+
109+ // -- Networking (GUI) --------------------------------------------------
110+ implementation(libs.ktor.client.core)
111+ implementation(libs.ktor.client.cio)
112+ implementation(libs.ktor.client.content.negotiation)
113+ implementation(libs.ktor.serialization.kotlinx.json)
114+ implementation(libs.ktor.client.logging)
115+
116+ // -- DI / Navigation (GUI) ---------------------------------------------
117+ implementation(platform(libs.koin.bom))
118+ implementation(libs.koin.core)
119+ implementation(libs.koin.compose)
120+
121+ implementation(libs.voyager.navigator)
122+ implementation(libs.voyager.screenmodel)
123+ implementation(libs.voyager.koin)
124+ implementation(libs.voyager.transitions)
125+
126+ // -- APK Parsing (GUI) -------------------------------------------------
127+ implementation(libs.apk.parser)
128+
129+ // -- Testing -----------------------------------------------------------
63130 testImplementation(libs.kotlin.test)
64131 testImplementation(libs.junit.params)
132+ testImplementation(libs.mockk)
65133}
66134
67- kotlin {
68- compilerOptions {
69- jvmTarget.set(JvmTarget .JVM_11 )
135+ // ============================================================================
136+ // Tasks
137+ // ============================================================================
138+ tasks {
139+ jar {
140+ manifest {
141+ attributes(
142+ " Implementation-Title" to project.name,
143+ " Implementation-Version" to project.version
144+ )
145+ }
70146 }
71- }
72147
73- java {
74- targetCompatibility = JavaVersion .VERSION_11
75- }
76-
77- tasks {
78148 test {
79149 useJUnitPlatform()
80150 testLogging {
@@ -83,9 +153,15 @@ tasks {
83153 }
84154
85155 processResources {
86- expand(" projectVersion" to project.version)
156+ // Only expand properties files, not binary files like PNG/ICO
157+ filesMatching(" **/*.properties" ) {
158+ expand(" projectVersion" to project.version)
159+ }
87160 }
88161
162+ // -------------------------------------------------------------------------
163+ // Shadow JAR — the only distribution artifact
164+ // -------------------------------------------------------------------------
89165 shadowJar {
90166 exclude(
91167 " /prebuilt/linux/aapt" ,
@@ -95,14 +171,31 @@ tasks {
95171 minimize {
96172 exclude(dependency(" org.bouncycastle:.*" ))
97173 exclude(dependency(" app.morphe:morphe-patcher" ))
174+ // Ktor uses ServiceLoader
175+ exclude(dependency(" io.ktor:.*" ))
176+ // Koin uses reflection
177+ exclude(dependency(" io.insert-koin:.*" ))
98178 }
179+
180+ mergeServiceFiles()
181+ }
182+
183+ distTar {
184+ duplicatesStrategy = DuplicatesStrategy .EXCLUDE
185+ }
186+
187+ distZip {
188+ duplicatesStrategy = DuplicatesStrategy .EXCLUDE
99189 }
100190
101191 publish {
102192 dependsOn(shadowJar)
103193 }
104194}
105195
196+ // ============================================================================
197+ // Publishing / Signing
198+ // ============================================================================
106199// Needed by gradle-semantic-release-plugin.
107200// Tracking: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435
108201
0 commit comments