[Gradle, JS] Fix naming

This commit is contained in:
Ilya Goncharov
2020-01-23 19:48:21 +03:00
parent 8f8eaa28d5
commit 15a33a8503
3 changed files with 6 additions and 17 deletions
@@ -450,11 +450,11 @@ fun Configuration.usesPlatformOf(target: KotlinTarget): Configuration {
attributes.attribute(KotlinPlatformType.attribute, target.platformType)
if (target is KotlinJsTarget) {
attributes.attribute(KotlinJsTarget.jsLegacyAttribute, LEGACY)
attributes.attribute(KotlinJsTarget.jsModeAttribute, LEGACY)
}
if (target is KotlinJsIrTarget) {
attributes.attribute(KotlinJsTarget.jsLegacyAttribute, IR)
attributes.attribute(KotlinJsTarget.jsModeAttribute, IR)
}
// TODO: Provide an universal way to copy attributes from the target.
@@ -31,11 +31,9 @@ open class KotlinJsPlugin(
val kotlinExtension = project.kotlinExtension as KotlinJsProjectExtension
configureDefaultVersionsResolutionStrategy(project, kotlinPluginVersion)
KotlinJsTarget.setupAttributesMatchingStrategy(project.dependencies.attributesSchema)
val irPreset = if (mixedMode) KotlinJsIrSingleTargetPreset(project, kotlinPluginVersion) else null
val irPrest = if (mixedMode) KotlinJsIrSingleTargetPreset(project, kotlinPluginVersion) else null
val target = KotlinJsSingleTargetPreset(project, kotlinPluginVersion, irPrest).createTarget("Js")
val target = KotlinJsSingleTargetPreset(project, kotlinPluginVersion, irPreset).createTarget("Js")
kotlinExtension.target = target
@@ -10,7 +10,6 @@ import org.gradle.api.Project
import org.gradle.api.artifacts.ConfigurablePublishArtifact
import org.gradle.api.artifacts.Dependency
import org.gradle.api.attributes.Attribute
import org.gradle.api.attributes.AttributesSchema
import org.gradle.api.attributes.Usage
import org.gradle.api.tasks.TaskProvider
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
@@ -43,10 +42,6 @@ constructor(
override lateinit var testRuns: NamedDomainObjectContainer<KotlinJsReportAggregatingTestRun>
internal set
init {
attributes.attribute(KotlinJsTarget.jsLegacyAttribute, LEGACY)
}
override val kotlinComponents: Set<KotlinTargetComponent> by lazy {
if (irTarget == null)
super.kotlinComponents
@@ -176,16 +171,12 @@ constructor(
}
companion object {
val jsLegacyAttribute = Attribute.of(
"org.jetbrains.kotlin.js.legacy",
val jsModeAttribute = Attribute.of(
"org.jetbrains.kotlin.js.mode",
String::class.java
)
const val LEGACY = "legacy"
const val IR = "ir"
fun setupAttributesMatchingStrategy(attributesSchema: AttributesSchema) {
attributesSchema.attribute(jsLegacyAttribute)
}
}
}