Skip to content

Commit

Permalink
Remove cast to KotlinJvmTarget for all targets of type jvm (#3592)
Browse files Browse the repository at this point in the history
The new android multiplatform plugin will have type `jvm` but doesn't
inherit from the KotlinJvmTarget type, which makes the compose
multiplatform gradle plugin not useable with the new android gradle
plugin for multiplatforms builds.
  • Loading branch information
AmrAfifiy committed Sep 5, 2023
1 parent eb5cf4f commit 8799277
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@ import org.jetbrains.compose.desktop.application.internal.JvmApplicationRuntimeF
import org.jetbrains.compose.desktop.preview.tasks.AbstractConfigureDesktopPreviewTask
import org.jetbrains.compose.internal.*
import org.jetbrains.compose.internal.utils.uppercaseFirstChar
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget

fun Project.initializePreview(desktopExtension: DesktopExtension) {
plugins.withId(KOTLIN_MPP_PLUGIN_ID) {
mppExt.targets.all { target ->
if (target.platformType == KotlinPlatformType.jvm) {
val runtimeFilesProvider = JvmApplicationRuntimeFilesProvider.FromKotlinMppTarget(target as KotlinJvmTarget)
registerConfigurePreviewTask(project, runtimeFilesProvider, targetName = target.name)
}
mppExt.targets.withType(KotlinJvmTarget::class.java) { target ->
val runtimeFilesProvider = JvmApplicationRuntimeFilesProvider.FromKotlinMppTarget(target)
registerConfigurePreviewTask(project, runtimeFilesProvider, targetName = target.name)
}
}
plugins.withId(KOTLIN_JVM_PLUGIN_ID) {
Expand Down

0 comments on commit 8799277

Please sign in to comment.