Interop: Support setting custom unique name for interop libs

This commit is contained in:
Ilya Matveev
2020-03-27 16:45:29 +07:00
committed by Ilya Matveev
parent ce1cb39c41
commit ffe8ce5524
3 changed files with 9 additions and 1 deletions
@@ -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",
@@ -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,
@@ -26,6 +26,7 @@ fun invokeInterop(flavor: String, args: Array<String>): Array<String>? {
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<String>): Array<String>? {
(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
}