Browse Source

Add `checkAndWarnAboutUsingJsPlugin` to gradle plugin (#1753)

* Add `checkAndWarnAboutUsingJsPlugin` to gradle plugin

closes #1693

* PR review improvements

Co-authored-by: Oleksandr Karpovich <oleksandr.karpovich@jetbrains.com>
pull/1757/head
Oleksandr Karpovich 3 years ago committed by GitHub
parent
commit
fb715e6061
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt
  2. 2
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/constants.kt

14
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt

@ -25,6 +25,9 @@ import org.jetbrains.compose.desktop.application.internal.currentTarget
import org.jetbrains.compose.desktop.preview.internal.initializePreview import org.jetbrains.compose.desktop.preview.internal.initializePreview
import org.jetbrains.compose.experimental.dsl.ExperimentalExtension import org.jetbrains.compose.experimental.dsl.ExperimentalExtension
import org.jetbrains.compose.experimental.internal.configureExperimental import org.jetbrains.compose.experimental.internal.configureExperimental
import org.jetbrains.compose.internal.COMPOSE_PLUGIN_ID
import org.jetbrains.compose.internal.KOTLIN_JS_PLUGIN_ID
import org.jetbrains.compose.internal.KOTLIN_MPP_PLUGIN_ID
import org.jetbrains.compose.web.WebExtension import org.jetbrains.compose.web.WebExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
@ -134,6 +137,17 @@ class ComposePlugin : Plugin<Project> {
} }
} }
} }
checkAndWarnAboutUsingJsPlugin(project)
}
private fun checkAndWarnAboutUsingJsPlugin(project: Project) {
val msg = "'$COMPOSE_PLUGIN_ID' plugin is not compatible with '$KOTLIN_JS_PLUGIN_ID' plugin. " +
"Use '$KOTLIN_MPP_PLUGIN_ID' instead"
project.plugins.withId(KOTLIN_JS_PLUGIN_ID) {
project.logger.error(msg)
}
} }
class RedirectAndroidVariants : ComponentMetadataRule { class RedirectAndroidVariants : ComponentMetadataRule {

2
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/constants.kt

@ -7,3 +7,5 @@ package org.jetbrains.compose.internal
internal const val KOTLIN_MPP_PLUGIN_ID = "org.jetbrains.kotlin.multiplatform" internal const val KOTLIN_MPP_PLUGIN_ID = "org.jetbrains.kotlin.multiplatform"
internal const val KOTLIN_JVM_PLUGIN_ID = "org.jetbrains.kotlin.jvm" internal const val KOTLIN_JVM_PLUGIN_ID = "org.jetbrains.kotlin.jvm"
internal const val KOTLIN_JS_PLUGIN_ID = "org.jetbrains.kotlin.js"
internal const val COMPOSE_PLUGIN_ID = "org.jetbrains.compose"

Loading…
Cancel
Save