Skip to content

Commit fa84807

Browse files
authored
Add support for desktop (#12)
1 parent 409fcb0 commit fa84807

File tree

3 files changed

+43
-2
lines changed

3 files changed

+43
-2
lines changed

composeApp/build.gradle.kts

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
12
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
23
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig
34

@@ -25,16 +26,32 @@ kotlin {
2526
}
2627
binaries.executable()
2728
}
28-
29+
30+
jvm("desktop")
31+
2932
sourceSets {
33+
val wasmJsMain by getting {
34+
dependencies {
35+
implementation("io.ktor:ktor-client-js:3.0.0-beta-2")
36+
}
37+
}
38+
39+
val desktopMain by getting {
40+
dependencies {
41+
implementation(compose.desktop.currentOs)
42+
implementation(libs.kotlinx.coroutines.swing)
43+
implementation("io.ktor:ktor-client-cio:3.0.0-beta-2")
44+
}
45+
}
46+
3047
commonMain.dependencies {
3148
implementation(compose.runtime)
3249
implementation(compose.foundation)
3350
implementation(compose.material)
3451
implementation(compose.ui)
3552
implementation(compose.components.resources)
3653
implementation(compose.components.uiToolingPreview)
37-
implementation("io.ktor:ktor-client-core:3.0.0-wasm2")
54+
implementation("io.ktor:ktor-client-core:3.0.0-beta-2")
3855
implementation("com.charleskorn.kaml:kaml:0.61.0")
3956
}
4057
}
@@ -43,3 +60,14 @@ kotlin {
4360
compose.experimental {
4461
web.application {}
4562
}
63+
compose.desktop {
64+
application {
65+
mainClass = "MainKt"
66+
67+
nativeDistributions {
68+
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
69+
packageName = "it.krzeminski.githubactionstypingeditor"
70+
packageVersion = "1.0.0"
71+
}
72+
}
73+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import androidx.compose.ui.window.Window
2+
import androidx.compose.ui.window.application
3+
4+
fun main() = application {
5+
Window(
6+
onCloseRequest = ::exitApplication,
7+
title = "github-actions-typing-editor",
8+
) {
9+
App()
10+
}
11+
}

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ compose = "1.6.6"
33
compose-plugin = "1.6.11"
44
junit = "4.13.2"
55
kotlin = "2.0.0"
6+
kotlinx-coroutines = "1.8.1"
67

78
[libraries]
89
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
910
kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" }
1011
junit = { group = "junit", name = "junit", version.ref = "junit" }
1112
compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" }
1213
compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" }
14+
kotlinx-coroutines-swing = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-swing", version.ref = "kotlinx-coroutines" }
1315

1416
[plugins]
1517
jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" }

0 commit comments

Comments
 (0)