[K/N] Move framework interface generation to "Produce Output" phase
It allows to invoke interface generation even if we don't compile a binary.
This commit is contained in:
+3
-1
@@ -181,7 +181,9 @@ internal fun produceOutput(context: Context) {
|
|||||||
val config = context.config.configuration
|
val config = context.config.configuration
|
||||||
val tempFiles = context.config.tempFiles
|
val tempFiles = context.config.tempFiles
|
||||||
val produce = config.get(KonanConfigKeys.PRODUCE)
|
val produce = config.get(KonanConfigKeys.PRODUCE)
|
||||||
|
if (produce == CompilerOutputKind.FRAMEWORK) {
|
||||||
|
context.objCExport.produceFrameworkInterface()
|
||||||
|
}
|
||||||
when (produce) {
|
when (produce) {
|
||||||
CompilerOutputKind.STATIC,
|
CompilerOutputKind.STATIC,
|
||||||
CompilerOutputKind.DYNAMIC,
|
CompilerOutputKind.DYNAMIC,
|
||||||
|
|||||||
+10
-7
@@ -47,8 +47,6 @@ internal class ObjCExport(val context: Context, symbolTable: SymbolTable) {
|
|||||||
private fun produceInterface(): ObjCExportedInterface? {
|
private fun produceInterface(): ObjCExportedInterface? {
|
||||||
if (!target.family.isAppleFamily) return null
|
if (!target.family.isAppleFamily) return null
|
||||||
|
|
||||||
if (!context.config.produce.isFinalBinary) return null
|
|
||||||
|
|
||||||
// TODO: emit RTTI to the same modules as classes belong to.
|
// TODO: emit RTTI to the same modules as classes belong to.
|
||||||
// Not possible yet, since ObjCExport translates the entire "world" API at once
|
// Not possible yet, since ObjCExport translates the entire "world" API at once
|
||||||
// and can't do this per-module, e.g. due to global name conflict resolution.
|
// and can't do this per-module, e.g. due to global name conflict resolution.
|
||||||
@@ -98,16 +96,21 @@ internal class ObjCExport(val context: Context, symbolTable: SymbolTable) {
|
|||||||
|
|
||||||
val objCCodeGenerator = ObjCExportCodeGenerator(codegen, namer, mapper)
|
val objCCodeGenerator = ObjCExportCodeGenerator(codegen, namer, mapper)
|
||||||
|
|
||||||
if (exportedInterface != null) {
|
exportedInterface?.generateWorkaroundForSwiftSR10177()
|
||||||
produceFrameworkSpecific(exportedInterface.headerLines)
|
|
||||||
|
|
||||||
exportedInterface.generateWorkaroundForSwiftSR10177()
|
|
||||||
}
|
|
||||||
|
|
||||||
objCCodeGenerator.generate(codeSpec)
|
objCCodeGenerator.generate(codeSpec)
|
||||||
objCCodeGenerator.dispose()
|
objCCodeGenerator.dispose()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Populate framework directory with headers, module and info.plist.
|
||||||
|
*/
|
||||||
|
fun produceFrameworkInterface() {
|
||||||
|
if (exportedInterface != null) {
|
||||||
|
produceFrameworkSpecific(exportedInterface.headerLines)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun produceFrameworkSpecific(headerLines: List<String>) {
|
private fun produceFrameworkSpecific(headerLines: List<String>) {
|
||||||
val framework = File(context.config.outputFile)
|
val framework = File(context.config.outputFile)
|
||||||
val frameworkContents = when(target.family) {
|
val frameworkContents = when(target.family) {
|
||||||
|
|||||||
Reference in New Issue
Block a user