[Gradle, JS] Default source-set name w/o legacy disambiguation in mixed
This commit is contained in:
+23
-14
@@ -1,9 +1,11 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@file:Suppress("PackageDirectoryMismatch") // Old package for compatibility
|
||||
@file:Suppress("PackageDirectoryMismatch")
|
||||
|
||||
// Old package for compatibility
|
||||
package org.jetbrains.kotlin.gradle.plugin.mpp
|
||||
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJsOptions
|
||||
@@ -11,21 +13,28 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinCompilationWithResources
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
|
||||
import org.jetbrains.kotlin.gradle.targets.js.npm.PackageJson
|
||||
import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile
|
||||
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
||||
|
||||
open class KotlinJsCompilation(
|
||||
target: KotlinTarget,
|
||||
name: String
|
||||
) : AbstractKotlinCompilationToRunnableFiles<KotlinJsOptions>(target, name), KotlinCompilationWithResources<KotlinJsOptions> {
|
||||
override val processResourcesTaskName: String
|
||||
get() = disambiguateName("processResources")
|
||||
open class KotlinJsCompilation(
|
||||
target: KotlinTarget,
|
||||
name: String
|
||||
) : AbstractKotlinCompilationToRunnableFiles<KotlinJsOptions>(target, name), KotlinCompilationWithResources<KotlinJsOptions> {
|
||||
override val processResourcesTaskName: String
|
||||
get() = disambiguateName("processResources")
|
||||
|
||||
override val compileKotlinTask: Kotlin2JsCompile
|
||||
get() = super.compileKotlinTask as Kotlin2JsCompile
|
||||
override val compileKotlinTask: Kotlin2JsCompile
|
||||
get() = super.compileKotlinTask as Kotlin2JsCompile
|
||||
|
||||
internal val packageJsonHandlers = mutableListOf<PackageJson.() -> Unit>()
|
||||
internal val packageJsonHandlers = mutableListOf<PackageJson.() -> Unit>()
|
||||
|
||||
@Suppress("unused")
|
||||
fun packageJson(handler: PackageJson.() -> Unit) {
|
||||
packageJsonHandlers.add(handler)
|
||||
}
|
||||
|
||||
override val defaultSourceSetName: String
|
||||
get() = lowerCamelCaseName(
|
||||
target.disambiguationClassifier?.removePrefix(LEGACY_DISAMBIGUATION_CLASSIFIER),
|
||||
compilationName
|
||||
)
|
||||
}
|
||||
-1
@@ -12,7 +12,6 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinOnlyTargetConfigurator
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetProcessor
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinTargetWithTestsConfigurator
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJsCompilation
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.defaultSourceSetName
|
||||
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrTargetConfigurator
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinTasksProvider
|
||||
import org.jetbrains.kotlin.gradle.testing.internal.kotlinTestRegistry
|
||||
|
||||
+4
-2
@@ -69,10 +69,12 @@ class KotlinJsSingleTargetPreset(
|
||||
|
||||
// In a Kotlin/JS single-platform project, we don't need any disambiguation suffixes or prefixes in the names:
|
||||
override fun provideTargetDisambiguationClassifier(target: KotlinOnlyTarget<KotlinJsCompilation>): String? =
|
||||
irPreset?.let { "legacy" }
|
||||
irPreset?.let { LEGACY_DISAMBIGUATION_CLASSIFIER }
|
||||
|
||||
override fun createKotlinTargetConfigurator() = KotlinJsTargetConfigurator(
|
||||
kotlinPluginVersion,
|
||||
irPreset?.let { KotlinJsIrTargetConfigurator(kotlinPluginVersion) }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
const val LEGACY_DISAMBIGUATION_CLASSIFIER = "legacy"
|
||||
Reference in New Issue
Block a user