diff --git a/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/CommandLine.kt b/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/CommandLine.kt index f4df50cce05..1961280cde3 100644 --- a/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/CommandLine.kt +++ b/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/CommandLine.kt @@ -114,6 +114,11 @@ open class CInteropArguments(argParser: ArgParser = fullName = SHORT_MODULE_NAME, description = "A short name used to denote this library in the IDE and during Objective-C export" ) + + val moduleName by argParser.option(ArgType.String, + fullName = "Xmodule-name", + description = "A full name of the library used for dependency resolution" + ) } class JSInteropArguments(argParser: ArgParser = ArgParser("jsinterop", diff --git a/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt b/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt index 3043873a628..23f394f22b0 100644 --- a/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt +++ b/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt @@ -273,7 +273,8 @@ private fun processCLib(flavorName: String, cinteropArguments: CInteropArguments } val klibSuffix = CompilerOutputKind.LIBRARY.suffix(target) - val moduleName = File(cinteropArguments.output).name.removeSuffixIfPresent(klibSuffix) + val moduleName = cinteropArguments.moduleName + ?: File(cinteropArguments.output).name.removeSuffixIfPresent(klibSuffix) val configuration = InteropConfiguration( library = compilation, diff --git a/utilities/src/main/kotlin/org/jetbrains/kotlin/cli/utilities/InteropCompiler.kt b/utilities/src/main/kotlin/org/jetbrains/kotlin/cli/utilities/InteropCompiler.kt index 30ded53c7ba..f68a87daba0 100644 --- a/utilities/src/main/kotlin/org/jetbrains/kotlin/cli/utilities/InteropCompiler.kt +++ b/utilities/src/main/kotlin/org/jetbrains/kotlin/cli/utilities/InteropCompiler.kt @@ -26,6 +26,7 @@ fun invokeInterop(flavor: String, args: Array): Array? { val purgeUserLibs = arguments.purgeUserLibs val nopack = arguments.nopack val temporaryFilesDir = arguments.tempDir + val moduleName = (arguments as? CInteropArguments)?.moduleName val shortModuleName = (arguments as? CInteropArguments)?.shortModuleName val buildDir = File("$outputFileName-build") @@ -67,6 +68,7 @@ fun invokeInterop(flavor: String, args: Array): Array? { (if (noEndorsedLibs) arrayOf("-$NOENDORSEDLIBS") else emptyArray()) + (if (purgeUserLibs) arrayOf("-$PURGE_USER_LIBS") else emptyArray()) + (if (nopack) arrayOf("-$NOPACK") else emptyArray()) + + moduleName?.let { arrayOf("-module-name", it) }.orEmpty() + shortModuleName?.let { arrayOf("-Xshort-module-name=$it") }.orEmpty() + arguments.kotlincOption }