[Gradle, JS] Rename public KotlinJsCompilerType
This commit is contained in:
+4
-4
@@ -10,7 +10,7 @@ import java.io.Serializable
|
|||||||
|
|
||||||
// For Gradle attributes
|
// For Gradle attributes
|
||||||
@Suppress("EnumEntryName")
|
@Suppress("EnumEntryName")
|
||||||
enum class JsCompilerType : Named, Serializable {
|
enum class KotlinJsCompilerType : Named, Serializable {
|
||||||
legacy,
|
legacy,
|
||||||
ir,
|
ir,
|
||||||
both;
|
both;
|
||||||
@@ -24,13 +24,13 @@ enum class JsCompilerType : Named, Serializable {
|
|||||||
companion object {
|
companion object {
|
||||||
const val jsCompilerProperty = "kotlin.js.compiler"
|
const val jsCompilerProperty = "kotlin.js.compiler"
|
||||||
|
|
||||||
fun byArgument(argument: String): JsCompilerType? =
|
fun byArgument(argument: String): KotlinJsCompilerType? =
|
||||||
JsCompilerType
|
KotlinJsCompilerType
|
||||||
.values().firstOrNull { it.name.equals(argument, ignoreCase = true) }
|
.values().firstOrNull { it.name.equals(argument, ignoreCase = true) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun String.removeJsCompilerSuffix(compilerType: JsCompilerType): String {
|
fun String.removeJsCompilerSuffix(compilerType: KotlinJsCompilerType): String {
|
||||||
val truncatedString = removeSuffix(compilerType.name)
|
val truncatedString = removeSuffix(compilerType.name)
|
||||||
if (this != truncatedString) {
|
if (this != truncatedString) {
|
||||||
return truncatedString
|
return truncatedString
|
||||||
+1
-1
@@ -6,5 +6,5 @@
|
|||||||
package org.jetbrains.kotlin.gradle.plugin
|
package org.jetbrains.kotlin.gradle.plugin
|
||||||
|
|
||||||
interface KotlinJsCompilerTypeHolder {
|
interface KotlinJsCompilerTypeHolder {
|
||||||
val defaultJsCompilerType: JsCompilerType
|
val defaultJsCompilerType: KotlinJsCompilerType
|
||||||
}
|
}
|
||||||
+2
-2
@@ -11,7 +11,7 @@ import org.jdom.output.Format
|
|||||||
import org.jdom.output.XMLOutputter
|
import org.jdom.output.XMLOutputter
|
||||||
import org.jetbrains.kotlin.gradle.model.ModelContainer
|
import org.jetbrains.kotlin.gradle.model.ModelContainer
|
||||||
import org.jetbrains.kotlin.gradle.model.ModelFetcherBuildAction
|
import org.jetbrains.kotlin.gradle.model.ModelFetcherBuildAction
|
||||||
import org.jetbrains.kotlin.gradle.plugin.JsCompilerType
|
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType
|
||||||
import org.jetbrains.kotlin.gradle.util.*
|
import org.jetbrains.kotlin.gradle.util.*
|
||||||
import org.jetbrains.kotlin.test.util.trimTrailingWhitespaces
|
import org.jetbrains.kotlin.test.util.trimTrailingWhitespaces
|
||||||
import org.junit.After
|
import org.junit.After
|
||||||
@@ -212,7 +212,7 @@ abstract class BaseGradleIT {
|
|||||||
val withBuildCache: Boolean = false,
|
val withBuildCache: Boolean = false,
|
||||||
val kaptOptions: KaptOptions? = null,
|
val kaptOptions: KaptOptions? = null,
|
||||||
val parallelTasksInProject: Boolean? = null,
|
val parallelTasksInProject: Boolean? = null,
|
||||||
val jsCompilerType: JsCompilerType? = null
|
val jsCompilerType: KotlinJsCompilerType? = null
|
||||||
)
|
)
|
||||||
|
|
||||||
data class KaptOptions(val verbose: Boolean, val useWorkers: Boolean, val incrementalKapt: Boolean = false, val includeCompileClasspath: Boolean = true)
|
data class KaptOptions(val verbose: Boolean, val useWorkers: Boolean, val incrementalKapt: Boolean = false, val includeCompileClasspath: Boolean = true)
|
||||||
|
|||||||
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
package org.jetbrains.kotlin.gradle
|
package org.jetbrains.kotlin.gradle
|
||||||
|
|
||||||
import org.gradle.api.logging.LogLevel
|
import org.gradle.api.logging.LogLevel
|
||||||
import org.jetbrains.kotlin.gradle.plugin.JsCompilerType
|
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType
|
||||||
import org.jetbrains.kotlin.gradle.tasks.USING_JS_INCREMENTAL_COMPILATION_MESSAGE
|
import org.jetbrains.kotlin.gradle.tasks.USING_JS_INCREMENTAL_COMPILATION_MESSAGE
|
||||||
import org.jetbrains.kotlin.gradle.tasks.USING_JS_IR_BACKEND_MESSAGE
|
import org.jetbrains.kotlin.gradle.tasks.USING_JS_IR_BACKEND_MESSAGE
|
||||||
import org.jetbrains.kotlin.gradle.util.getFileByName
|
import org.jetbrains.kotlin.gradle.util.getFileByName
|
||||||
@@ -39,7 +39,7 @@ class Kotlin2JsIrGradlePluginIT : AbstractKotlin2JsGradlePluginIT(true) {
|
|||||||
|
|
||||||
build(
|
build(
|
||||||
"build",
|
"build",
|
||||||
options = defaultBuildOptions().copy(jsCompilerType = JsCompilerType.ir)
|
options = defaultBuildOptions().copy(jsCompilerType = KotlinJsCompilerType.ir)
|
||||||
) {
|
) {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ class Kotlin2JsIrGradlePluginIT : AbstractKotlin2JsGradlePluginIT(true) {
|
|||||||
|
|
||||||
build(
|
build(
|
||||||
"build",
|
"build",
|
||||||
options = defaultBuildOptions().copy(jsCompilerType = JsCompilerType.ir)
|
options = defaultBuildOptions().copy(jsCompilerType = KotlinJsCompilerType.ir)
|
||||||
) {
|
) {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
|
|
||||||
@@ -552,7 +552,7 @@ abstract class AbstractKotlin2JsGradlePluginIT(private val irBackend: Boolean) :
|
|||||||
gradleSettingsScript().modify(::transformBuildScriptWithPluginsDsl)
|
gradleSettingsScript().modify(::transformBuildScriptWithPluginsDsl)
|
||||||
|
|
||||||
if (irBackend) {
|
if (irBackend) {
|
||||||
gradleProperties().appendText(jsCompilerType(JsCompilerType.ir))
|
gradleProperties().appendText(jsCompilerType(KotlinJsCompilerType.ir))
|
||||||
}
|
}
|
||||||
|
|
||||||
build("build") {
|
build("build") {
|
||||||
|
|||||||
+4
-4
@@ -6,8 +6,8 @@ package org.jetbrains.kotlin.gradle
|
|||||||
|
|
||||||
import org.jdom.input.SAXBuilder
|
import org.jdom.input.SAXBuilder
|
||||||
import org.jetbrains.kotlin.gradle.internals.*
|
import org.jetbrains.kotlin.gradle.internals.*
|
||||||
import org.jetbrains.kotlin.gradle.plugin.JsCompilerType
|
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType
|
||||||
import org.jetbrains.kotlin.gradle.plugin.JsCompilerType.*
|
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType.*
|
||||||
import org.jetbrains.kotlin.gradle.plugin.ProjectLocalConfigurations
|
import org.jetbrains.kotlin.gradle.plugin.ProjectLocalConfigurations
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJvmWithJavaTargetPreset
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJvmWithJavaTargetPreset
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMultiplatformPlugin
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMultiplatformPlugin
|
||||||
@@ -289,7 +289,7 @@ class NewMultiplatformIT : BaseGradleIT() {
|
|||||||
private fun doTestLibAndAppJsBothCompilers(
|
private fun doTestLibAndAppJsBothCompilers(
|
||||||
libProjectName: String,
|
libProjectName: String,
|
||||||
appProjectName: String,
|
appProjectName: String,
|
||||||
jsCompilerType: JsCompilerType
|
jsCompilerType: KotlinJsCompilerType
|
||||||
) {
|
) {
|
||||||
val libProject = transformProjectWithPluginsDsl(libProjectName, directoryPrefix = "both-js-lib-and-app")
|
val libProject = transformProjectWithPluginsDsl(libProjectName, directoryPrefix = "both-js-lib-and-app")
|
||||||
val appProject = transformProjectWithPluginsDsl(appProjectName, directoryPrefix = "both-js-lib-and-app")
|
val appProject = transformProjectWithPluginsDsl(appProjectName, directoryPrefix = "both-js-lib-and-app")
|
||||||
@@ -366,7 +366,7 @@ class NewMultiplatformIT : BaseGradleIT() {
|
|||||||
// we use `maven { setUrl(...) }` because this syntax actually works both for Groovy and Kotlin DSLs in Gradle
|
// we use `maven { setUrl(...) }` because this syntax actually works both for Groovy and Kotlin DSLs in Gradle
|
||||||
gradleBuildScript().appendText("\nrepositories { maven { setUrl(\"$libLocalRepoUri\") } }")
|
gradleBuildScript().appendText("\nrepositories { maven { setUrl(\"$libLocalRepoUri\") } }")
|
||||||
|
|
||||||
fun CompiledProject.checkAppBuild(compilerType: JsCompilerType) {
|
fun CompiledProject.checkAppBuild(compilerType: KotlinJsCompilerType) {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
val compileTaskNames = if (jsCompilerType == compilerType) {
|
val compileTaskNames = if (jsCompilerType == compilerType) {
|
||||||
compileTasksNames.toTypedArray()
|
compileTasksNames.toTypedArray()
|
||||||
|
|||||||
+2
-2
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.gradle
|
package org.jetbrains.kotlin.gradle
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.plugin.JsCompilerType
|
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType
|
||||||
import org.jetbrains.kotlin.gradle.util.*
|
import org.jetbrains.kotlin.gradle.util.*
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ class VariantAwareDependenciesIT : BaseGradleIT() {
|
|||||||
assertContains(">> :${innerProject.projectName}:runtime --> sample-lib-nodejs-1.0.jar")
|
assertContains(">> :${innerProject.projectName}:runtime --> sample-lib-nodejs-1.0.jar")
|
||||||
}
|
}
|
||||||
|
|
||||||
gradleProperties().appendText(jsCompilerType(JsCompilerType.ir))
|
gradleProperties().appendText(jsCompilerType(KotlinJsCompilerType.ir))
|
||||||
|
|
||||||
testResolveAllConfigurations(
|
testResolveAllConfigurations(
|
||||||
subproject = innerProject.projectName,
|
subproject = innerProject.projectName,
|
||||||
|
|||||||
+7
-7
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.gradle
|
package org.jetbrains.kotlin.gradle
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.plugin.JsCompilerType
|
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class WorkersIT : BaseGradleIT() {
|
class WorkersIT : BaseGradleIT() {
|
||||||
@@ -13,7 +13,7 @@ class WorkersIT : BaseGradleIT() {
|
|||||||
fun testParallelTasks() {
|
fun testParallelTasks() {
|
||||||
parallelTasksImpl(
|
parallelTasksImpl(
|
||||||
isParallel = true,
|
isParallel = true,
|
||||||
jsCompilerType = JsCompilerType.legacy
|
jsCompilerType = KotlinJsCompilerType.legacy
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ class WorkersIT : BaseGradleIT() {
|
|||||||
fun testParallelTasksJsIr() {
|
fun testParallelTasksJsIr() {
|
||||||
parallelTasksImpl(
|
parallelTasksImpl(
|
||||||
isParallel = true,
|
isParallel = true,
|
||||||
jsCompilerType = JsCompilerType.ir
|
jsCompilerType = KotlinJsCompilerType.ir
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ class WorkersIT : BaseGradleIT() {
|
|||||||
fun testNoParallelTasks() {
|
fun testNoParallelTasks() {
|
||||||
parallelTasksImpl(
|
parallelTasksImpl(
|
||||||
isParallel = false,
|
isParallel = false,
|
||||||
jsCompilerType = JsCompilerType.legacy
|
jsCompilerType = KotlinJsCompilerType.legacy
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,13 +37,13 @@ class WorkersIT : BaseGradleIT() {
|
|||||||
fun testNoParallelTasksJsIr() {
|
fun testNoParallelTasksJsIr() {
|
||||||
parallelTasksImpl(
|
parallelTasksImpl(
|
||||||
isParallel = false,
|
isParallel = false,
|
||||||
jsCompilerType = JsCompilerType.ir
|
jsCompilerType = KotlinJsCompilerType.ir
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun parallelTasksImpl(
|
private fun parallelTasksImpl(
|
||||||
isParallel: Boolean,
|
isParallel: Boolean,
|
||||||
jsCompilerType: JsCompilerType
|
jsCompilerType: KotlinJsCompilerType
|
||||||
) =
|
) =
|
||||||
with(Project("new-mpp-parallel")) {
|
with(Project("new-mpp-parallel")) {
|
||||||
val options = defaultBuildOptions().copy(
|
val options = defaultBuildOptions().copy(
|
||||||
@@ -64,7 +64,7 @@ class WorkersIT : BaseGradleIT() {
|
|||||||
kotlinClassesDir(sourceSet = "metadata/main") + "common/A.kotlin_metadata",
|
kotlinClassesDir(sourceSet = "metadata/main") + "common/A.kotlin_metadata",
|
||||||
kotlinClassesDir(sourceSet = "jvm/main") + "common/A.class",
|
kotlinClassesDir(sourceSet = "jvm/main") + "common/A.class",
|
||||||
kotlinClassesDir(sourceSet = "js/main") +
|
kotlinClassesDir(sourceSet = "js/main") +
|
||||||
if (jsCompilerType == JsCompilerType.ir) "default/manifest" else "new-mpp-parallel.js"
|
if (jsCompilerType == KotlinJsCompilerType.ir) "default/manifest" else "new-mpp-parallel.js"
|
||||||
)
|
)
|
||||||
expectedKotlinOutputFiles.forEach { assertFileExists(it) }
|
expectedKotlinOutputFiles.forEach { assertFileExists(it) }
|
||||||
assertSubstringCount("Loaded GradleKotlinCompilerWork", 1)
|
assertSubstringCount("Loaded GradleKotlinCompilerWork", 1)
|
||||||
|
|||||||
+3
-3
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.gradle.util
|
package org.jetbrains.kotlin.gradle.util
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.plugin.JsCompilerType
|
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType
|
||||||
|
|
||||||
fun jsCompilerType(compilerType: JsCompilerType) =
|
fun jsCompilerType(compilerType: KotlinJsCompilerType) =
|
||||||
"\n${JsCompilerType.jsCompilerProperty}=$compilerType"
|
"\n${KotlinJsCompilerType.jsCompilerProperty}=$compilerType"
|
||||||
+1
-1
@@ -26,7 +26,7 @@ open class KotlinMultiplatformExtension :
|
|||||||
override lateinit var targets: NamedDomainObjectCollection<KotlinTarget>
|
override lateinit var targets: NamedDomainObjectCollection<KotlinTarget>
|
||||||
internal set
|
internal set
|
||||||
|
|
||||||
override lateinit var defaultJsCompilerType: JsCompilerType
|
override lateinit var defaultJsCompilerType: KotlinJsCompilerType
|
||||||
internal set
|
internal set
|
||||||
|
|
||||||
@Suppress("unused") // DSL
|
@Suppress("unused") // DSL
|
||||||
|
|||||||
+3
-3
@@ -22,7 +22,7 @@ import org.gradle.api.Project
|
|||||||
import org.gradle.api.internal.plugins.DslObject
|
import org.gradle.api.internal.plugins.DslObject
|
||||||
import org.gradle.util.ConfigureUtil
|
import org.gradle.util.ConfigureUtil
|
||||||
import org.jetbrains.kotlin.gradle.plugin.*
|
import org.jetbrains.kotlin.gradle.plugin.*
|
||||||
import org.jetbrains.kotlin.gradle.plugin.JsCompilerType.*
|
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType.*
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinAndroidTarget
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinAndroidTarget
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJsSingleTargetPreset
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJsSingleTargetPreset
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinWithJavaTarget
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinWithJavaTarget
|
||||||
@@ -111,10 +111,10 @@ open class KotlinJsProjectExtension :
|
|||||||
_target = value
|
_target = value
|
||||||
}
|
}
|
||||||
|
|
||||||
override lateinit var defaultJsCompilerType: JsCompilerType
|
override lateinit var defaultJsCompilerType: KotlinJsCompilerType
|
||||||
|
|
||||||
open fun js(
|
open fun js(
|
||||||
compiler: JsCompilerType = defaultJsCompilerType,
|
compiler: KotlinJsCompilerType = defaultJsCompilerType,
|
||||||
body: KotlinJsTargetDsl.() -> Unit
|
body: KotlinJsTargetDsl.() -> Unit
|
||||||
) {
|
) {
|
||||||
if (_target == null) {
|
if (_target == null) {
|
||||||
|
|||||||
+6
-6
@@ -2,7 +2,7 @@ package org.jetbrains.kotlin.gradle.dsl
|
|||||||
|
|
||||||
import groovy.lang.Closure
|
import groovy.lang.Closure
|
||||||
import org.gradle.util.ConfigureUtil
|
import org.gradle.util.ConfigureUtil
|
||||||
import org.jetbrains.kotlin.gradle.plugin.JsCompilerType
|
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerTypeHolder
|
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerTypeHolder
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinTargetPreset
|
import org.jetbrains.kotlin.gradle.plugin.KotlinTargetPreset
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsTargetDsl
|
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsTargetDsl
|
||||||
@@ -13,15 +13,15 @@ interface KotlinTargetContainerWithJsPresetFunctions :
|
|||||||
KotlinJsCompilerTypeHolder {
|
KotlinJsCompilerTypeHolder {
|
||||||
fun js(
|
fun js(
|
||||||
name: String = "js",
|
name: String = "js",
|
||||||
compiler: JsCompilerType = defaultJsCompilerType,
|
compiler: KotlinJsCompilerType = defaultJsCompilerType,
|
||||||
configure: KotlinJsTargetDsl.() -> Unit = { }
|
configure: KotlinJsTargetDsl.() -> Unit = { }
|
||||||
): KotlinJsTargetDsl =
|
): KotlinJsTargetDsl =
|
||||||
configureOrCreate(
|
configureOrCreate(
|
||||||
lowerCamelCaseName(name, if (compiler == JsCompilerType.both) JsCompilerType.legacy.name else null),
|
lowerCamelCaseName(name, if (compiler == KotlinJsCompilerType.both) KotlinJsCompilerType.legacy.name else null),
|
||||||
presets.getByName(
|
presets.getByName(
|
||||||
lowerCamelCaseName(
|
lowerCamelCaseName(
|
||||||
"js",
|
"js",
|
||||||
if (compiler == JsCompilerType.legacy) null else compiler.name
|
if (compiler == KotlinJsCompilerType.legacy) null else compiler.name
|
||||||
)
|
)
|
||||||
) as KotlinTargetPreset<KotlinJsTargetDsl>,
|
) as KotlinTargetPreset<KotlinJsTargetDsl>,
|
||||||
configure
|
configure
|
||||||
@@ -33,13 +33,13 @@ interface KotlinTargetContainerWithJsPresetFunctions :
|
|||||||
) = js(name = name, compiler = defaultJsCompilerType, configure = configure)
|
) = js(name = name, compiler = defaultJsCompilerType, configure = configure)
|
||||||
|
|
||||||
fun js(
|
fun js(
|
||||||
compiler: JsCompilerType,
|
compiler: KotlinJsCompilerType,
|
||||||
configure: KotlinJsTargetDsl.() -> Unit = { }
|
configure: KotlinJsTargetDsl.() -> Unit = { }
|
||||||
) = js(name = "js", compiler = compiler, configure = configure)
|
) = js(name = "js", compiler = compiler, configure = configure)
|
||||||
|
|
||||||
fun js() = js(name = "js") { }
|
fun js() = js(name = "js") { }
|
||||||
fun js(name: String) = js(name = name) { }
|
fun js(name: String) = js(name = name) { }
|
||||||
fun js(name: String, configure: Closure<*>) = js(name = name) { ConfigureUtil.configure(configure, this) }
|
fun js(name: String, configure: Closure<*>) = js(name = name) { ConfigureUtil.configure(configure, this) }
|
||||||
fun js(compiler: JsCompilerType, configure: Closure<*>) = js(compiler = compiler) { ConfigureUtil.configure(configure, this) }
|
fun js(compiler: KotlinJsCompilerType, configure: Closure<*>) = js(compiler = compiler) { ConfigureUtil.configure(configure, this) }
|
||||||
fun js(configure: Closure<*>) = js { ConfigureUtil.configure(configure, this) }
|
fun js(configure: Closure<*>) = js { ConfigureUtil.configure(configure, this) }
|
||||||
}
|
}
|
||||||
+3
-4
@@ -19,8 +19,7 @@ package org.jetbrains.kotlin.gradle.plugin
|
|||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.jetbrains.kotlin.gradle.dsl.Coroutines
|
import org.jetbrains.kotlin.gradle.dsl.Coroutines
|
||||||
import org.jetbrains.kotlin.gradle.dsl.NativeCacheKind
|
import org.jetbrains.kotlin.gradle.dsl.NativeCacheKind
|
||||||
import org.jetbrains.kotlin.gradle.plugin.JsCompilerType
|
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType.Companion.jsCompilerProperty
|
||||||
import org.jetbrains.kotlin.gradle.plugin.JsCompilerType.Companion.jsCompilerProperty
|
|
||||||
import org.jetbrains.kotlin.gradle.targets.native.DisabledNativeTargetsReporter
|
import org.jetbrains.kotlin.gradle.targets.native.DisabledNativeTargetsReporter
|
||||||
import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile
|
import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile
|
||||||
import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile
|
import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile
|
||||||
@@ -173,8 +172,8 @@ internal class PropertiesProvider private constructor(private val project: Proje
|
|||||||
/**
|
/**
|
||||||
* Use Kotlin/JS backend mode
|
* Use Kotlin/JS backend mode
|
||||||
*/
|
*/
|
||||||
val jsCompiler: JsCompilerType
|
val jsCompiler: KotlinJsCompilerType
|
||||||
get() = property(jsCompilerProperty)?.let { JsCompilerType.byArgument(it) } ?: JsCompilerType.legacy
|
get() = property(jsCompilerProperty)?.let { KotlinJsCompilerType.byArgument(it) } ?: KotlinJsCompilerType.legacy
|
||||||
|
|
||||||
private fun propertyWithDeprecatedVariant(propName: String, deprecatedPropName: String): String? {
|
private fun propertyWithDeprecatedVariant(propName: String, deprecatedPropName: String): String? {
|
||||||
val deprecatedProperty = property(deprecatedPropName)
|
val deprecatedProperty = property(deprecatedPropName)
|
||||||
|
|||||||
+2
-3
@@ -27,7 +27,6 @@ import org.gradle.language.base.plugins.LifecycleBasePlugin
|
|||||||
import org.gradle.language.jvm.tasks.ProcessResources
|
import org.gradle.language.jvm.tasks.ProcessResources
|
||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinCommonOptions
|
import org.jetbrains.kotlin.gradle.dsl.KotlinCommonOptions
|
||||||
import org.jetbrains.kotlin.gradle.dsl.kotlinExtension
|
import org.jetbrains.kotlin.gradle.dsl.kotlinExtension
|
||||||
import org.jetbrains.kotlin.gradle.plugin.JsCompilerType
|
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.*
|
import org.jetbrains.kotlin.gradle.plugin.mpp.*
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.KotlinJsTarget
|
import org.jetbrains.kotlin.gradle.targets.js.KotlinJsTarget
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrTarget
|
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrTarget
|
||||||
@@ -453,11 +452,11 @@ fun Configuration.usesPlatformOf(target: KotlinTarget): Configuration {
|
|||||||
attributes.attribute(KotlinPlatformType.attribute, target.platformType)
|
attributes.attribute(KotlinPlatformType.attribute, target.platformType)
|
||||||
|
|
||||||
if (target is KotlinJsTarget) {
|
if (target is KotlinJsTarget) {
|
||||||
attributes.attribute(KotlinJsTarget.jsCompilerAttribute, JsCompilerType.legacy)
|
attributes.attribute(KotlinJsTarget.jsCompilerAttribute, KotlinJsCompilerType.legacy)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target is KotlinJsIrTarget) {
|
if (target is KotlinJsIrTarget) {
|
||||||
attributes.attribute(KotlinJsTarget.jsCompilerAttribute, JsCompilerType.ir)
|
attributes.attribute(KotlinJsTarget.jsCompilerAttribute, KotlinJsCompilerType.ir)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Provide an universal way to copy attributes from the target.
|
// TODO: Provide an universal way to copy attributes from the target.
|
||||||
|
|||||||
+3
-3
@@ -41,7 +41,7 @@ constructor(
|
|||||||
internal set
|
internal set
|
||||||
|
|
||||||
val disambiguationClassifierInPlatform: String?
|
val disambiguationClassifierInPlatform: String?
|
||||||
get() = disambiguationClassifier?.removeJsCompilerSuffix(JsCompilerType.legacy)
|
get() = disambiguationClassifier?.removeJsCompilerSuffix(KotlinJsCompilerType.legacy)
|
||||||
|
|
||||||
override val kotlinComponents: Set<KotlinTargetComponent> by lazy {
|
override val kotlinComponents: Set<KotlinTargetComponent> by lazy {
|
||||||
if (irTarget == null)
|
if (irTarget == null)
|
||||||
@@ -73,7 +73,7 @@ constructor(
|
|||||||
): KotlinVariant {
|
): KotlinVariant {
|
||||||
return super.createKotlinVariant(componentName, compilation, usageContexts).apply {
|
return super.createKotlinVariant(componentName, compilation, usageContexts).apply {
|
||||||
irTarget?.let {
|
irTarget?.let {
|
||||||
artifactTargetName = targetName.removeJsCompilerSuffix(JsCompilerType.legacy)
|
artifactTargetName = targetName.removeJsCompilerSuffix(KotlinJsCompilerType.legacy)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -198,7 +198,7 @@ constructor(
|
|||||||
companion object {
|
companion object {
|
||||||
val jsCompilerAttribute = Attribute.of(
|
val jsCompilerAttribute = Attribute.of(
|
||||||
"org.jetbrains.kotlin.js.compiler",
|
"org.jetbrains.kotlin.js.compiler",
|
||||||
JsCompilerType::class.java
|
KotlinJsCompilerType::class.java
|
||||||
)
|
)
|
||||||
|
|
||||||
fun setupAttributesMatchingStrategy(attributesSchema: AttributesSchema) {
|
fun setupAttributesMatchingStrategy(attributesSchema: AttributesSchema) {
|
||||||
|
|||||||
+4
-4
@@ -9,7 +9,7 @@
|
|||||||
package org.jetbrains.kotlin.gradle.plugin.mpp
|
package org.jetbrains.kotlin.gradle.plugin.mpp
|
||||||
|
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.jetbrains.kotlin.gradle.plugin.JsCompilerType
|
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
|
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
|
||||||
import org.jetbrains.kotlin.gradle.plugin.removeJsCompilerSuffix
|
import org.jetbrains.kotlin.gradle.plugin.removeJsCompilerSuffix
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.KotlinJsTarget
|
import org.jetbrains.kotlin.gradle.targets.js.KotlinJsTarget
|
||||||
@@ -37,7 +37,7 @@ open class KotlinJsTargetPreset(
|
|||||||
platformType
|
platformType
|
||||||
).apply {
|
).apply {
|
||||||
this.irTarget = irPreset?.createTarget(
|
this.irTarget = irPreset?.createTarget(
|
||||||
lowerCamelCaseName(name.removeJsCompilerSuffix(JsCompilerType.legacy), JsCompilerType.ir.name)
|
lowerCamelCaseName(name.removeJsCompilerSuffix(KotlinJsCompilerType.legacy), KotlinJsCompilerType.ir.name)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ open class KotlinJsTargetPreset(
|
|||||||
override fun getName(): String {
|
override fun getName(): String {
|
||||||
return lowerCamelCaseName(
|
return lowerCamelCaseName(
|
||||||
PRESET_NAME,
|
PRESET_NAME,
|
||||||
irPreset?.let { JsCompilerType.both.name }
|
irPreset?.let { KotlinJsCompilerType.both.name }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ class KotlinJsSingleTargetPreset(
|
|||||||
override fun provideTargetDisambiguationClassifier(target: KotlinOnlyTarget<KotlinJsCompilation>): String? =
|
override fun provideTargetDisambiguationClassifier(target: KotlinOnlyTarget<KotlinJsCompilation>): String? =
|
||||||
irPreset?.let {
|
irPreset?.let {
|
||||||
super.provideTargetDisambiguationClassifier(target)
|
super.provideTargetDisambiguationClassifier(target)
|
||||||
?.removePrefix(target.name.removeJsCompilerSuffix(JsCompilerType.legacy))
|
?.removePrefix(target.name.removeJsCompilerSuffix(KotlinJsCompilerType.legacy))
|
||||||
?.decapitalize()
|
?.decapitalize()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -9,7 +9,7 @@ import org.gradle.api.NamedDomainObjectContainer
|
|||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.api.Task
|
import org.gradle.api.Task
|
||||||
import org.jetbrains.kotlin.gradle.plugin.AbstractKotlinTargetConfigurator.Companion.runTaskNameSuffix
|
import org.jetbrains.kotlin.gradle.plugin.AbstractKotlinTargetConfigurator.Companion.runTaskNameSuffix
|
||||||
import org.jetbrains.kotlin.gradle.plugin.JsCompilerType
|
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
|
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinTargetWithTests
|
import org.jetbrains.kotlin.gradle.plugin.KotlinTargetWithTests
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinOnlyTarget
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinOnlyTarget
|
||||||
@@ -37,7 +37,7 @@ constructor(
|
|||||||
internal set
|
internal set
|
||||||
|
|
||||||
val disambiguationClassifierInPlatform: String?
|
val disambiguationClassifierInPlatform: String?
|
||||||
get() = disambiguationClassifier?.removeJsCompilerSuffix(JsCompilerType.ir)
|
get() = disambiguationClassifier?.removeJsCompilerSuffix(KotlinJsCompilerType.ir)
|
||||||
|
|
||||||
var producingType: KotlinJsProducingType? = null
|
var producingType: KotlinJsProducingType? = null
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -6,7 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.gradle.targets.js.ir
|
package org.jetbrains.kotlin.gradle.targets.js.ir
|
||||||
|
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.jetbrains.kotlin.gradle.plugin.JsCompilerType
|
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinOnlyTargetConfigurator
|
import org.jetbrains.kotlin.gradle.plugin.KotlinOnlyTargetConfigurator
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
|
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinCompilationFactory
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinCompilationFactory
|
||||||
@@ -45,7 +45,7 @@ open class KotlinJsIrTargetPreset(
|
|||||||
companion object {
|
companion object {
|
||||||
val PRESET_NAME = lowerCamelCaseName(
|
val PRESET_NAME = lowerCamelCaseName(
|
||||||
"js",
|
"js",
|
||||||
JsCompilerType.ir.name
|
KotlinJsCompilerType.ir.name
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -61,7 +61,7 @@ class KotlinJsIrSingleTargetPreset(
|
|||||||
override fun provideTargetDisambiguationClassifier(target: KotlinOnlyTarget<KotlinJsIrCompilation>): String? {
|
override fun provideTargetDisambiguationClassifier(target: KotlinOnlyTarget<KotlinJsIrCompilation>): String? {
|
||||||
return if (mixedMode!!) {
|
return if (mixedMode!!) {
|
||||||
super.provideTargetDisambiguationClassifier(target)
|
super.provideTargetDisambiguationClassifier(target)
|
||||||
?.removePrefix(target.name.removeJsCompilerSuffix(JsCompilerType.ir))
|
?.removePrefix(target.name.removeJsCompilerSuffix(KotlinJsCompilerType.ir))
|
||||||
?.decapitalize()
|
?.decapitalize()
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
|
|||||||
Reference in New Issue
Block a user