Browse Source

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

pull/2723/head
Oleksandr Karpovich 2 years ago committed by GitHub
parent
commit
e9789ba364
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt
  2. 9
      gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/tests/integration/DesktopApplicationTest.kt
  3. 26
      gradle-plugins/compose/src/test/test-projects/application/custom-compiler-args/build.gradle
  4. 4
      gradle-plugins/compose/src/test/test-projects/application/custom-compiler-args/settings.gradle
  5. 0
      gradle-plugins/compose/src/test/test-projects/application/custom-compiler-args/src/desktopMain/kotlin/Main.kt
  6. 7
      gradle-plugins/compose/src/test/test-projects/application/custom-compiler-args/src/jsMain/kotlin/Main.js.kt

2
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

9
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

26
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 {

4
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"
rootProject.name = "simple"

0
gradle-plugins/compose/src/test/test-projects/application/custom-compiler-args/src/main/kotlin/Main.kt → gradle-plugins/compose/src/test/test-projects/application/custom-compiler-args/src/desktopMain/kotlin/Main.kt

7
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 { }
}
}
Loading…
Cancel
Save