Support 'exportForwardDeclarations' internal .def file option

This commit is contained in:
Svyatoslav Scherbina
2018-03-29 16:59:39 +03:00
committed by SvyatoslavScherbina
parent 5c931033da
commit 2758aad1e9
4 changed files with 14 additions and 4 deletions
@@ -27,5 +27,6 @@ class InteropConfiguration(
val excludedFunctions: Set<String>, val excludedFunctions: Set<String>,
val strictEnums: Set<String>, val strictEnums: Set<String>,
val nonStrictEnums: Set<String>, val nonStrictEnums: Set<String>,
val noStringConversion: Set<String> val noStringConversion: Set<String>,
val exportForwardDeclarations: List<String>
) )
@@ -995,12 +995,16 @@ class StubGenerator(
} }
fun addManifestProperties(properties: Properties) { fun addManifestProperties(properties: Properties) {
properties["exportForwardDeclarations"] = nativeIndex.structs val exportForwardDeclarations = configuration.exportForwardDeclarations.toMutableList()
nativeIndex.structs
.filter { it.def == null } .filter { it.def == null }
.joinToString(" ") { .mapTo(exportForwardDeclarations) {
"$cnamesStructsPackageName.${it.kotlinName}" "$cnamesStructsPackageName.${it.kotlinName}"
} }
properties["exportForwardDeclarations"] = exportForwardDeclarations.joinToString(" ")
// TODO: consider exporting Objective-C class and protocol forward refs. // TODO: consider exporting Objective-C class and protocol forward refs.
} }
@@ -275,7 +275,8 @@ private fun processCLib(args: Array<String>): Array<String>? {
excludedFunctions = excludedFunctions, excludedFunctions = excludedFunctions,
strictEnums = def.config.strictEnums.toSet(), strictEnums = def.config.strictEnums.toSet(),
nonStrictEnums = def.config.nonStrictEnums.toSet(), nonStrictEnums = def.config.nonStrictEnums.toSet(),
noStringConversion = def.config.noStringConversion.toSet() noStringConversion = def.config.noStringConversion.toSet(),
exportForwardDeclarations = def.config.exportForwardDeclarations
) )
val nativeIndex = buildNativeIndex(library) val nativeIndex = buildNativeIndex(library)
@@ -95,6 +95,10 @@ class DefFile(val file:File?, val config:DefFileConfig, val manifestAddendProper
val depends by lazy { val depends by lazy {
properties.getSpaceSeparated("depends") properties.getSpaceSeparated("depends")
} }
val exportForwardDeclarations by lazy {
properties.getSpaceSeparated("exportForwardDeclarations")
}
} }
} }