Fix ComposeExtension.kotlinCompilerPluginArgs for non-jvm compilations (#2716)

This commit is contained in:
Oleksandr Karpovich
2023-02-08 10:20:10 +01:00
committed by GitHub
parent 16bcc34b68
commit e9789ba364
6 changed files with 39 additions and 9 deletions

View File

@@ -28,7 +28,7 @@ import org.jetbrains.compose.internal.utils.currentTarget
import org.jetbrains.compose.web.WebExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler
import org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.dsl.KotlinCompile
internal val composeVersion get() = ComposeBuildConfig.composeVersion

View File

@@ -97,9 +97,9 @@ class DesktopApplicationTest : GradlePluginTestBase() {
composeCompilerPlugin = "dependencies.compiler.forKotlin(\"1.7.20\")",
composeCompilerArgs = "\"suppressKotlinVersionCompatibilityCheck=1.7.21\""
)
).checkCustomComposeCompiler()
).checkCustomComposeCompiler(checkKJS = true)
private fun TestProject.checkCustomComposeCompiler() {
private fun TestProject.checkCustomComposeCompiler(checkKJS: Boolean = false) {
gradle(":runDistributable").checks {
val actualMainImage = file("main-image.actual.png")
val expectedMainImage = file("main-image.expected.png")
@@ -107,6 +107,11 @@ class DesktopApplicationTest : GradlePluginTestBase() {
"The actual image '$actualMainImage' does not match the expected image '$expectedMainImage'"
}
}
if (checkKJS) {
gradle(":jsBrowserProductionWebpack").checks {
check.taskSuccessful(":jsBrowserProductionWebpack")
}
}
}
@Test

View File

@@ -2,7 +2,7 @@ import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins {
id "org.jetbrains.kotlin.jvm"
id "org.jetbrains.kotlin.multiplatform"
id "org.jetbrains.compose"
}
@@ -11,9 +11,27 @@ repositories {
jetbrainsCompose()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib"
implementation compose.desktop.currentOs
kotlin {
jvm("desktop")
js(IR) {
browser()
binaries.executable()
}
sourceSets {
desktopMain {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib"
implementation compose.desktop.currentOs
}
}
jsMain {
dependencies {
implementation compose.runtime
implementation compose.web.core
}
}
}
}
compose {

View File

@@ -1,6 +1,6 @@
pluginManagement {
plugins {
id 'org.jetbrains.kotlin.jvm' version 'KOTLIN_VERSION_PLACEHOLDER'
id 'org.jetbrains.kotlin.multiplatform' version 'KOTLIN_VERSION_PLACEHOLDER'
id 'org.jetbrains.compose' version 'COMPOSE_GRADLE_PLUGIN_VERSION_PLACEHOLDER'
}
repositories {
@@ -8,4 +8,4 @@ pluginManagement {
gradlePluginPortal()
}
}
rootProject.name = "simple"
rootProject.name = "simple"

View File

@@ -0,0 +1,7 @@
import org.jetbrains.compose.web.*
import org.jetbrains.compose.web.dom.*
fun main() {
renderComposableInBody {
Div { }
}
}