Remove 'kotlin2js' Gradle plugin
Plugin class is still left untouched as it is used by js platform old plugin. ^KT-48276 Fixed
This commit is contained in:
-4
@@ -50,9 +50,6 @@ internal val DEFAULT_GROOVY_SETTINGS_FILE =
|
||||
case "com.android.feature":
|
||||
useModule("com.android.tools.build:gradle:${'$'}android_tools_version")
|
||||
break
|
||||
case "kotlin2js":
|
||||
useModule("org.jetbrains.kotlin:kotlin-gradle-plugin:${'$'}kotlin_version")
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -103,7 +100,6 @@ internal val DEFAULT_KOTLIN_SETTINGS_FILE =
|
||||
"com.android.lint",
|
||||
"com.android.instantapp",
|
||||
"com.android.feature" -> useModule("com.android.tools.build:gradle:${'$'}android_tools_version")
|
||||
"kotlin2js" -> useModule("org.jetbrains.kotlin:kotlin-gradle-plugin:${'$'}kotlin_version")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
apply plugin: 'kotlin2js'
|
||||
apply plugin: 'org.jetbrains.kotlin.platform.js'
|
||||
|
||||
dependencies {
|
||||
implementation project(':lib')
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
apply plugin: 'kotlin2js'
|
||||
apply plugin: 'org.jetbrains.kotlin.platform.js'
|
||||
|
||||
dependencies {
|
||||
// do not remove until KT-25488 is fixed
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
apply plugin: 'kotlin2js'
|
||||
apply plugin: 'org.jetbrains.kotlin.platform.js'
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
apply plugin: 'kotlin2js'
|
||||
apply plugin: 'org.jetbrains.kotlin.platform.js'
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'kotlin2js'
|
||||
apply plugin: 'org.jetbrains.kotlin.platform.js'
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
|
||||
+5
-2
@@ -9,8 +9,11 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: "kotlin2js"
|
||||
apply plugin: 'java'
|
||||
plugins {
|
||||
id 'java'
|
||||
}
|
||||
|
||||
apply plugin: 'org.jetbrains.kotlin.platform.js'
|
||||
|
||||
def outDir = "${buildDir}/kotlin2js/main/"
|
||||
compileKotlin2Js.kotlinOptions.moduleKind = "plain"
|
||||
|
||||
+5
-2
@@ -9,8 +9,11 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: "kotlin2js"
|
||||
apply plugin: 'java'
|
||||
plugins {
|
||||
id 'java'
|
||||
}
|
||||
|
||||
apply plugin: 'org.jetbrains.kotlin.platform.js'
|
||||
|
||||
def outDir = "${buildDir}/kotlin2js/main/"
|
||||
compileKotlin2Js.kotlinOptions.moduleKind = "amd"
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: "kotlin2js"
|
||||
apply plugin: "org.jetbrains.kotlin.platform.js"
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'kotlin2js'
|
||||
apply plugin: 'org.jetbrains.kotlin.platform.js'
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: "kotlin2js"
|
||||
apply plugin: 'org.jetbrains.kotlin.platform.js'
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'kotlin2js'
|
||||
apply plugin: 'org.jetbrains.kotlin.platform.js'
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ buildscript {
|
||||
}
|
||||
|
||||
allprojects {
|
||||
apply plugin: 'kotlin2js'
|
||||
plugins.apply('org.jetbrains.kotlin.platform.js')
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'kotlin2js'
|
||||
apply plugin: 'org.jetbrains.kotlin.platform.js'
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
|
||||
+12
-1
@@ -1,8 +1,19 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "kotlin2js"
|
||||
id "maven-publish"
|
||||
}
|
||||
|
||||
apply plugin: 'org.jetbrains.kotlin.platform.js'
|
||||
|
||||
group = "com.example"
|
||||
version = "1.0"
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
apply plugin: 'kotlin2js'
|
||||
apply plugin: 'org.jetbrains.kotlin.platform.js'
|
||||
|
||||
dependencies {
|
||||
implementation 'com.example:sample-lib:1.0'
|
||||
|
||||
@@ -87,12 +87,14 @@ afterEvaluate {
|
||||
// compileDebugKotlin.noStdlib == false
|
||||
```
|
||||
|
||||
### kotlin2js
|
||||
### Kotlin/JS
|
||||
|
||||
How to apply:
|
||||
|
||||
```
|
||||
apply plugin: 'kotlin2js'
|
||||
plugins {
|
||||
id 'org.jetbrains.kotlin.js'
|
||||
}
|
||||
```
|
||||
|
||||
Tasks:
|
||||
@@ -106,7 +108,7 @@ Tasks:
|
||||
Each [KotlinJsCompile] task provides `kotlinOptions` ([KotlinJsOptions]) extension:
|
||||
|
||||
```
|
||||
compileKotlin2Js {
|
||||
compileKotlinJs {
|
||||
kotlinOptions {
|
||||
noStdlib = true
|
||||
}
|
||||
|
||||
+1
@@ -279,6 +279,7 @@ open class KotlinPlatformJvmPlugin : KotlinPlatformImplementationPluginBase("jvm
|
||||
|
||||
open class KotlinPlatformJsPlugin : KotlinPlatformImplementationPluginBase("js") {
|
||||
override fun apply(project: Project) {
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
project.applyPlugin<Kotlin2JsPluginWrapper>()
|
||||
super.apply(project)
|
||||
}
|
||||
|
||||
+4
-5
@@ -39,7 +39,6 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.isMainCompilationData
|
||||
import org.jetbrains.kotlin.gradle.scripting.internal.ScriptingGradleSubplugin
|
||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryMode
|
||||
import org.jetbrains.kotlin.gradle.targets.js.ir.*
|
||||
import org.jetbrains.kotlin.gradle.targets.js.jsPluginDeprecationMessage
|
||||
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
|
||||
import org.jetbrains.kotlin.gradle.tasks.*
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
@@ -693,13 +692,16 @@ internal open class KotlinCommonPlugin(
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated(
|
||||
message = "Should be removed with Js platform plugin",
|
||||
level = DeprecationLevel.ERROR
|
||||
)
|
||||
internal open class Kotlin2JsPlugin(
|
||||
registry: ToolingModelBuilderRegistry
|
||||
) : AbstractKotlinPlugin(KotlinTasksProvider(), registry) {
|
||||
|
||||
companion object {
|
||||
private const val targetName = "2Js"
|
||||
internal const val NOWARN_2JS_FLAG = "kotlin.2js.nowarn"
|
||||
}
|
||||
|
||||
override fun buildSourceSetProcessor(
|
||||
@@ -709,9 +711,6 @@ internal open class Kotlin2JsPlugin(
|
||||
Kotlin2JsSourceSetProcessor(tasksProvider, compilation)
|
||||
|
||||
override fun apply(project: Project) {
|
||||
if (!PropertiesProvider(project).noWarn2JsPlugin) {
|
||||
project.logger.warn(jsPluginDeprecationMessage("kotlin2js"))
|
||||
}
|
||||
val target = KotlinWithJavaTarget<KotlinJsOptions>(project, KotlinPlatformType.js, targetName, { KotlinJsOptionsImpl() })
|
||||
|
||||
(project.kotlinExtension as Kotlin2JsProjectExtension).target = target
|
||||
|
||||
+6
@@ -199,9 +199,15 @@ open class KotlinAndroidPluginWrapper @Inject constructor(
|
||||
get() = KotlinAndroidProjectExtension::class
|
||||
}
|
||||
|
||||
@Deprecated(
|
||||
message = "Should be removed with JS platform plugin",
|
||||
level = DeprecationLevel.ERROR
|
||||
)
|
||||
open class Kotlin2JsPluginWrapper @Inject constructor(
|
||||
protected val registry: ToolingModelBuilderRegistry
|
||||
) : KotlinBasePluginWrapper() {
|
||||
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
override fun getPlugin(project: Project): Plugin<Project> =
|
||||
Kotlin2JsPlugin(registry)
|
||||
|
||||
|
||||
-4
@@ -10,7 +10,6 @@ import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
|
||||
import org.jetbrains.kotlin.cli.common.toBooleanLenient
|
||||
import org.jetbrains.kotlin.gradle.dsl.NativeCacheKind
|
||||
import org.jetbrains.kotlin.gradle.internal.testing.TCServiceMessageOutputStreamHandler.Companion.IGNORE_TCSM_OVERFLOW
|
||||
import org.jetbrains.kotlin.gradle.plugin.Kotlin2JsPlugin.Companion.NOWARN_2JS_FLAG
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType.Companion.jsCompilerProperty
|
||||
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_ABI_SNAPSHOT
|
||||
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_MPP_ENABLE_CINTEROP_COMMONIZATION
|
||||
@@ -418,9 +417,6 @@ internal class PropertiesProvider private constructor(private val project: Proje
|
||||
?.report(StringMetrics.JS_GENERATE_EXECUTABLE_DEFAULT, it.toString())
|
||||
}
|
||||
|
||||
val noWarn2JsPlugin: Boolean
|
||||
get() = booleanProperty(NOWARN_2JS_FLAG) ?: false
|
||||
|
||||
val stdlibDefaultDependency: Boolean
|
||||
get() = booleanProperty(KOTLIN_STDLIB_DEFAULT_DEPENDENCY) ?: true
|
||||
|
||||
|
||||
+1
-11
@@ -24,10 +24,6 @@ open class KotlinJsPlugin(
|
||||
) : Plugin<Project> {
|
||||
|
||||
override fun apply(project: Project) {
|
||||
project.pluginManager.withPlugin("org.jetbrains.kotlin.frontend") {
|
||||
project.logger.warn(jsPluginDeprecationMessage("org.jetbrains.kotlin.frontend"))
|
||||
}
|
||||
|
||||
project.setupGeneralKotlinExtensionParameters()
|
||||
|
||||
// TODO get rid of this plugin, too? Use the 'base' plugin instead?
|
||||
@@ -47,6 +43,7 @@ open class KotlinJsPlugin(
|
||||
}
|
||||
|
||||
project.runProjectConfigurationHealthCheckWhenEvaluated {
|
||||
@Suppress("DEPRECATION")
|
||||
if (kotlinExtension._target == null) {
|
||||
project.logger.warn(
|
||||
"""
|
||||
@@ -91,10 +88,3 @@ open class KotlinJsPlugin(
|
||||
kotlinExtension.sourceSets.maybeCreate(TEST_COMPILATION_NAME)
|
||||
}
|
||||
}
|
||||
|
||||
internal fun jsPluginDeprecationMessage(id: String): String =
|
||||
"""
|
||||
The `$id` Gradle plugin has been deprecated.
|
||||
Please use `org.jetbrains.kotlin.js` plugin instead `kotlin2js` and `org.jetbrains.kotlin.frontend`
|
||||
For usage details, see https://kotlinlang.org/docs/reference/js-project-setup.html
|
||||
""".trimIndent()
|
||||
|
||||
-1
@@ -1 +0,0 @@
|
||||
implementation-class=org.jetbrains.kotlin.gradle.plugin.Kotlin2JsPluginWrapper
|
||||
Reference in New Issue
Block a user