diff --git a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt index fd69948933..726483f702 100644 --- a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt +++ b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt @@ -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 diff --git a/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/tests/integration/DesktopApplicationTest.kt b/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/tests/integration/DesktopApplicationTest.kt index a65c398452..fb25d164d6 100644 --- a/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/tests/integration/DesktopApplicationTest.kt +++ b/gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/tests/integration/DesktopApplicationTest.kt @@ -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 diff --git a/gradle-plugins/compose/src/test/test-projects/application/custom-compiler-args/build.gradle b/gradle-plugins/compose/src/test/test-projects/application/custom-compiler-args/build.gradle index 7427f86df8..a802d1ec06 100644 --- a/gradle-plugins/compose/src/test/test-projects/application/custom-compiler-args/build.gradle +++ b/gradle-plugins/compose/src/test/test-projects/application/custom-compiler-args/build.gradle @@ -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 { diff --git a/gradle-plugins/compose/src/test/test-projects/application/custom-compiler-args/settings.gradle b/gradle-plugins/compose/src/test/test-projects/application/custom-compiler-args/settings.gradle index 43d540efb8..ae2468d612 100644 --- a/gradle-plugins/compose/src/test/test-projects/application/custom-compiler-args/settings.gradle +++ b/gradle-plugins/compose/src/test/test-projects/application/custom-compiler-args/settings.gradle @@ -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" \ No newline at end of file +rootProject.name = "simple" diff --git a/gradle-plugins/compose/src/test/test-projects/application/custom-compiler-args/src/main/kotlin/Main.kt b/gradle-plugins/compose/src/test/test-projects/application/custom-compiler-args/src/desktopMain/kotlin/Main.kt similarity index 100% rename from gradle-plugins/compose/src/test/test-projects/application/custom-compiler-args/src/main/kotlin/Main.kt rename to gradle-plugins/compose/src/test/test-projects/application/custom-compiler-args/src/desktopMain/kotlin/Main.kt diff --git a/gradle-plugins/compose/src/test/test-projects/application/custom-compiler-args/src/jsMain/kotlin/Main.js.kt b/gradle-plugins/compose/src/test/test-projects/application/custom-compiler-args/src/jsMain/kotlin/Main.js.kt new file mode 100644 index 0000000000..0dfe5d88d7 --- /dev/null +++ b/gradle-plugins/compose/src/test/test-projects/application/custom-compiler-args/src/jsMain/kotlin/Main.js.kt @@ -0,0 +1,7 @@ +import org.jetbrains.compose.web.* +import org.jetbrains.compose.web.dom.* +fun main() { + renderComposableInBody { + Div { } + } +}