diff --git a/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/InteropConfiguration.kt b/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/InteropConfiguration.kt index 12f481e2a1a..9be9ed2a704 100644 --- a/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/InteropConfiguration.kt +++ b/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/InteropConfiguration.kt @@ -27,5 +27,6 @@ class InteropConfiguration( val excludedFunctions: Set, val strictEnums: Set, val nonStrictEnums: Set, - val noStringConversion: Set + val noStringConversion: Set, + val exportForwardDeclarations: List ) \ No newline at end of file diff --git a/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/StubGenerator.kt b/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/StubGenerator.kt index 2383ec3ed82..23067a45455 100644 --- a/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/StubGenerator.kt +++ b/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/StubGenerator.kt @@ -995,12 +995,16 @@ class StubGenerator( } fun addManifestProperties(properties: Properties) { - properties["exportForwardDeclarations"] = nativeIndex.structs + val exportForwardDeclarations = configuration.exportForwardDeclarations.toMutableList() + + nativeIndex.structs .filter { it.def == null } - .joinToString(" ") { + .mapTo(exportForwardDeclarations) { "$cnamesStructsPackageName.${it.kotlinName}" } + properties["exportForwardDeclarations"] = exportForwardDeclarations.joinToString(" ") + // TODO: consider exporting Objective-C class and protocol forward refs. } 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 69cce3a9e6d..e2f1287fdef 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 @@ -275,7 +275,8 @@ private fun processCLib(args: Array): Array? { excludedFunctions = excludedFunctions, strictEnums = def.config.strictEnums.toSet(), nonStrictEnums = def.config.nonStrictEnums.toSet(), - noStringConversion = def.config.noStringConversion.toSet() + noStringConversion = def.config.noStringConversion.toSet(), + exportForwardDeclarations = def.config.exportForwardDeclarations ) val nativeIndex = buildNativeIndex(library) diff --git a/shared/src/main/kotlin/org/jetbrains/kotlin/konan/util/DefFile.kt b/shared/src/main/kotlin/org/jetbrains/kotlin/konan/util/DefFile.kt index 0977d5342c8..463334db7e1 100644 --- a/shared/src/main/kotlin/org/jetbrains/kotlin/konan/util/DefFile.kt +++ b/shared/src/main/kotlin/org/jetbrains/kotlin/konan/util/DefFile.kt @@ -95,6 +95,10 @@ class DefFile(val file:File?, val config:DefFileConfig, val manifestAddendProper val depends by lazy { properties.getSpaceSeparated("depends") } + + val exportForwardDeclarations by lazy { + properties.getSpaceSeparated("exportForwardDeclarations") + } } }