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":
|
case "com.android.feature":
|
||||||
useModule("com.android.tools.build:gradle:${'$'}android_tools_version")
|
useModule("com.android.tools.build:gradle:${'$'}android_tools_version")
|
||||||
break
|
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.lint",
|
||||||
"com.android.instantapp",
|
"com.android.instantapp",
|
||||||
"com.android.feature" -> useModule("com.android.tools.build:gradle:${'$'}android_tools_version")
|
"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 {
|
dependencies {
|
||||||
implementation project(':lib')
|
implementation project(':lib')
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
apply plugin: 'kotlin2js'
|
apply plugin: 'org.jetbrains.kotlin.platform.js'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// do not remove until KT-25488 is fixed
|
// 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 {
|
dependencies {
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
|
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 {
|
dependencies {
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
|
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 {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
|
|||||||
+5
-2
@@ -9,8 +9,11 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: "kotlin2js"
|
plugins {
|
||||||
apply plugin: 'java'
|
id 'java'
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'org.jetbrains.kotlin.platform.js'
|
||||||
|
|
||||||
def outDir = "${buildDir}/kotlin2js/main/"
|
def outDir = "${buildDir}/kotlin2js/main/"
|
||||||
compileKotlin2Js.kotlinOptions.moduleKind = "plain"
|
compileKotlin2Js.kotlinOptions.moduleKind = "plain"
|
||||||
|
|||||||
+5
-2
@@ -9,8 +9,11 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: "kotlin2js"
|
plugins {
|
||||||
apply plugin: 'java'
|
id 'java'
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'org.jetbrains.kotlin.platform.js'
|
||||||
|
|
||||||
def outDir = "${buildDir}/kotlin2js/main/"
|
def outDir = "${buildDir}/kotlin2js/main/"
|
||||||
compileKotlin2Js.kotlinOptions.moduleKind = "amd"
|
compileKotlin2Js.kotlinOptions.moduleKind = "amd"
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: "kotlin2js"
|
apply plugin: "org.jetbrains.kotlin.platform.js"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'kotlin2js'
|
apply plugin: 'org.jetbrains.kotlin.platform.js'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: "kotlin2js"
|
apply plugin: 'org.jetbrains.kotlin.platform.js'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'kotlin2js'
|
apply plugin: 'org.jetbrains.kotlin.platform.js'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
apply plugin: 'kotlin2js'
|
plugins.apply('org.jetbrains.kotlin.platform.js')
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'kotlin2js'
|
apply plugin: 'org.jetbrains.kotlin.platform.js'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
|
|||||||
+12
-1
@@ -1,8 +1,19 @@
|
|||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id "kotlin2js"
|
|
||||||
id "maven-publish"
|
id "maven-publish"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
apply plugin: 'org.jetbrains.kotlin.platform.js'
|
||||||
|
|
||||||
group = "com.example"
|
group = "com.example"
|
||||||
version = "1.0"
|
version = "1.0"
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
apply plugin: 'kotlin2js'
|
apply plugin: 'org.jetbrains.kotlin.platform.js'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.example:sample-lib:1.0'
|
implementation 'com.example:sample-lib:1.0'
|
||||||
|
|||||||
@@ -87,12 +87,14 @@ afterEvaluate {
|
|||||||
// compileDebugKotlin.noStdlib == false
|
// compileDebugKotlin.noStdlib == false
|
||||||
```
|
```
|
||||||
|
|
||||||
### kotlin2js
|
### Kotlin/JS
|
||||||
|
|
||||||
How to apply:
|
How to apply:
|
||||||
|
|
||||||
```
|
```
|
||||||
apply plugin: 'kotlin2js'
|
plugins {
|
||||||
|
id 'org.jetbrains.kotlin.js'
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Tasks:
|
Tasks:
|
||||||
@@ -106,7 +108,7 @@ Tasks:
|
|||||||
Each [KotlinJsCompile] task provides `kotlinOptions` ([KotlinJsOptions]) extension:
|
Each [KotlinJsCompile] task provides `kotlinOptions` ([KotlinJsOptions]) extension:
|
||||||
|
|
||||||
```
|
```
|
||||||
compileKotlin2Js {
|
compileKotlinJs {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
noStdlib = true
|
noStdlib = true
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -279,6 +279,7 @@ open class KotlinPlatformJvmPlugin : KotlinPlatformImplementationPluginBase("jvm
|
|||||||
|
|
||||||
open class KotlinPlatformJsPlugin : KotlinPlatformImplementationPluginBase("js") {
|
open class KotlinPlatformJsPlugin : KotlinPlatformImplementationPluginBase("js") {
|
||||||
override fun apply(project: Project) {
|
override fun apply(project: Project) {
|
||||||
|
@Suppress("DEPRECATION_ERROR")
|
||||||
project.applyPlugin<Kotlin2JsPluginWrapper>()
|
project.applyPlugin<Kotlin2JsPluginWrapper>()
|
||||||
super.apply(project)
|
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.scripting.internal.ScriptingGradleSubplugin
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryMode
|
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryMode
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.ir.*
|
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.targets.jvm.KotlinJvmTarget
|
||||||
import org.jetbrains.kotlin.gradle.tasks.*
|
import org.jetbrains.kotlin.gradle.tasks.*
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
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(
|
internal open class Kotlin2JsPlugin(
|
||||||
registry: ToolingModelBuilderRegistry
|
registry: ToolingModelBuilderRegistry
|
||||||
) : AbstractKotlinPlugin(KotlinTasksProvider(), registry) {
|
) : AbstractKotlinPlugin(KotlinTasksProvider(), registry) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val targetName = "2Js"
|
private const val targetName = "2Js"
|
||||||
internal const val NOWARN_2JS_FLAG = "kotlin.2js.nowarn"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun buildSourceSetProcessor(
|
override fun buildSourceSetProcessor(
|
||||||
@@ -709,9 +711,6 @@ internal open class Kotlin2JsPlugin(
|
|||||||
Kotlin2JsSourceSetProcessor(tasksProvider, compilation)
|
Kotlin2JsSourceSetProcessor(tasksProvider, compilation)
|
||||||
|
|
||||||
override fun apply(project: Project) {
|
override fun apply(project: Project) {
|
||||||
if (!PropertiesProvider(project).noWarn2JsPlugin) {
|
|
||||||
project.logger.warn(jsPluginDeprecationMessage("kotlin2js"))
|
|
||||||
}
|
|
||||||
val target = KotlinWithJavaTarget<KotlinJsOptions>(project, KotlinPlatformType.js, targetName, { KotlinJsOptionsImpl() })
|
val target = KotlinWithJavaTarget<KotlinJsOptions>(project, KotlinPlatformType.js, targetName, { KotlinJsOptionsImpl() })
|
||||||
|
|
||||||
(project.kotlinExtension as Kotlin2JsProjectExtension).target = target
|
(project.kotlinExtension as Kotlin2JsProjectExtension).target = target
|
||||||
|
|||||||
+6
@@ -199,9 +199,15 @@ open class KotlinAndroidPluginWrapper @Inject constructor(
|
|||||||
get() = KotlinAndroidProjectExtension::class
|
get() = KotlinAndroidProjectExtension::class
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated(
|
||||||
|
message = "Should be removed with JS platform plugin",
|
||||||
|
level = DeprecationLevel.ERROR
|
||||||
|
)
|
||||||
open class Kotlin2JsPluginWrapper @Inject constructor(
|
open class Kotlin2JsPluginWrapper @Inject constructor(
|
||||||
protected val registry: ToolingModelBuilderRegistry
|
protected val registry: ToolingModelBuilderRegistry
|
||||||
) : KotlinBasePluginWrapper() {
|
) : KotlinBasePluginWrapper() {
|
||||||
|
|
||||||
|
@Suppress("DEPRECATION_ERROR")
|
||||||
override fun getPlugin(project: Project): Plugin<Project> =
|
override fun getPlugin(project: Project): Plugin<Project> =
|
||||||
Kotlin2JsPlugin(registry)
|
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.cli.common.toBooleanLenient
|
||||||
import org.jetbrains.kotlin.gradle.dsl.NativeCacheKind
|
import org.jetbrains.kotlin.gradle.dsl.NativeCacheKind
|
||||||
import org.jetbrains.kotlin.gradle.internal.testing.TCServiceMessageOutputStreamHandler.Companion.IGNORE_TCSM_OVERFLOW
|
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.KotlinJsCompilerType.Companion.jsCompilerProperty
|
||||||
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_ABI_SNAPSHOT
|
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_ABI_SNAPSHOT
|
||||||
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_MPP_ENABLE_CINTEROP_COMMONIZATION
|
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())
|
?.report(StringMetrics.JS_GENERATE_EXECUTABLE_DEFAULT, it.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
val noWarn2JsPlugin: Boolean
|
|
||||||
get() = booleanProperty(NOWARN_2JS_FLAG) ?: false
|
|
||||||
|
|
||||||
val stdlibDefaultDependency: Boolean
|
val stdlibDefaultDependency: Boolean
|
||||||
get() = booleanProperty(KOTLIN_STDLIB_DEFAULT_DEPENDENCY) ?: true
|
get() = booleanProperty(KOTLIN_STDLIB_DEFAULT_DEPENDENCY) ?: true
|
||||||
|
|
||||||
|
|||||||
+1
-11
@@ -24,10 +24,6 @@ open class KotlinJsPlugin(
|
|||||||
) : Plugin<Project> {
|
) : Plugin<Project> {
|
||||||
|
|
||||||
override fun apply(project: Project) {
|
override fun apply(project: Project) {
|
||||||
project.pluginManager.withPlugin("org.jetbrains.kotlin.frontend") {
|
|
||||||
project.logger.warn(jsPluginDeprecationMessage("org.jetbrains.kotlin.frontend"))
|
|
||||||
}
|
|
||||||
|
|
||||||
project.setupGeneralKotlinExtensionParameters()
|
project.setupGeneralKotlinExtensionParameters()
|
||||||
|
|
||||||
// TODO get rid of this plugin, too? Use the 'base' plugin instead?
|
// TODO get rid of this plugin, too? Use the 'base' plugin instead?
|
||||||
@@ -47,6 +43,7 @@ open class KotlinJsPlugin(
|
|||||||
}
|
}
|
||||||
|
|
||||||
project.runProjectConfigurationHealthCheckWhenEvaluated {
|
project.runProjectConfigurationHealthCheckWhenEvaluated {
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
if (kotlinExtension._target == null) {
|
if (kotlinExtension._target == null) {
|
||||||
project.logger.warn(
|
project.logger.warn(
|
||||||
"""
|
"""
|
||||||
@@ -91,10 +88,3 @@ open class KotlinJsPlugin(
|
|||||||
kotlinExtension.sourceSets.maybeCreate(TEST_COMPILATION_NAME)
|
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