[Gradle, JS] Rename of property for control compiler type
This commit is contained in:
+4
-4
@@ -11,7 +11,7 @@ import org.jdom.output.Format
|
||||
import org.jdom.output.XMLOutputter
|
||||
import org.jetbrains.kotlin.gradle.model.ModelContainer
|
||||
import org.jetbrains.kotlin.gradle.model.ModelFetcherBuildAction
|
||||
import org.jetbrains.kotlin.gradle.plugin.JsMode
|
||||
import org.jetbrains.kotlin.gradle.plugin.JsCompilerType
|
||||
import org.jetbrains.kotlin.gradle.util.*
|
||||
import org.jetbrains.kotlin.test.util.trimTrailingWhitespaces
|
||||
import org.junit.After
|
||||
@@ -212,7 +212,7 @@ abstract class BaseGradleIT {
|
||||
val withBuildCache: Boolean = false,
|
||||
val kaptOptions: KaptOptions? = null,
|
||||
val parallelTasksInProject: Boolean? = null,
|
||||
val jsMode: JsMode? = null
|
||||
val jsCompilerType: JsCompilerType? = null
|
||||
)
|
||||
|
||||
data class KaptOptions(val verbose: Boolean, val useWorkers: Boolean, val incrementalKapt: Boolean = false, val includeCompileClasspath: Boolean = true)
|
||||
@@ -764,8 +764,8 @@ Finished executing task ':$taskName'|
|
||||
add("-Pkotlin.parallel.tasks.in.project=$it")
|
||||
}
|
||||
|
||||
options.jsMode?.let {
|
||||
add("-Pkotlin.js.mode=$it")
|
||||
options.jsCompilerType?.let {
|
||||
add("-Pkotlin.js.compiler=$it")
|
||||
}
|
||||
|
||||
// Workaround: override a console type set in the user machine gradle.properties (since Gradle 4.3):
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package org.jetbrains.kotlin.gradle
|
||||
|
||||
import org.gradle.api.logging.LogLevel
|
||||
import org.jetbrains.kotlin.gradle.plugin.JsMode
|
||||
import org.jetbrains.kotlin.gradle.plugin.JsCompilerType
|
||||
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.util.getFileByName
|
||||
@@ -510,7 +510,7 @@ abstract class AbstractKotlin2JsGradlePluginIT(private val irBackend: Boolean) :
|
||||
gradleSettingsScript().modify(::transformBuildScriptWithPluginsDsl)
|
||||
|
||||
if (!irBackend) {
|
||||
gradleProperties().appendText(jsMode(JsMode.LEGACY))
|
||||
gradleProperties().appendText(jsMode(JsCompilerType.LEGACY))
|
||||
}
|
||||
|
||||
build("build") {
|
||||
|
||||
+23
-24
@@ -4,10 +4,9 @@
|
||||
*/
|
||||
package org.jetbrains.kotlin.gradle
|
||||
|
||||
import org.gradle.api.logging.LogLevel
|
||||
import org.jdom.input.SAXBuilder
|
||||
import org.jetbrains.kotlin.gradle.internals.*
|
||||
import org.jetbrains.kotlin.gradle.plugin.JsMode
|
||||
import org.jetbrains.kotlin.gradle.plugin.JsCompilerType
|
||||
import org.jetbrains.kotlin.gradle.plugin.ProjectLocalConfigurations
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJvmWithJavaTargetPreset
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMultiplatformPlugin
|
||||
@@ -68,48 +67,48 @@ class NewMultiplatformIT : BaseGradleIT() {
|
||||
fun testLibAndApp() = doTestLibAndApp(
|
||||
"sample-lib",
|
||||
"sample-app",
|
||||
JsMode.LEGACY
|
||||
JsCompilerType.LEGACY
|
||||
)
|
||||
|
||||
@Test
|
||||
fun testLibAndAppJsIr() = doTestLibAndApp(
|
||||
"sample-lib",
|
||||
"sample-app",
|
||||
JsMode.IR
|
||||
JsCompilerType.KLIB
|
||||
)
|
||||
|
||||
@Test
|
||||
fun testLibAndAppJsMixed() = doTestLibAndApp(
|
||||
"sample-lib",
|
||||
"sample-app",
|
||||
JsMode.MIXED
|
||||
JsCompilerType.BOTH
|
||||
)
|
||||
|
||||
@Test
|
||||
fun testLibAndAppWithGradleKotlinDsl() = doTestLibAndApp(
|
||||
"sample-lib-gradle-kotlin-dsl",
|
||||
"sample-app-gradle-kotlin-dsl",
|
||||
JsMode.LEGACY
|
||||
JsCompilerType.LEGACY
|
||||
)
|
||||
|
||||
@Test
|
||||
fun testLibAndAppWithGradleKotlinDslJsIr() = doTestLibAndApp(
|
||||
"sample-lib-gradle-kotlin-dsl",
|
||||
"sample-app-gradle-kotlin-dsl",
|
||||
JsMode.IR
|
||||
JsCompilerType.KLIB
|
||||
)
|
||||
|
||||
@Test
|
||||
fun testLibAndAppWithGradleKotlinDslJsMixed() = doTestLibAndApp(
|
||||
"sample-lib-gradle-kotlin-dsl",
|
||||
"sample-app-gradle-kotlin-dsl",
|
||||
JsMode.MIXED
|
||||
JsCompilerType.BOTH
|
||||
)
|
||||
|
||||
private fun doTestLibAndApp(
|
||||
libProjectName: String,
|
||||
appProjectName: String,
|
||||
jsMode: JsMode
|
||||
jsCompilerType: JsCompilerType
|
||||
) {
|
||||
val libProject = transformProjectWithPluginsDsl(libProjectName, directoryPrefix = "new-mpp-lib-and-app")
|
||||
val appProject = transformProjectWithPluginsDsl(appProjectName, directoryPrefix = "new-mpp-lib-and-app")
|
||||
@@ -121,14 +120,14 @@ class NewMultiplatformIT : BaseGradleIT() {
|
||||
with(libProject) {
|
||||
build(
|
||||
"publish",
|
||||
options = defaultBuildOptions().copy(jsMode = jsMode)
|
||||
options = defaultBuildOptions().copy(jsCompilerType = jsCompilerType)
|
||||
) {
|
||||
assertSuccessful()
|
||||
assertTasksExecuted(*compileTasksNames.toTypedArray(), ":jvm6Jar", ":nodeJsJar", ":metadataJar")
|
||||
|
||||
val groupDir = projectDir.resolve("repo/com/example")
|
||||
val jvmJarName = "sample-lib-jvm6/1.0/sample-lib-jvm6-1.0.jar"
|
||||
val jsExtension = if (jsMode == JsMode.LEGACY) "jar" else "klib"
|
||||
val jsExtension = if (jsCompilerType == JsCompilerType.LEGACY) "jar" else "klib"
|
||||
val jsJarName = "sample-lib-nodejs/1.0/sample-lib-nodejs-1.0.$jsExtension"
|
||||
val metadataJarName = "sample-lib-metadata/1.0/sample-lib-metadata-1.0.jar"
|
||||
val wasmKlibName = "sample-lib-wasm32/1.0/sample-lib-wasm32-1.0.klib"
|
||||
@@ -157,8 +156,8 @@ class NewMultiplatformIT : BaseGradleIT() {
|
||||
Assert.assertTrue("com/example/lib/CommonKt.class" in jvmJarEntries)
|
||||
Assert.assertTrue("com/example/lib/MainKt.class" in jvmJarEntries)
|
||||
|
||||
when (jsMode) {
|
||||
JsMode.LEGACY -> {
|
||||
when (jsCompilerType) {
|
||||
JsCompilerType.LEGACY -> {
|
||||
val jsJar = ZipFile(groupDir.resolve(jsJarName))
|
||||
val compiledJs = jsJar.getInputStream(jsJar.getEntry("sample-lib.js")).reader().readText()
|
||||
Assert.assertTrue("function id(" in compiledJs)
|
||||
@@ -166,7 +165,7 @@ class NewMultiplatformIT : BaseGradleIT() {
|
||||
Assert.assertTrue("function expectedFun(" in compiledJs)
|
||||
Assert.assertTrue("function main(" in compiledJs)
|
||||
}
|
||||
JsMode.IR -> {
|
||||
JsCompilerType.KLIB -> {
|
||||
groupDir.resolve(jsJarName).exists()
|
||||
}
|
||||
}
|
||||
@@ -214,7 +213,7 @@ class NewMultiplatformIT : BaseGradleIT() {
|
||||
Assert.assertTrue(resolve("com/example/app/AKt.kotlin_metadata").exists())
|
||||
}
|
||||
|
||||
if (jsMode == JsMode.LEGACY) {
|
||||
if (jsCompilerType == JsCompilerType.LEGACY) {
|
||||
projectDir.resolve(targetClassesDir("nodeJs")).resolve("sample-app.js").readText().run {
|
||||
Assert.assertTrue(contains("console.info"))
|
||||
Assert.assertTrue(contains("function nodeJsMain("))
|
||||
@@ -243,22 +242,22 @@ class NewMultiplatformIT : BaseGradleIT() {
|
||||
build(
|
||||
"assemble",
|
||||
"resolveRuntimeDependencies",
|
||||
options = defaultBuildOptions().copy(jsMode = jsMode)
|
||||
options = defaultBuildOptions().copy(jsCompilerType = jsCompilerType)
|
||||
) {
|
||||
checkAppBuild()
|
||||
assertTasksExecuted(":resolveRuntimeDependencies") // KT-26301
|
||||
}
|
||||
|
||||
if (jsMode == JsMode.MIXED) {
|
||||
if (jsCompilerType == JsCompilerType.BOTH) {
|
||||
listOf(
|
||||
JsMode.LEGACY,
|
||||
JsMode.IR
|
||||
JsCompilerType.LEGACY,
|
||||
JsCompilerType.KLIB
|
||||
).forEach {
|
||||
build(
|
||||
"assemble",
|
||||
"resolveRuntimeDependencies",
|
||||
"--rerun-tasks",
|
||||
options = defaultBuildOptions().copy(jsMode = it)
|
||||
options = defaultBuildOptions().copy(jsCompilerType = it)
|
||||
) {
|
||||
checkAppBuild()
|
||||
assertTasksExecuted(":resolveRuntimeDependencies") // KT-26301
|
||||
@@ -279,13 +278,13 @@ class NewMultiplatformIT : BaseGradleIT() {
|
||||
"clean",
|
||||
"assemble",
|
||||
"--rerun-tasks",
|
||||
options = defaultBuildOptions().copy(jsMode = jsMode)
|
||||
options = defaultBuildOptions().copy(jsCompilerType = jsCompilerType)
|
||||
) {
|
||||
checkAppBuild()
|
||||
}
|
||||
}
|
||||
|
||||
if (jsMode != JsMode.LEGACY) return
|
||||
if (jsCompilerType != JsCompilerType.LEGACY) return
|
||||
|
||||
with(oldStyleAppProject) {
|
||||
setupWorkingDir()
|
||||
@@ -899,7 +898,7 @@ class NewMultiplatformIT : BaseGradleIT() {
|
||||
projectDir.resolve("settings.gradle").modify { it.replace("enableFeaturePreview", "// enableFeaturePreview") }
|
||||
build(
|
||||
"publish",
|
||||
options = defaultBuildOptions().copy(jsMode = JsMode.LEGACY)
|
||||
options = defaultBuildOptions().copy(jsCompilerType = JsCompilerType.LEGACY)
|
||||
) { assertSuccessful() }
|
||||
projectDir.resolve("repo")
|
||||
}
|
||||
@@ -2311,7 +2310,7 @@ class NewMultiplatformIT : BaseGradleIT() {
|
||||
setupWorkingDir()
|
||||
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
|
||||
if (!jsIr) {
|
||||
gradleProperties().appendText(jsMode(JsMode.LEGACY))
|
||||
gradleProperties().appendText(jsMode(JsCompilerType.LEGACY))
|
||||
}
|
||||
|
||||
val tasks = listOf("jvm", "js", nativeHostTargetName).map { ":compileIntegrationTestKotlin${it.capitalize()}" }
|
||||
|
||||
+2
-3
@@ -5,10 +5,9 @@
|
||||
|
||||
package org.jetbrains.kotlin.gradle
|
||||
|
||||
import org.jetbrains.kotlin.gradle.plugin.JsMode
|
||||
import org.jetbrains.kotlin.gradle.plugin.JsCompilerType
|
||||
import org.jetbrains.kotlin.gradle.util.*
|
||||
import org.junit.Test
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
class VariantAwareDependenciesIT : BaseGradleIT() {
|
||||
private val gradleVersion = GradleVersionRequired.None
|
||||
@@ -41,7 +40,7 @@ class VariantAwareDependenciesIT : BaseGradleIT() {
|
||||
assertContains(">> :${innerProject.projectName}:runtime --> sample-lib-nodejs-1.0.klib")
|
||||
}
|
||||
|
||||
gradleProperties().appendText(jsMode(JsMode.LEGACY))
|
||||
gradleProperties().appendText(jsMode(JsCompilerType.LEGACY))
|
||||
|
||||
testResolveAllConfigurations(
|
||||
subproject = innerProject.projectName,
|
||||
|
||||
+8
-9
@@ -5,8 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.gradle
|
||||
|
||||
import org.jetbrains.kotlin.gradle.plugin.JsMode
|
||||
import org.jetbrains.kotlin.gradle.util.jsMode
|
||||
import org.jetbrains.kotlin.gradle.plugin.JsCompilerType
|
||||
import org.junit.Test
|
||||
|
||||
class WorkersIT : BaseGradleIT() {
|
||||
@@ -14,7 +13,7 @@ class WorkersIT : BaseGradleIT() {
|
||||
fun testParallelTasks() {
|
||||
parallelTasksImpl(
|
||||
isParallel = true,
|
||||
jsMode = JsMode.LEGACY
|
||||
jsCompilerType = JsCompilerType.LEGACY
|
||||
)
|
||||
}
|
||||
|
||||
@@ -22,7 +21,7 @@ class WorkersIT : BaseGradleIT() {
|
||||
fun testParallelTasksJsIr() {
|
||||
parallelTasksImpl(
|
||||
isParallel = true,
|
||||
jsMode = JsMode.IR
|
||||
jsCompilerType = JsCompilerType.KLIB
|
||||
)
|
||||
}
|
||||
|
||||
@@ -30,7 +29,7 @@ class WorkersIT : BaseGradleIT() {
|
||||
fun testNoParallelTasks() {
|
||||
parallelTasksImpl(
|
||||
isParallel = false,
|
||||
jsMode = JsMode.LEGACY
|
||||
jsCompilerType = JsCompilerType.LEGACY
|
||||
)
|
||||
}
|
||||
|
||||
@@ -38,19 +37,19 @@ class WorkersIT : BaseGradleIT() {
|
||||
fun testNoParallelTasksJsIr() {
|
||||
parallelTasksImpl(
|
||||
isParallel = false,
|
||||
jsMode = JsMode.IR
|
||||
jsCompilerType = JsCompilerType.KLIB
|
||||
)
|
||||
}
|
||||
|
||||
private fun parallelTasksImpl(
|
||||
isParallel: Boolean,
|
||||
jsMode: JsMode
|
||||
jsCompilerType: JsCompilerType
|
||||
) =
|
||||
with(Project("new-mpp-parallel")) {
|
||||
val options = defaultBuildOptions().copy(
|
||||
parallelTasksInProject = isParallel,
|
||||
withDaemon = false,
|
||||
jsMode = jsMode
|
||||
jsCompilerType = jsCompilerType
|
||||
)
|
||||
val traceLoading = "-Dorg.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.trace.loading=true"
|
||||
build("assemble", traceLoading, options = options) {
|
||||
@@ -65,7 +64,7 @@ class WorkersIT : BaseGradleIT() {
|
||||
kotlinClassesDir(sourceSet = "metadata/main") + "common/A.kotlin_metadata",
|
||||
kotlinClassesDir(sourceSet = "jvm/main") + "common/A.class",
|
||||
kotlinClassesDir(sourceSet = "js/main") +
|
||||
if (jsMode == JsMode.IR) "default/manifest" else "new-mpp-parallel.js"
|
||||
if (jsCompilerType == JsCompilerType.KLIB) "default/manifest" else "new-mpp-parallel.js"
|
||||
)
|
||||
expectedKotlinOutputFiles.forEach { assertFileExists(it) }
|
||||
assertSubstringCount("Loaded GradleKotlinCompilerWork", 1)
|
||||
|
||||
+3
-3
@@ -5,7 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.gradle.util
|
||||
|
||||
import org.jetbrains.kotlin.gradle.plugin.JsMode
|
||||
import org.jetbrains.kotlin.gradle.plugin.JsCompilerType
|
||||
|
||||
fun jsMode(mode: JsMode) =
|
||||
"\n${JsMode.jsModeProp}=$mode"
|
||||
fun jsMode(compilerType: JsCompilerType) =
|
||||
"\n${JsCompilerType.jsCompilerProperty}=$compilerType"
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
kotlin.tests.individualTaskReports=true
|
||||
#because of dependency (kotlinx-html) which is not klib yet
|
||||
kotlin.js.mode=legacy
|
||||
kotlin.js.compiler=legacy
|
||||
+1
-1
@@ -1 +1 @@
|
||||
kotlin.js.mode=legacy
|
||||
kotlin.js.compiler=legacy
|
||||
+1
-1
@@ -1 +1 @@
|
||||
kotlin.js.mode=legacy
|
||||
kotlin.js.compiler=legacy
|
||||
+1
-1
@@ -1 +1 @@
|
||||
kotlin.js.mode=legacy
|
||||
kotlin.js.compiler=legacy
|
||||
+7
-7
@@ -166,10 +166,10 @@ open class KotlinJsPluginWrapper @Inject constructor(
|
||||
override fun getPlugin(project: Project, kotlinGradleBuildServices: KotlinGradleBuildServices): Plugin<Project> {
|
||||
val propertiesProvider = PropertiesProvider(project)
|
||||
|
||||
return when (propertiesProvider.jsMode) {
|
||||
JsMode.IR -> KotlinJsIrPlugin(kotlinPluginVersion)
|
||||
JsMode.LEGACY -> KotlinJsPlugin(kotlinPluginVersion, false)
|
||||
JsMode.MIXED -> KotlinJsPlugin(kotlinPluginVersion, true)
|
||||
return when (propertiesProvider.jsCompiler) {
|
||||
JsCompilerType.KLIB -> KotlinJsIrPlugin(kotlinPluginVersion)
|
||||
JsCompilerType.LEGACY -> KotlinJsPlugin(kotlinPluginVersion, false)
|
||||
JsCompilerType.BOTH -> KotlinJsPlugin(kotlinPluginVersion, true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,9 +178,9 @@ open class KotlinJsPluginWrapper @Inject constructor(
|
||||
override fun defineExtension(project: Project) {
|
||||
val propertiesProvider = PropertiesProvider(project)
|
||||
|
||||
projectExtensionClass = when (propertiesProvider.jsMode) {
|
||||
JsMode.IR -> KotlinJsIrProjectExtension::class
|
||||
JsMode.LEGACY, JsMode.MIXED -> KotlinJsProjectExtension::class
|
||||
projectExtensionClass = when (propertiesProvider.jsCompiler) {
|
||||
JsCompilerType.KLIB -> KotlinJsIrProjectExtension::class
|
||||
JsCompilerType.LEGACY, JsCompilerType.BOTH -> KotlinJsProjectExtension::class
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+17
-9
@@ -16,16 +16,18 @@
|
||||
|
||||
package org.jetbrains.kotlin.gradle.plugin
|
||||
|
||||
import org.gradle.api.Named
|
||||
import org.gradle.api.Project
|
||||
import org.jetbrains.kotlin.gradle.dsl.Coroutines
|
||||
import org.jetbrains.kotlin.gradle.dsl.NativeCacheKind
|
||||
import org.jetbrains.kotlin.gradle.plugin.JsMode.Companion.jsModeProp
|
||||
import org.jetbrains.kotlin.gradle.plugin.JsCompilerType.Companion.jsCompilerProperty
|
||||
import org.jetbrains.kotlin.gradle.targets.native.DisabledNativeTargetsReporter
|
||||
import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile
|
||||
import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
import org.jetbrains.kotlin.gradle.utils.SingleWarningPerBuild
|
||||
import java.io.File
|
||||
import java.io.Serializable
|
||||
import java.util.*
|
||||
|
||||
internal fun PropertiesProvider.mapKotlinTaskProperties(task: AbstractKotlinCompile<*>) {
|
||||
@@ -172,8 +174,8 @@ internal class PropertiesProvider private constructor(private val project: Proje
|
||||
/**
|
||||
* Use Kotlin/JS backend mode
|
||||
*/
|
||||
val jsMode: JsMode
|
||||
get() = property(jsModeProp)?.let { JsMode.byCompilerArgument(it) } ?: JsMode.IR
|
||||
val jsCompiler: JsCompilerType
|
||||
get() = property(jsCompilerProperty)?.let { JsCompilerType.byArgument(it) } ?: JsCompilerType.KLIB
|
||||
|
||||
private fun propertyWithDeprecatedVariant(propName: String, deprecatedPropName: String): String? {
|
||||
val deprecatedProperty = property(deprecatedPropName)
|
||||
@@ -209,15 +211,21 @@ internal class PropertiesProvider private constructor(private val project: Proje
|
||||
}
|
||||
}
|
||||
|
||||
enum class JsMode {
|
||||
enum class JsCompilerType : Named, Serializable {
|
||||
LEGACY,
|
||||
IR,
|
||||
MIXED;
|
||||
KLIB,
|
||||
BOTH;
|
||||
|
||||
override fun getName(): String =
|
||||
name.toLowerCase()
|
||||
|
||||
override fun toString(): String =
|
||||
getName()
|
||||
|
||||
companion object {
|
||||
const val jsModeProp = "kotlin.js.mode"
|
||||
const val jsCompilerProperty = "kotlin.js.compiler"
|
||||
|
||||
fun byCompilerArgument(argument: String): JsMode? =
|
||||
JsMode.values().firstOrNull { it.name.equals(argument, ignoreCase = true) }
|
||||
fun byArgument(argument: String): JsCompilerType? =
|
||||
JsCompilerType.values().firstOrNull { it.name.equals(argument, ignoreCase = true) }
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -450,11 +450,11 @@ fun Configuration.usesPlatformOf(target: KotlinTarget): Configuration {
|
||||
attributes.attribute(KotlinPlatformType.attribute, target.platformType)
|
||||
|
||||
if (target is KotlinJsTarget) {
|
||||
attributes.attribute(KotlinJsTarget.jsModeAttribute, LEGACY)
|
||||
attributes.attribute(KotlinJsTarget.jsCompilerAttribute, LEGACY)
|
||||
}
|
||||
|
||||
if (target is KotlinJsIrTarget) {
|
||||
attributes.attribute(KotlinJsTarget.jsModeAttribute, IR)
|
||||
attributes.attribute(KotlinJsTarget.jsCompilerAttribute, IR)
|
||||
}
|
||||
|
||||
// TODO: Provide an universal way to copy attributes from the target.
|
||||
|
||||
+4
-4
@@ -157,10 +157,10 @@ class KotlinMultiplatformPlugin(
|
||||
|
||||
with(project.multiplatformExtension.presets) {
|
||||
add(KotlinJvmTargetPreset(project, kotlinPluginVersion))
|
||||
when (propertiesProvider.jsMode) {
|
||||
JsMode.LEGACY -> add(KotlinJsTargetPreset(project, kotlinPluginVersion, null))
|
||||
JsMode.IR -> add(KotlinJsIrTargetPreset(project, kotlinPluginVersion, false))
|
||||
JsMode.MIXED -> add(
|
||||
when (propertiesProvider.jsCompiler) {
|
||||
JsCompilerType.LEGACY -> add(KotlinJsTargetPreset(project, kotlinPluginVersion, null))
|
||||
JsCompilerType.KLIB -> add(KotlinJsIrTargetPreset(project, kotlinPluginVersion, false))
|
||||
JsCompilerType.BOTH -> add(
|
||||
KotlinJsTargetPreset(
|
||||
project,
|
||||
kotlinPluginVersion,
|
||||
|
||||
+3
-3
@@ -185,8 +185,8 @@ constructor(
|
||||
}
|
||||
|
||||
companion object {
|
||||
val jsModeAttribute = Attribute.of(
|
||||
"org.jetbrains.kotlin.js.mode",
|
||||
val jsCompilerAttribute = Attribute.of(
|
||||
"org.jetbrains.kotlin.js.compiler",
|
||||
String::class.java
|
||||
)
|
||||
|
||||
@@ -194,7 +194,7 @@ constructor(
|
||||
const val LEGACY = "legacy"
|
||||
|
||||
fun setupAttributesMatchingStrategy(attributesSchema: AttributesSchema) {
|
||||
attributesSchema.attribute(jsModeAttribute)
|
||||
attributesSchema.attribute(jsCompilerAttribute)
|
||||
}
|
||||
}
|
||||
}
|
||||
-2
@@ -6,10 +6,8 @@
|
||||
package org.jetbrains.kotlin.gradle.targets.js.ir
|
||||
|
||||
import org.gradle.api.Project
|
||||
import org.jetbrains.kotlin.gradle.plugin.JsMode
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinOnlyTargetConfigurator
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
|
||||
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinCompilationFactory
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinOnlyTarget
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinOnlyTargetPreset
|
||||
|
||||
Reference in New Issue
Block a user