Skip to content

Commit

Permalink
Update for k/wasm (#4009)
Browse files Browse the repository at this point in the history
This a comanion PR to
JetBrains/compose-multiplatform-core#914

Resources lib doesn't contain k/wasm target yet. It will be added in a
separate PR

---------

Co-authored-by: Oleksandr Karpovich <[email protected]>
  • Loading branch information
eymar and Oleksandr Karpovich authored Dec 8, 2023
1 parent dfaeced commit 93b5134
Show file tree
Hide file tree
Showing 25 changed files with 309 additions and 445 deletions.
1 change: 1 addition & 0 deletions examples/html/compose-bird/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ kotlin {
dependencies {
implementation(compose.html.core)
implementation(compose.runtime)
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0-RC")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ class ComposeCompilerKotlinSupportPlugin : KotlinCompilerPluginSupportPlugin {
}

private val platformPluginOptions = mapOf(
KotlinPlatformType.js to options("generateDecoys" to "true")
KotlinPlatformType.js to options("generateDecoys" to "false"),
KotlinPlatformType.wasm to options("generateDecoys" to "false")
)

private fun options(vararg options: Pair<String, String>): List<SubpluginOption> =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ private val TargetType.gradlePropertyName get() = "org.jetbrains.compose.experim
private val EXPERIMENTAL_TARGETS: Set<TargetType> = setOf(
TargetType("macos", presets = listOf("macosX64", "macosArm64")),
TargetType("jscanvas", presets = listOf("jsIr", "js")),
TargetType("wasm", presets = listOf("wasm", "wasmJs")),
)

private sealed interface CheckResult {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,25 +77,25 @@ class DesktopApplicationTest : GradlePluginTestBase() {
@Test
fun testSettingLatestCompiler() = testProject(
TestProjects.customCompiler, defaultTestEnvironment.copy(
kotlinVersion = "1.7.20",
composeCompilerPlugin = "dependencies.compiler.forKotlin(\"1.7.20\")",
kotlinVersion = "1.8.20",
composeCompilerPlugin = "dependencies.compiler.forKotlin(\"1.8.20\")",
)
).checkCustomComposeCompiler()

@Test
fun testSettingAutoCompiler() = testProject(
TestProjects.customCompiler, defaultTestEnvironment.copy(
kotlinVersion = "1.7.10",
kotlinVersion = "1.8.10",
composeCompilerPlugin = "dependencies.compiler.auto",
)
).checkCustomComposeCompiler()

@Test
fun testKotlinCheckDisabled() = testProject(
TestProjects.customCompilerArgs, defaultTestEnvironment.copy(
kotlinVersion = "1.7.21",
composeCompilerPlugin = "dependencies.compiler.forKotlin(\"1.7.20\")",
composeCompilerArgs = "\"suppressKotlinVersionCompatibilityCheck=1.7.21\""
kotlinVersion = "1.9.21",
composeCompilerPlugin = "dependencies.compiler.forKotlin(\"1.9.20\")",
composeCompilerArgs = "\"suppressKotlinVersionCompatibilityCheck=1.9.21\""
)
).checkCustomComposeCompiler(checkKJS = true)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import org.jetbrains.compose.desktop.ui.tooling.preview.rpc.PreviewLogger
import org.jetbrains.compose.desktop.ui.tooling.preview.rpc.RemoteConnection
import org.jetbrains.compose.desktop.ui.tooling.preview.rpc.receiveConfigFromGradle
import org.jetbrains.compose.experimental.internal.kotlinVersionNumbers
import org.jetbrains.compose.internal.utils.Arch
import org.jetbrains.compose.internal.utils.OS
import org.jetbrains.compose.internal.utils.currentArch
import org.jetbrains.compose.internal.utils.currentOS
import org.jetbrains.compose.test.utils.*
import org.junit.jupiter.api.Assumptions
Expand Down Expand Up @@ -122,16 +124,20 @@ class GradlePluginTest : GradlePluginTestBase() {
defaultTestEnvironment.copy(kotlinVersion = kotlinVersion, useGradleConfigurationCache = false)
)

val task = ":subproject:linkDebugFrameworkIosX64"
with(nativeCacheKindProject(kotlinVersion = TestKotlinVersions.v1_8_20)) {
val task = if (currentArch == Arch.X64) {
":subproject:linkDebugFrameworkIosX64"
} else {
":subproject:linkDebugFrameworkIosArm64"
}
with(nativeCacheKindProject(kotlinVersion = TestKotlinVersions.v1_9_0)) {
gradle(task, "--info").checks {
check.taskSuccessful(task)
check.logDoesntContain("-Xauto-cache-from=")
}
}
testWorkDir.deleteRecursively()
testWorkDir.mkdirs()
with(nativeCacheKindProject(kotlinVersion = TestKotlinVersions.v1_9_0) ) {
with(nativeCacheKindProject(kotlinVersion = TestKotlinVersions.v1_9_10) ) {
gradle(task, "--info").checks {
check.taskSuccessful(task)
check.logDoesntContain("-Xauto-cache-from=")
Expand Down Expand Up @@ -205,7 +211,7 @@ class GradlePluginTest : GradlePluginTestBase() {
}
}

testKotlinVersion(TestKotlinVersions.v1_9_20_Beta)
testKotlinVersion(TestKotlinVersions.v1_9_21)
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ import org.junit.jupiter.api.Test

class KotlinCompatibilityTest : GradlePluginTestBase() {
@Test
fun testKotlinMpp_1_7_10() = testMpp("1.7.10")
fun testKotlinMpp_1_9_10() = testMpp("1.9.10")

@Test
fun testKotlinJsMpp_1_7_10() = testJsMpp("1.7.10")
fun testKotlinJsMpp_1_9_10() = testJsMpp("1.9.10")

@Test
fun testKotlinMpp_1_7_20() = testMpp("1.7.20")
fun testKotlinMpp_1_9_20() = testMpp("1.9.20")

@Test
fun testKotlinJsMpp_1_7_20() = testJsMpp("1.7.20")
fun testKotlinJsMpp_1_9_20() = testJsMpp("1.9.20")

private fun testMpp(kotlinVersion: String) = with(
testProject(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ object TestKotlinVersions {
val Default = TestProperties.composeCompilerCompatibleKotlinVersion
val v1_8_20 = "1.8.20"
val v1_9_0 = "1.9.0"
val v1_9_10 = "1.9.10"
val v1_9_20_Beta = "1.9.20-Beta"
val v1_9_21 = "1.9.21"
}
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
org.gradle.jvmargs=-Xmx8096M
android.useAndroidX=true
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
org.gradle.jvmargs=-Xmx8096M
org.jetbrains.compose.experimental.uikit.enabled=true
1 change: 1 addition & 0 deletions html/benchmark-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ kotlin {
implementation(compose.runtime)
implementation(project(":html-core"))
implementation(kotlin("stdlib-common"))
implementation(libs.kotlinx.coroutines.core)
}
}

Expand Down
2 changes: 1 addition & 1 deletion html/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ subprojects {
configurations.all {
resolutionStrategy.dependencySubstitution {
substitute(module("org.jetbrains.compose.html:html-core")).apply {
with(project(":html-core"))
using(project(":html-core"))
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions html/buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ plugins {


java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion html/buildSrc/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
kotlin.version=1.8.21
kotlin.version=1.9.21
1 change: 1 addition & 0 deletions html/compose-compiler-integration/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ kotlin {
implementation(kotlin("stdlib-js"))
implementation(compose.runtime)
implementation(project(":html-core"))
implementation(libs.kotlinx.coroutines.core)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ kotlin {
implementation(kotlin("stdlib-common"))
implementation(compose.runtime)
implementation(project(":lib"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0-RC")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ kotlin {
dependencies {
implementation(kotlin("stdlib-common"))
implementation(compose.runtime)
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0-RC")
}
}
}
Expand Down
1 change: 1 addition & 0 deletions html/core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ kotlin {
val commonMain by getting {
dependencies {
implementation(compose.runtime)
implementation(libs.kotlinx.coroutines.core)
}
}

Expand Down
4 changes: 2 additions & 2 deletions html/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
compose.version=1.5.1
compose.version=1.6.0-alpha01
compose.web.buildSamples=false
compose.web.tests.integration.withFirefox
compose.web.tests.skip.benchmarks=false
org.gradle.jvmargs=-Xmx8g

# TODO: figure out why jvmTest (web driver tests) fail with timeout with kotlin 1.9.0
integrationTestsEnabled=false
integrationTestsEnabled=false
2 changes: 1 addition & 1 deletion html/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 1 addition & 0 deletions html/integration-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ kotlin {
implementation(compose.runtime)
implementation(project(":html-core"))
implementation(kotlin("stdlib-common"))
implementation(libs.kotlinx.coroutines.core)
}
}

Expand Down
1 change: 1 addition & 0 deletions html/internal-html-core-runtime/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ kotlin {
val commonMain by getting {
dependencies {
implementation(compose.runtime)
implementation(libs.kotlinx.coroutines.core)
}
}

Expand Down
Loading

0 comments on commit 93b5134

Please sign in to comment.