Mandate to demonstrate a ModuleDescriptor as a proof that the resolve is over
for the recursive library resolution.
This commit is contained in:
committed by
alexander-gorshenev
parent
bddada22e5
commit
c7190141b1
+1
-1
@@ -49,7 +49,7 @@ internal fun produceOutput(context: Context) {
|
||||
val output = context.config.outputName
|
||||
val libraryName = context.config.moduleId
|
||||
val neededLibraries
|
||||
= context.config.librariesWithDependencies
|
||||
= context.librariesWithDependencies
|
||||
val abiVersion = context.config.currentAbiVersion
|
||||
val target = context.config.targetManager.target
|
||||
val nopack = config.getBoolean(KonanConfigKeys.NOPACK)
|
||||
|
||||
+4
@@ -178,6 +178,10 @@ internal class Context(config: KonanConfig) : KonanBackendContext(config) {
|
||||
@Deprecated("")
|
||||
lateinit var psi2IrGeneratorContext: GeneratorContext
|
||||
|
||||
val librariesWithDependencies by lazy {
|
||||
config.librariesWithDependencies(moduleDescriptor)
|
||||
}
|
||||
|
||||
// TODO: make lateinit?
|
||||
var irModule: IrModuleFragment? = null
|
||||
set(module: IrModuleFragment?) {
|
||||
|
||||
+1
-1
@@ -1297,7 +1297,7 @@ internal object EscapeAnalysis {
|
||||
val isStdlib = context.config.configuration[KonanConfigKeys.NOSTDLIB] == true
|
||||
|
||||
val externalFunctionEAResults = mutableMapOf<String, FunctionEscapeAnalysisResult>()
|
||||
context.config.librariesWithDependencies.forEach { library ->
|
||||
context.librariesWithDependencies.forEach { library ->
|
||||
val libraryEscapeAnalysis = library.escapeAnalysis
|
||||
if (libraryEscapeAnalysis != null) {
|
||||
DEBUG_OUTPUT(0) {
|
||||
|
||||
+6
-7
@@ -30,6 +30,7 @@ import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.*
|
||||
import org.jetbrains.kotlin.config.CommonConfigurationKeys
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.konan.file.File
|
||||
import org.jetbrains.kotlin.konan.target.*
|
||||
import org.jetbrains.kotlin.konan.util.DependencyProcessor
|
||||
@@ -78,7 +79,7 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration
|
||||
private val repositories = configuration.getList(KonanConfigKeys.REPOSITORIES)
|
||||
private val resolver = defaultResolver(repositories, distribution)
|
||||
|
||||
val immediateLibraries: List<LibraryReaderImpl> by lazy {
|
||||
private val immediateLibraries: List<LibraryReaderImpl> by lazy {
|
||||
resolver.resolveImmediateLibraries(
|
||||
libraryNames,
|
||||
targetManager.target,
|
||||
@@ -92,13 +93,11 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration
|
||||
}
|
||||
}
|
||||
|
||||
// Accessing this field before resolve is a bad idea.
|
||||
// purgeUnneeded() only works correctly after we have
|
||||
// completed resolve and successfully marked package files
|
||||
// as needed or not needed.
|
||||
val librariesWithDependencies: List<KonanLibraryReader> by lazy {
|
||||
fun librariesWithDependencies(moduleDescriptor: ModuleDescriptor?): List<KonanLibraryReader> {
|
||||
if (moduleDescriptor == null) error("purgeUnneeded() only works correctly after resolve is over, and we have successfully marked package files as needed or not needed.")
|
||||
|
||||
resolver.resolveLibrariesRecursive(immediateLibraries, targetManager.target, currentAbiVersion)
|
||||
immediateLibraries.purgeUnneeded().withResolvedDependencies()
|
||||
return immediateLibraries.purgeUnneeded().withResolvedDependencies()
|
||||
}
|
||||
|
||||
private val loadedDescriptors = loadLibMetadata()
|
||||
|
||||
+1
-1
@@ -235,7 +235,7 @@ internal class LinkStage(val context: Context) {
|
||||
private val debug = config.get(KonanConfigKeys.DEBUG) ?: false
|
||||
private val nomain = config.get(KonanConfigKeys.NOMAIN) ?: false
|
||||
private val emitted = context.bitcodeFileName
|
||||
private val libraries = context.config.librariesWithDependencies
|
||||
private val libraries = context.librariesWithDependencies
|
||||
private fun MutableList<String>.addNonEmpty(elements: List<String>) {
|
||||
addAll(elements.filter { !it.isEmpty() })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user