[IR] Collect all dependencies of module recursively
This commit is contained in:
committed by
TeamCityServer
parent
aaa3fa5845
commit
87ffbd8206
+12
-1
@@ -115,7 +115,7 @@ class JvmIrCodegenFactory(private val phaseConfig: PhaseConfig) : CodegenFactory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val dependencies = psi2irContext.moduleDescriptor.allDependencyModules.map {
|
val dependencies = psi2irContext.moduleDescriptor.collectAllDependencyModulesTransitively().map {
|
||||||
val kotlinLibrary = (it.getCapability(KlibModuleOrigin.CAPABILITY) as? DeserializedKlibModuleOrigin)?.library
|
val kotlinLibrary = (it.getCapability(KlibModuleOrigin.CAPABILITY) as? DeserializedKlibModuleOrigin)?.library
|
||||||
if (it.hasJdkCapability) {
|
if (it.hasJdkCapability) {
|
||||||
// For IDE environment only, i.e. when compiling for debugger
|
// For IDE environment only, i.e. when compiling for debugger
|
||||||
@@ -153,6 +153,17 @@ class JvmIrCodegenFactory(private val phaseConfig: PhaseConfig) : CodegenFactory
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun ModuleDescriptor.collectAllDependencyModulesTransitively(): List<ModuleDescriptor> {
|
||||||
|
val result = LinkedHashSet<ModuleDescriptor>()
|
||||||
|
fun collectImpl(descriptor: ModuleDescriptor) {
|
||||||
|
val dependencies = descriptor.allDependencyModules
|
||||||
|
dependencies.forEach { if (it !in result) collectImpl(it) }
|
||||||
|
result += dependencies
|
||||||
|
}
|
||||||
|
collectImpl(this)
|
||||||
|
return result.toList()
|
||||||
|
}
|
||||||
|
|
||||||
fun doGenerateFilesInternal(input: JvmIrBackendInput) {
|
fun doGenerateFilesInternal(input: JvmIrBackendInput) {
|
||||||
val (state, irModuleFragment, symbolTable, sourceManager, phaseConfig, irProviders, extensions, backendExtension) = input
|
val (state, irModuleFragment, symbolTable, sourceManager, phaseConfig, irProviders, extensions, backendExtension) = input
|
||||||
val context = JvmBackendContext(
|
val context = JvmBackendContext(
|
||||||
|
|||||||
Reference in New Issue
Block a user