Skip to content

Commit 106619f

Browse files
prateek-whoLisoUseInAIKyrios
authored andcommitted
feat: Add desktop GUI
1 parent 8591ff4 commit 106619f

55 files changed

Lines changed: 11746 additions & 23 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ misc.xml
2323
deploymentTargetDropDown.xml
2424
render.experimental.xml
2525

26+
# Kotlin
27+
.kotlin/
28+
2629
# Keystore files
2730
*.jks
2831
*.keystore
@@ -33,5 +36,7 @@ google-services.json
3336
# Android Profiling
3437
*.hprof
3538

39+
# Mac files
40+
.DS_Store
3641
# NPM modules
3742
node_modules/

.run/CLI GUI.run.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="CLI GUI" type="Application" factoryName="Application">
3+
<option name="MAIN_CLASS_NAME" value="app.morphe.MorpheLauncherKt" />
4+
<module name="morphe-cli.main" />
5+
<method v="2">
6+
<option name="Make" enabled="true" />
7+
</method>
8+
</configuration>
9+
</component>

build.gradle.kts

Lines changed: 107 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
22

33
plugins {
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

1214
group = "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)
1436
application {
15-
mainClass = "app.morphe.cli.command.MainCommandKt"
37+
mainClass.set("app.morphe.MorpheLauncherKt")
1638
}
1739

40+
// ============================================================================
41+
// Repositories
42+
// ============================================================================
1843
repositories {
1944
mavenLocal()
2045
mavenCentral()
@@ -32,6 +57,9 @@ repositories {
3257
maven { url = uri("https://jitpack.io") }
3358
}
3459

60+
// ============================================================================
61+
// Dependencies
62+
// ============================================================================
3563
val apkEditorLib by configurations.creating
3664

3765
val 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) {
5482
dependencies {
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

gradle/libs.versions.toml

Lines changed: 64 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,80 @@
11
[versions]
2+
# Core
23
shadow = "8.3.9"
34
junit = "5.11.0"
45
kotlin = "2.3.0"
5-
kotlinx = "1.9.0"
6+
7+
# CLI
68
picocli = "4.7.7"
79
morphe-patcher = "1.2.0"
810
morphe-library = "1.3.0"
911

12+
# Compose Desktop
13+
compose = "1.10.0"
14+
15+
# Networking
16+
ktor = "3.4.0"
17+
18+
# DI
19+
koin-bom = "4.1.1"
20+
21+
# Navigation
22+
voyager = "1.1.0-beta03"
23+
24+
# Async / Serialization
25+
coroutines = "1.10.2"
26+
kotlinx-serialization = "1.9.0"
27+
28+
# APK
29+
apk-parser = "2.6.10"
30+
arsclib = "1.3.8"
31+
32+
# Testing
33+
mockk = "1.14.3"
34+
1035
[libraries]
36+
# Morphe Core
1137
junit-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit" }
12-
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
13-
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx" }
14-
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx" }
1538
picocli = { module = "info.picocli:picocli", version.ref = "picocli" }
1639
morphe-patcher = { module = "app.morphe:morphe-patcher", version.ref = "morphe-patcher" }
1740
morphe-library = { module = "app.morphe:morphe-library-jvm", version.ref = "morphe-library" }
1841

42+
# Ktor Client
43+
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
44+
ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
45+
ktor-client-content-negotiation = { module = "io.ktor:ktor-client-content-negotiation", version.ref = "ktor" }
46+
ktor-serialization-kotlinx-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }
47+
ktor-client-logging = { module = "io.ktor:ktor-client-logging", version.ref = "ktor" }
48+
49+
# Koin
50+
koin-bom = { module = "io.insert-koin:koin-bom", version.ref = "koin-bom" }
51+
koin-core = { module = "io.insert-koin:koin-core" }
52+
koin-compose = { module = "io.insert-koin:koin-compose" }
53+
54+
# Voyager Navigation
55+
voyager-navigator = { module = "cafe.adriel.voyager:voyager-navigator", version.ref = "voyager" }
56+
voyager-screenmodel = { module = "cafe.adriel.voyager:voyager-screenmodel", version.ref = "voyager" }
57+
voyager-koin = { module = "cafe.adriel.voyager:voyager-koin", version.ref = "voyager" }
58+
voyager-transitions = { module = "cafe.adriel.voyager:voyager-transitions", version.ref = "voyager" }
59+
60+
# Coroutines
61+
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
62+
kotlinx-coroutines-swing = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-swing", version.ref = "coroutines" }
63+
64+
# Serialization
65+
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" }
66+
67+
# APK
68+
apk-parser = { module = "net.dongliu:apk-parser", version.ref = "apk-parser" }
69+
arsclib = { module = "io.github.reandroid:ARSCLib", version.ref = "arsclib" }
70+
71+
# Testing
72+
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
73+
mockk = { module = "io.mockk:mockk", version.ref = "mockk" }
74+
1975
[plugins]
20-
shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }
21-
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
76+
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
77+
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
2278
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
79+
compose = { id = "org.jetbrains.compose", version.ref = "compose" }
80+
shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }

settings.gradle.kts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
pluginManagement {
2+
repositories {
3+
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
4+
google()
5+
mavenCentral()
6+
gradlePluginPortal()
7+
}
8+
}
9+
10+
plugins {
11+
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
12+
}
13+
114
rootProject.name = "morphe-cli"
215

316
// Include morphe-patcher and morphe-library as composite builds if they exist locally
Lines changed: 40 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)