From 462c53d566908687f6d70f66f138bf840c68ac44 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Thu, 4 Aug 2022 15:39:21 +0200 Subject: [PATCH] [JS, IR] Fix creating targets in both mode --- .../dsl/KotlinTargetContainerWithJsPresetFunctions.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinTargetContainerWithJsPresetFunctions.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinTargetContainerWithJsPresetFunctions.kt index b10df70faac..9b3728c0b96 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinTargetContainerWithJsPresetFunctions.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinTargetContainerWithJsPresetFunctions.kt @@ -116,8 +116,8 @@ private fun KotlinTargetContainerWithJsPresetFunctions.jsInternal( } // Try to find existing target with exact name -// and with append suffix Legacy in case when compiler for found target is BOTH, -// and removed suffix Legacy in case when current compiler is BOTH +// and removed suffix IR in case when current compiler is BOTH +// and with append suffix IR in case when compiler for found target is not BOTH private fun KotlinTargetContainerWithJsPresetFunctions.getExistingTarget( name: String, compiler: KotlinJsCompilerType? @@ -142,13 +142,13 @@ private fun KotlinTargetContainerWithJsPresetFunctions.getExistingTarget( val targetNameCandidate = getTargetName(name, compiler) return targets.findByName(targetNameCandidate) as KotlinJsTargetDsl? - ?: getPreviousTarget(targetNameCandidate.removeJsCompilerSuffix(KotlinJsCompilerType.LEGACY), true) - ?: getPreviousTarget(lowerCamelCaseName(targetNameCandidate, KotlinJsCompilerType.LEGACY.lowerName), false) + ?: getPreviousTarget(targetNameCandidate.removeJsCompilerSuffix(KotlinJsCompilerType.IR), true) + ?: getPreviousTarget(lowerCamelCaseName(targetNameCandidate, KotlinJsCompilerType.IR.lowerName), false) } private fun getTargetName(name: String, compiler: KotlinJsCompilerType?): String { return lowerCamelCaseName( name, - if (compiler == KotlinJsCompilerType.BOTH) KotlinJsCompilerType.LEGACY.lowerName else null + if (compiler == KotlinJsCompilerType.BOTH) KotlinJsCompilerType.IR.lowerName else null ) }