[cinterop] A bit more robust logic of mode selection
This commit is contained in:
committed by
Sergey Bogolepov
parent
aee9bcfed0
commit
07177396ac
+11
-2
@@ -211,8 +211,17 @@ private fun processCLib(args: Array<String>, additionalArgs: Map<String, Any> =
|
|||||||
|
|
||||||
val outKtPkg = fqParts.joinToString(".")
|
val outKtPkg = fqParts.joinToString(".")
|
||||||
|
|
||||||
val mode = parseGenerationMode(cinteropArguments.mode)
|
val mode = run {
|
||||||
?: error ("Unexpected interop generation mode: ${cinteropArguments.mode}")
|
val providedMode = parseGenerationMode(cinteropArguments.mode)
|
||||||
|
?: error ("Unexpected interop generation mode: ${cinteropArguments.mode}")
|
||||||
|
|
||||||
|
if (providedMode == GenerationMode.METADATA && flavor == KotlinPlatform.JVM) {
|
||||||
|
warn("Metadata mode isn't supported for Kotlin/JVM! Falling back to sourcecode.")
|
||||||
|
GenerationMode.SOURCE_CODE
|
||||||
|
} else {
|
||||||
|
providedMode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val allLibraryDependencies = when (flavor) {
|
val allLibraryDependencies = when (flavor) {
|
||||||
KotlinPlatform.NATIVE -> resolveDependencies(cinteropArguments, tool.target)
|
KotlinPlatform.NATIVE -> resolveDependencies(cinteropArguments, tool.target)
|
||||||
|
|||||||
@@ -225,6 +225,9 @@ class NamedNativeInteropConfig implements Named {
|
|||||||
args '-natives', nativeLibsDir
|
args '-natives', nativeLibsDir
|
||||||
args '-Xtemporary-files-dir', temporaryFilesDir
|
args '-Xtemporary-files-dir', temporaryFilesDir
|
||||||
args '-flavor', this.flavor
|
args '-flavor', this.flavor
|
||||||
|
if (flavor == "jvm") {
|
||||||
|
args '-mode', 'sourcecode'
|
||||||
|
}
|
||||||
// Uncomment to debug.
|
// Uncomment to debug.
|
||||||
// args '-verbose', 'true'
|
// args '-verbose', 'true'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user