From bea8edb10c7dfcca156b0fe69c08eb8dba2b202e Mon Sep 17 00:00:00 2001 From: SvyatoslavScherbina Date: Thu, 18 Feb 2021 21:24:45 +0300 Subject: [PATCH] Return old behaviour for cinterop -output argument suffix handling (accidentally changed in 976a9fc1) #KT-44824 Fixed. --- .../jetbrains/kotlin/native/interop/gen/jvm/main.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt b/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt index 8f4987ee357..50cb0a40af2 100644 --- a/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt +++ b/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt @@ -40,6 +40,7 @@ import org.jetbrains.kotlin.library.resolver.impl.KotlinLibraryResolverImpl import org.jetbrains.kotlin.library.resolver.impl.libraryResolver import org.jetbrains.kotlin.library.toUnresolvedLibraries import org.jetbrains.kotlin.util.removeSuffixIfPresent +import org.jetbrains.kotlin.util.suffixIfNot import java.io.File import java.lang.IllegalArgumentException import java.nio.file.* @@ -376,15 +377,22 @@ private fun processCLib(flavor: KotlinPlatform, cinteropArguments: CInteropArgum noDefaultLibs = true, noEndorsedLibs = true ).getFullList() + + val nopack = cinteropArguments.nopack + val outputPath = cinteropArguments.output.let { + val suffix = CompilerOutputKind.LIBRARY.suffix(tool.target) + if (nopack) it.removeSuffixIfPresent(suffix) else it.suffixIfNot(suffix) + } + createInteropLibrary( metadata = stubIrOutput.metadata, nativeBitcodeFiles = compiledFiles + nativeOutputPath, target = tool.target, moduleName = moduleName, - outputPath = cinteropArguments.output, + outputPath = outputPath, manifest = def.manifestAddendProperties, dependencies = stdlibDependency + imports.requiredLibraries.toList(), - nopack = cinteropArguments.nopack, + nopack = nopack, shortName = cinteropArguments.shortModuleName, staticLibraries = resolveLibraries(staticLibraries, libraryPaths) )