Skip to content

Commit 12f831a

Browse files
committed
Upgrade dependency versions, add webMain sourceset, rename desktop target to jvm
1 parent e55b59d commit 12f831a

File tree

10 files changed

+34
-2913
lines changed

10 files changed

+34
-2913
lines changed

composeApp/build.gradle.kts

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ plugins {
1414

1515
kotlin {
1616
androidTarget {
17-
@OptIn(ExperimentalKotlinGradlePluginApi::class)
1817
compilerOptions {
1918
jvmTarget.set(JvmTarget.JVM_11)
2019
}
2120
}
2221

2322
listOf(
24-
iosX64(),
2523
iosArm64(),
2624
iosSimulatorArm64()
2725
).forEach { iosTarget ->
@@ -31,25 +29,16 @@ kotlin {
3129
}
3230
}
3331

34-
jvm("desktop")
32+
jvm()
33+
34+
js {
35+
browser()
36+
binaries.executable()
37+
}
3538

3639
@OptIn(ExperimentalWasmDsl::class)
3740
wasmJs {
38-
outputModuleName.set("composeApp")
39-
browser {
40-
val rootDirPath = project.rootDir.path
41-
val projectDirPath = project.projectDir.path
42-
commonWebpackConfig {
43-
outputFileName = "composeApp.js"
44-
devServer = (devServer ?: KotlinWebpackConfig.DevServer()).apply {
45-
static = (static ?: mutableListOf()).apply {
46-
// Serve sources to debug inside browser
47-
add(rootDirPath)
48-
add(projectDirPath)
49-
}
50-
}
51-
}
52-
}
41+
browser()
5342
binaries.executable()
5443
}
5544

@@ -60,8 +49,6 @@ kotlin {
6049
}
6150
}
6251

63-
val desktopMain by getting
64-
6552
androidMain.dependencies {
6653
implementation(compose.preview)
6754
implementation(libs.androidx.activity.compose)
@@ -73,14 +60,14 @@ kotlin {
7360
implementation(compose.ui)
7461
implementation(compose.components.resources)
7562
implementation(compose.components.uiToolingPreview)
76-
implementation(libs.androidx.lifecycle.viewmodel)
63+
implementation(libs.androidx.lifecycle.viewmodelCompose)
7764
implementation(libs.androidx.lifecycle.runtimeCompose)
7865
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.7.1")
7966
}
8067
commonTest.dependencies {
8168
implementation(libs.kotlin.test)
8269
}
83-
desktopMain.dependencies {
70+
jvmMain.dependencies {
8471
implementation(compose.desktop.currentOs)
8572
implementation(libs.kotlinx.coroutinesSwing)
8673
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package compose.project.demo.composedemo
2+
3+
class JsPlatform: Platform {
4+
override val name: String = "Web with Kotlin/JS"
5+
}
6+
7+
actual fun getPlatform(): Platform = JsPlatform()

composeApp/src/wasmJsMain/kotlin/compose/project/demo/composedemo/main.kt renamed to composeApp/src/webMain/kotlin/compose/project/demo/composedemo/main.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@ package compose.project.demo.composedemo
22

33
import androidx.compose.ui.ExperimentalComposeUiApi
44
import androidx.compose.ui.window.ComposeViewport
5-
import kotlinx.browser.document
5+
import kotlin.js.ExperimentalWasmJsInterop
6+
import kotlin.js.JsModule
67

8+
@OptIn(ExperimentalWasmJsInterop::class)
79
@JsModule("@js-joda/timezone")
810
external object JsJodaTimeZoneModule
911

1012
private val jsJodaTz = JsJodaTimeZoneModule
1113

1214
@OptIn(ExperimentalComposeUiApi::class)
1315
fun main() {
14-
ComposeViewport(viewportContainerId = "composeApplication") {
16+
ComposeViewport {
1517
App()
1618
}
17-
}
19+
}

composeApp/src/wasmJsMain/resources/index.html renamed to composeApp/src/webMain/resources/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@
88
<script type="application/javascript" src="composeApp.js"></script>
99
</head>
1010
<body>
11-
<div id="composeApplication" style="width:400px; height: 600px;"></div>
1211
</body>
1312
</html>

gradle/libs.versions.toml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
[versions]
2-
agp = "8.7.3"
3-
android-compileSdk = "35"
2+
agp = "8.11.2"
3+
android-compileSdk = "36"
44
android-minSdk = "24"
5-
android-targetSdk = "35"
6-
androidx-activity = "1.10.1"
5+
android-targetSdk = "36"
6+
androidx-activity = "1.11.0"
77
androidx-appcompat = "1.7.1"
8-
androidx-constraintlayout = "2.2.1"
9-
androidx-core = "1.16.0"
10-
androidx-espresso = "3.6.1"
11-
androidx-lifecycle = "2.9.1"
12-
androidx-testExt = "1.2.1"
13-
composeHotReload = "1.0.0-alpha11"
14-
composeMultiplatform = "1.8.2"
8+
androidx-core = "1.17.0"
9+
androidx-espresso = "3.7.0"
10+
androidx-lifecycle = "2.9.4"
11+
androidx-testExt = "1.3.0"
12+
composeHotReload = "1.0.0-beta07"
13+
composeMultiplatform = "1.9.0"
1514
junit = "4.13.2"
16-
kotlin = "2.2.0"
15+
kotlin = "2.2.20"
1716
kotlinx-coroutines = "1.10.2"
1817

1918
[libraries]
@@ -24,9 +23,8 @@ androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "androidx
2423
androidx-testExt-junit = { module = "androidx.test.ext:junit", version.ref = "androidx-testExt" }
2524
androidx-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "androidx-espresso" }
2625
androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" }
27-
androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "androidx-constraintlayout" }
2826
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity" }
29-
androidx-lifecycle-viewmodel = { module = "org.jetbrains.androidx.lifecycle:lifecycle-viewmodel", version.ref = "androidx-lifecycle" }
27+
androidx-lifecycle-viewmodelCompose = { module = "org.jetbrains.androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "androidx-lifecycle" }
3028
androidx-lifecycle-runtimeCompose = { module = "org.jetbrains.androidx.lifecycle:lifecycle-runtime-compose", version.ref = "androidx-lifecycle" }
3129
kotlinx-coroutinesSwing = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-swing", version.ref = "kotlinx-coroutines" }
3230

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)