Browse Source
Resolves #352
The fix resolves the issue only for Kotlin compiler builds the following commit:
d023f09bd4
See also https://youtrack.jetbrains.com/issue/KT-45020
pull/501/head
Alexey Tsvetkov
4 years ago
committed by
Alexey Tsvetkov
13 changed files with 127 additions and 18 deletions
@ -0,0 +1,23 @@ |
|||||||
|
package org.jetbrains.compose |
||||||
|
|
||||||
|
import org.gradle.api.provider.Provider |
||||||
|
import org.jetbrains.kotlin.gradle.plugin.* |
||||||
|
|
||||||
|
class ComposeCompilerKotlinSupportPlugin : KotlinCompilerPluginSupportPlugin { |
||||||
|
override fun getCompilerPluginId(): String = |
||||||
|
"org.jetbrains.compose" |
||||||
|
|
||||||
|
override fun isApplicable(kotlinCompilation: KotlinCompilation<*>): Boolean { |
||||||
|
val targetPlatform = kotlinCompilation.target.platformType |
||||||
|
return targetPlatform != KotlinPlatformType.js |
||||||
|
&& targetPlatform != KotlinPlatformType.native |
||||||
|
} |
||||||
|
|
||||||
|
override fun applyToCompilation(kotlinCompilation: KotlinCompilation<*>): Provider<List<SubpluginOption>> = |
||||||
|
kotlinCompilation.target.project.provider { emptyList() } |
||||||
|
|
||||||
|
override fun getPluginArtifact(): SubpluginArtifact = |
||||||
|
SubpluginArtifact( |
||||||
|
groupId = "org.jetbrains.compose.compiler", artifactId = "compiler", version = composeVersion |
||||||
|
) |
||||||
|
} |
@ -0,0 +1,23 @@ |
|||||||
|
package org.jetbrains.compose |
||||||
|
|
||||||
|
import org.gradle.testkit.runner.TaskOutcome |
||||||
|
import org.jetbrains.compose.test.GradlePluginTestBase |
||||||
|
import org.jetbrains.compose.test.TestKotlinVersion |
||||||
|
import org.jetbrains.compose.test.TestProjects |
||||||
|
import org.jetbrains.compose.test.checks |
||||||
|
import org.junit.jupiter.api.Test |
||||||
|
|
||||||
|
class GradlePluginTest : GradlePluginTestBase() { |
||||||
|
@Test |
||||||
|
fun jsMppIsNotBroken() = |
||||||
|
with( |
||||||
|
testProject( |
||||||
|
TestProjects.jsMpp, |
||||||
|
testEnvironment = defaultTestEnvironment.copy(kotlinVersion = TestKotlinVersion.V1_5_20_dev_3226) |
||||||
|
) |
||||||
|
) { |
||||||
|
gradle(":compileKotlinJs").build().checks { check -> |
||||||
|
check.taskOutcome(":compileKotlinJs", TaskOutcome.SUCCESS) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,8 @@ |
|||||||
|
package org.jetbrains.compose.test |
||||||
|
|
||||||
|
@Suppress("EnumEntryName") |
||||||
|
enum class TestKotlinVersion(val versionString: String) { |
||||||
|
// __KOTLIN_COMPOSE_VERSION__ |
||||||
|
Default("1.4.31"), |
||||||
|
V1_5_20_dev_3226("1.5.20-dev-3226") |
||||||
|
} |
@ -0,0 +1,33 @@ |
|||||||
|
import org.jetbrains.compose.desktop.application.dsl.TargetFormat |
||||||
|
|
||||||
|
plugins { |
||||||
|
id "org.jetbrains.kotlin.multiplatform" |
||||||
|
id "org.jetbrains.compose" |
||||||
|
} |
||||||
|
|
||||||
|
repositories { |
||||||
|
google() |
||||||
|
mavenCentral() |
||||||
|
jcenter() |
||||||
|
maven { url "https://maven.pkg.jetbrains.space/public/p/compose/dev" } |
||||||
|
maven { url "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev" } |
||||||
|
} |
||||||
|
|
||||||
|
kotlin { |
||||||
|
js(IR) { |
||||||
|
browser() |
||||||
|
} |
||||||
|
jvm {} |
||||||
|
|
||||||
|
sourceSets { |
||||||
|
named("commonMain") { |
||||||
|
} |
||||||
|
named("jsMain") { |
||||||
|
} |
||||||
|
named("jvmMain") { |
||||||
|
dependencies { |
||||||
|
implementation(compose.desktop.currentOs) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,12 @@ |
|||||||
|
pluginManagement { |
||||||
|
plugins { |
||||||
|
id 'org.jetbrains.kotlin.multiplatform' version 'KOTLIN_VERSION_PLACEHOLDER' |
||||||
|
id 'org.jetbrains.compose' version 'COMPOSE_VERSION_PLACEHOLDER' |
||||||
|
} |
||||||
|
repositories { |
||||||
|
mavenLocal() |
||||||
|
gradlePluginPortal() |
||||||
|
maven { url "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev" } |
||||||
|
} |
||||||
|
} |
||||||
|
rootProject.name = "jsMpp" |
@ -0,0 +1 @@ |
|||||||
|
expect fun getPlatformName(): String |
@ -0,0 +1 @@ |
|||||||
|
actual fun getPlatformName(): String = "js" |
Loading…
Reference in new issue