[Gradle, JS] Provide disambiguation classifier for both mode
This commit is contained in:
+5
-2
@@ -69,10 +69,13 @@ class KotlinJsSingleTargetPreset(
|
|||||||
project,
|
project,
|
||||||
kotlinPluginVersion
|
kotlinPluginVersion
|
||||||
) {
|
) {
|
||||||
|
|
||||||
// In a Kotlin/JS single-platform project, we don't need any disambiguation suffixes or prefixes in the names:
|
// 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? =
|
override fun provideTargetDisambiguationClassifier(target: KotlinOnlyTarget<KotlinJsCompilation>): String? =
|
||||||
null
|
irPreset?.let {
|
||||||
|
super.provideTargetDisambiguationClassifier(target)
|
||||||
|
?.removePrefix(target.name.removeCapitalizedJsCompilerSuffix(JsCompilerType.legacy))
|
||||||
|
?.decapitalize()
|
||||||
|
}
|
||||||
|
|
||||||
override fun createKotlinTargetConfigurator() = KotlinJsTargetConfigurator(
|
override fun createKotlinTargetConfigurator() = KotlinJsTargetConfigurator(
|
||||||
kotlinPluginVersion
|
kotlinPluginVersion
|
||||||
|
|||||||
+14
-4
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
|
|||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinCompilationFactory
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinCompilationFactory
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinOnlyTarget
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinOnlyTarget
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinOnlyTargetPreset
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinOnlyTargetPreset
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.removeCapitalizedJsCompilerSuffix
|
||||||
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
||||||
|
|
||||||
open class KotlinJsIrTargetPreset(
|
open class KotlinJsIrTargetPreset(
|
||||||
@@ -52,11 +53,20 @@ open class KotlinJsIrTargetPreset(
|
|||||||
class KotlinJsIrSingleTargetPreset(
|
class KotlinJsIrSingleTargetPreset(
|
||||||
project: Project,
|
project: Project,
|
||||||
kotlinPluginVersion: String
|
kotlinPluginVersion: String
|
||||||
) :
|
) : KotlinJsIrTargetPreset(
|
||||||
KotlinJsIrTargetPreset(project, kotlinPluginVersion) {
|
project,
|
||||||
|
kotlinPluginVersion
|
||||||
|
) {
|
||||||
// In a Kotlin/JS single-platform project, we don't need any disambiguation suffixes or prefixes in the names:
|
// In a Kotlin/JS single-platform project, we don't need any disambiguation suffixes or prefixes in the names:
|
||||||
override fun provideTargetDisambiguationClassifier(target: KotlinOnlyTarget<KotlinJsIrCompilation>): String? = null
|
override fun provideTargetDisambiguationClassifier(target: KotlinOnlyTarget<KotlinJsIrCompilation>): String? {
|
||||||
|
return if (mixedMode!!) {
|
||||||
|
super.provideTargetDisambiguationClassifier(target)
|
||||||
|
?.removePrefix(target.name.removeCapitalizedJsCompilerSuffix(JsCompilerType.ir))
|
||||||
|
?.decapitalize()
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun createKotlinTargetConfigurator(): KotlinOnlyTargetConfigurator<KotlinJsIrCompilation, KotlinJsIrTarget> =
|
override fun createKotlinTargetConfigurator(): KotlinOnlyTargetConfigurator<KotlinJsIrCompilation, KotlinJsIrTarget> =
|
||||||
KotlinJsIrTargetConfigurator(kotlinPluginVersion)
|
KotlinJsIrTargetConfigurator(kotlinPluginVersion)
|
||||||
|
|||||||
Reference in New Issue
Block a user