Skip to content

Commit

Permalink
Merge pull request #251 from Tlaster/compose-1.6
Browse files Browse the repository at this point in the history
Compose 1.6
  • Loading branch information
Tlaster authored Apr 8, 2024
2 parents 9fc94e1 + c40cad7 commit c9441c2
Show file tree
Hide file tree
Showing 28 changed files with 677 additions and 415 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ allprojects {
}

extra.apply {
set("precomposeVersion", "1.5.11")
set("precomposeVersion", "1.6.0-rc05")

set("jvmTarget", "11")

Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ org.gradle.jvmargs=-Xmx4g
org.jetbrains.compose.experimental.jscanvas.enabled=true
org.jetbrains.compose.experimental.macos.enabled=true
org.jetbrains.compose.experimental.uikit.enabled=true
org.jetbrains.compose.experimental.wasm.enabled=true
kotlin.mpp.androidSourceSetLayoutVersion=2
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
Expand Down
29 changes: 15 additions & 14 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
[versions] # also check project root build.gradle.kts for versions
androidx-animation = "1.5.3"
androidx-foundation = "1.5.3"
androidx-animation = "1.6.1"
androidx-foundation = "1.6.1"
androidx-appcompat = "1.6.1"
androidx-coreKtx = "1.12.0"
androidxActivityVer = "1.8.0"
androidGradlePlugin = "8.1.1"
androidxActivityVer = "1.8.2"
androidGradlePlugin = "8.2.2"
junit = "4.13.2"
junitJupiterEngine = "5.10.1"
junitJupiterApi = "5.10.1"
kotlin = "1.9.21"
kotlinxCoroutinesCore = "1.7.3"
lifecycleRuntimeKtx = "2.6.2"
material = "1.5.0"
kotlin = "1.9.22"
lifecycleRuntimeKtx = "2.7.0"
material = "1.6.1"
kotlinxCoroutinesCore = "1.8.0"
moleculeRuntime = "1.3.2"
savedstateKtx = "1.2.1"
spotless = "6.25.0"
jetbrainsComposePlugin = "1.5.11"
skiko = "0.7.90"
koin = "3.5.0"
koin-compose = "1.1.2"
jetbrainsComposePlugin = "1.6.0"
skiko = "0.7.93"
koin = "3.6.0-alpha3"
uuid = "0.8.2"

[libraries]
androidx-activity-ktx = { module = "androidx.activity:activity-ktx", version.ref = "androidxActivityVer" }
Expand All @@ -41,11 +41,12 @@ molecule-runtime = { module = "app.cash.molecule:molecule-runtime", version.ref
skiko = { module = "org.jetbrains.skiko:skiko", version.ref = "skiko" }
skiko-js = { module = "org.jetbrains.skiko:skiko-js-wasm-runtime", version.ref = "skiko" }
koin = { module = "io.insert-koin:koin-core", version.ref = "koin" }
koin-compose = { module = "io.insert-koin:koin-compose", version.ref = "koin-compose" }
koin-compose = { module = "io.insert-koin:koin-compose", version = "1.2.0-alpha3" }
uuid = { module = "com.benasher44:uuid", version.ref = "uuid" }

[plugins]
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" }
jetbrains-compose = { id = "org.jetbrains.compose", version.ref = "jetbrainsComposePlugin" }
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
9 changes: 8 additions & 1 deletion precompose-koin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ group = "moe.tlaster"
version = rootProject.extra.get("precomposeVersion") as String

kotlin {

applyDefaultHierarchyTemplate {
common {
group("jvmAndroid") {
Expand Down Expand Up @@ -41,6 +40,10 @@ kotlin {
js(IR) {
browser()
}
wasmJs {
browser()
binaries.executable()
}
sourceSets {
val commonMain by getting {
dependencies {
Expand Down Expand Up @@ -106,6 +109,10 @@ kotlin {
}
}

// adding it here to make sure skiko is unpacked and available in web tests
compose.experimental {
web.application {}
}
android {
compileSdk = rootProject.extra.get("android-compile") as Int
buildToolsVersion = rootProject.extra.get("android-build-tools") as String
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package moe.tlaster.precompose.molecule

import app.cash.molecule.DisplayLinkClock
import kotlinx.coroutines.Dispatchers
import kotlin.coroutines.CoroutineContext

internal actual fun providePlatformDispatcher(): CoroutineContext = Dispatchers.Main
internal actual fun providePlatformDispatcher(): CoroutineContext = DisplayLinkClock + Dispatchers.Main
14 changes: 13 additions & 1 deletion precompose-viewmodel/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ kotlin {
js(IR) {
browser()
}
wasmJs {
browser()
binaries.executable()
}
sourceSets {
val commonMain by getting {
dependencies {
Expand Down Expand Up @@ -99,9 +103,17 @@ kotlin {
implementation(compose.foundation)
}
}
val wasmJsMain by getting {
dependencies {
implementation(compose.foundation)
}
}
}
}

// adding it here to make sure skiko is unpacked and available in web tests
compose.experimental {
web.application {}
}
android {
compileSdk = rootProject.extra.get("android-compile") as Int
buildToolsVersion = rootProject.extra.get("android-build-tools") as String
Expand Down
34 changes: 33 additions & 1 deletion precompose/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import org.jetbrains.compose.ExperimentalComposeLibrary
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetTree
import java.util.Properties

plugins {
Expand All @@ -20,6 +23,16 @@ kotlin {
iosSimulatorArm64()
androidTarget {
publishLibraryVariants("release", "debug")

@OptIn(ExperimentalKotlinGradlePluginApi::class)
instrumentedTestVariant {
sourceSetTree.set(KotlinSourceSetTree.test)

dependencies {
implementation("androidx.compose.ui:ui-test-junit4-android:1.5.4")
debugImplementation("androidx.compose.ui:ui-test-manifest:1.5.4")
}
}
}
jvm {
compilations.all {
Expand All @@ -32,13 +45,18 @@ kotlin {
js(IR) {
browser()
}
wasmJs {
browser()
binaries.executable()
}
sourceSets {
val commonMain by getting {
dependencies {
compileOnly(compose.foundation)
compileOnly(compose.animation)
compileOnly(compose.material)
api(libs.kotlinx.coroutines.core)
implementation(libs.uuid)
}
}
val commonTest by getting {
Expand All @@ -48,6 +66,8 @@ kotlin {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
implementation(libs.kotlinx.coroutines.test)
@OptIn(ExperimentalComposeLibrary::class)
implementation(compose.uiTest)
// @OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
// implementation(compose.uiTestJUnit4)
}
Expand Down Expand Up @@ -91,6 +111,7 @@ kotlin {
implementation(kotlin("test-junit5"))
implementation(libs.junit.jupiter.api)
runtimeOnly(libs.junit.jupiter.engine)
implementation(compose.desktop.currentOs)
}
}
val jsMain by getting {
Expand All @@ -112,15 +133,26 @@ kotlin {
implementation(compose.material)
}
}
val wasmJsMain by getting {
dependencies {
implementation(compose.foundation)
implementation(compose.animation)
implementation(compose.material)
}
}
}
}

// adding it here to make sure skiko is unpacked and available in web tests
compose.experimental {
web.application {}
}
android {
compileSdk = rootProject.extra.get("android-compile") as Int
buildToolsVersion = rootProject.extra.get("android-build-tools") as String
namespace = "moe.tlaster.precompose"
defaultConfig {
minSdk = rootProject.extra.get("androidMinSdk") as Int
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility = JavaVersion.toVersion(rootProject.extra.get("jvmTarget") as String)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package moe.tlaster.precompose.lifecycle

import androidx.activity.BackEventCompat
import androidx.activity.OnBackPressedCallback
import moe.tlaster.precompose.stateholder.StateHolder
import moe.tlaster.precompose.ui.BackDispatcher
Expand All @@ -26,6 +27,18 @@ internal class PreComposeViewModel :
override fun handleOnBackPressed() {
backDispatcher.onBackPress()
}

override fun handleOnBackStarted(backEvent: BackEventCompat) {
backDispatcher.onBackStarted()
}

override fun handleOnBackProgressed(backEvent: BackEventCompat) {
backDispatcher.onBackProgressed(backEvent.progress)
}

override fun handleOnBackCancelled() {
backDispatcher.onBackCancelled()
}
}

override fun onCleared() {
Expand Down
Loading

0 comments on commit c9441c2

Please sign in to comment.