[Commonizer] Read exported forward declarations for every C-interop module
This commit is contained in:
@@ -18,7 +18,12 @@ interface ModulesProvider {
|
||||
open class ModuleInfo(
|
||||
val name: String,
|
||||
val originalLocation: File,
|
||||
val isCInterop: Boolean
|
||||
val cInteropAttributes: CInteropModuleAttributes?
|
||||
)
|
||||
|
||||
class CInteropModuleAttributes(
|
||||
val mainPackage: String,
|
||||
val exportedForwardDeclarations: Collection<String>
|
||||
)
|
||||
|
||||
/**
|
||||
|
||||
+8
-3
@@ -17,8 +17,8 @@ internal class NativeDistributionModulesProvider(libraries: Collection<NativeLib
|
||||
name: String,
|
||||
originalLocation: File,
|
||||
val dependencies: Set<String>,
|
||||
isCInterop: Boolean
|
||||
) : ModuleInfo(name, originalLocation, isCInterop)
|
||||
cInteropAttributes: ModulesProvider.CInteropModuleAttributes?
|
||||
) : ModuleInfo(name, originalLocation, cInteropAttributes)
|
||||
|
||||
private val libraryMap: Map<String, NativeLibrary>
|
||||
private val moduleInfoMap: Map<String, NativeModuleInfo>
|
||||
@@ -34,8 +34,13 @@ internal class NativeDistributionModulesProvider(libraries: Collection<NativeLib
|
||||
val location = File(library.library.libraryFile.path)
|
||||
val dependencies = manifestData.dependencies.toSet()
|
||||
|
||||
val cInteropAttributes = if (manifestData.isInterop) {
|
||||
val packageFqName = manifestData.packageFqName ?: error("Main package FQ name not specified for module $name")
|
||||
ModulesProvider.CInteropModuleAttributes(packageFqName, manifestData.exportForwardDeclarations)
|
||||
} else null
|
||||
|
||||
libraryMap.put(name, library)?.let { error("Duplicated libraries: $name") }
|
||||
moduleInfoMap[name] = NativeModuleInfo(name, location, dependencies, manifestData.isInterop)
|
||||
moduleInfoMap[name] = NativeModuleInfo(name, location, dependencies, cInteropAttributes)
|
||||
}
|
||||
|
||||
this.libraryMap = libraryMap
|
||||
|
||||
+2
-2
@@ -47,7 +47,7 @@ internal class CirProvidedClassifiersByModules private constructor(
|
||||
var hasForwardDeclarations = false
|
||||
|
||||
modulesProvider.loadModuleInfos().forEach { moduleInfo ->
|
||||
if (moduleInfo.isCInterop) {
|
||||
if (moduleInfo.cInteropAttributes != null) {
|
||||
// this is a C-interop module
|
||||
hasForwardDeclarations = true
|
||||
}
|
||||
@@ -137,7 +137,7 @@ private fun readClass(
|
||||
typeParameterIndexOffset = typeParameterIndexOffset
|
||||
)
|
||||
val visibility = ProtoEnumFlags.visibility(Flags.VISIBILITY.get(classProto.flags))
|
||||
val clazz = CirProvided.Class(typeParameters, visibility)
|
||||
val clazz = CirProvided.RegularClass(typeParameters, visibility)
|
||||
|
||||
consumer(classId, clazz)
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ internal class MockModulesProvider private constructor(
|
||||
return SERIALIZER.serializeModule(module)
|
||||
}
|
||||
|
||||
private fun fakeModuleInfo(name: String) = ModuleInfo(name, File("/tmp/commonizer/mocks/$name"), false)
|
||||
private fun fakeModuleInfo(name: String) = ModuleInfo(name, File("/tmp/commonizer/mocks/$name"), null)
|
||||
|
||||
companion object {
|
||||
@JvmName("createByModuleNames")
|
||||
|
||||
Reference in New Issue
Block a user