Browse Source

Add k/wasm target to composable-test-cases (#4371)

pull/4376/head
Oleksandr Karpovich 9 months ago committed by GitHub
parent
commit
fe77886793
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      compose/integrations/composable-test-cases/buildSrc/src/main/kotlin/TargetsConfiguration.kt
  2. 1
      compose/integrations/composable-test-cases/common/build.gradle.kts
  3. 8
      compose/integrations/composable-test-cases/common/src/commonMain/kotlin/com/example/common/Applier.kt
  4. 8
      compose/integrations/composable-test-cases/gradle.properties
  5. 2
      compose/integrations/composable-test-cases/testcases/expectActual/lib/src/wasmJsMain/kotlin/Dependencies.wasmJs.kt

3
compose/integrations/composable-test-cases/buildSrc/src/main/kotlin/TargetsConfiguration.kt

@ -26,6 +26,9 @@ val Project.isMingwX64Enabled: Boolean
fun KotlinMultiplatformExtension.configureTargets() {
jvm("desktop")
configureJsTargets()
wasmJs {
browser()
}
ios()
iosArm64()
iosSimulatorArm64()

1
compose/integrations/composable-test-cases/common/build.gradle.kts

@ -13,7 +13,6 @@ kotlin {
val commonMain by getting {
dependencies {
implementation(compose.runtime)
implementation(libs.kotlinx.datetime)
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
}
}

8
compose/integrations/composable-test-cases/common/src/commonMain/kotlin/com/example/common/Applier.kt

@ -9,7 +9,6 @@ import androidx.compose.runtime.*
import androidx.compose.runtime.snapshots.ObserverHandle
import androidx.compose.runtime.snapshots.Snapshot
import kotlinx.coroutines.*
import kotlinx.datetime.Clock
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.resume
import kotlin.coroutines.suspendCoroutine
@ -76,11 +75,14 @@ private object GlobalSnapshotManager {
private class MonotonicClockImpl : MonotonicFrameClock {
private val NANOS_PER_MILLI = 1_000_000
private var i = 0L
override suspend fun <R> withFrameNanos(
onFrame: (Long) -> R
): R = suspendCoroutine { continuation ->
val now = Clock.System.now()
val currentNanos = now.toEpochMilliseconds() * NANOS_PER_MILLI + now.nanosecondsOfSecond
val now = ++i
val currentNanos = now * NANOS_PER_MILLI
val result = onFrame(currentNanos)
continuation.resume(result)
}

8
compose/integrations/composable-test-cases/gradle.properties

@ -1,15 +1,15 @@
org.gradle.jvmargs=-Xmx2048M -XX:MaxMetaspaceSize=512m
org.gradle.jvmargs=-Xmx4096M -XX:MaxMetaspaceSize=512m
kotlin.code.style=official
android.useAndroidX=true
kotlin.version=1.9.22
agp.version=7.3.0
compose.version=1.6.0-dev1357
compose.version=1.6.0-rc03
kotlinx.coroutines.version=1.8.0-RC
kotlinx.coroutines.version=1.8.0
#empty by default - a default version will be used
#compose.kotlinCompilerPluginVersion=23.12.18
compose.kotlinCompilerPluginVersion=1.5.8-beta01
compose.kotlinCompilerPluginVersion=1.5.8.1
# default|failingJs - see enum class CasesToRun
tests.casesToRun=default

2
compose/integrations/composable-test-cases/testcases/expectActual/lib/src/wasmJsMain/kotlin/Dependencies.wasmJs.kt

@ -0,0 +1,2 @@
actual val Abc.composableIntVal: Int
get() = 100
Loading…
Cancel
Save