If we get a defaultly linked library again from a library dependency
it should not be purged anymore for the final binary.
This commit is contained in:
committed by
alexander-gorshenev
parent
ea802dfcdf
commit
e7286998aa
+13
@@ -70,13 +70,26 @@ fun SearchPathResolver.resolveLibrariesRecursive(immediateLibraries: List<Librar
|
|||||||
result.putAll(immediateLibraries.map { it.libraryFile.absoluteFile to it })
|
result.putAll(immediateLibraries.map { it.libraryFile.absoluteFile to it })
|
||||||
var newDependencies: Map<File, LibraryReaderImpl> = result
|
var newDependencies: Map<File, LibraryReaderImpl> = result
|
||||||
do {
|
do {
|
||||||
|
val defaultOverrides = mutableSetOf<File>()
|
||||||
newDependencies = newDependencies.values.asSequence()
|
newDependencies = newDependencies.values.asSequence()
|
||||||
.flatMap { it.dependencies.asSequence() }
|
.flatMap { it.dependencies.asSequence() }
|
||||||
.map { resolve(it).absoluteFile }
|
.map { resolve(it).absoluteFile }
|
||||||
|
.onEach {
|
||||||
|
if (result[it]?.isDefaultLink == true) {
|
||||||
|
defaultOverrides.add(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
.filter { it !in result }
|
.filter { it !in result }
|
||||||
.map { it to LibraryReaderImpl(it, abiVersion, target) }.toMap()
|
.map { it to LibraryReaderImpl(it, abiVersion, target) }.toMap()
|
||||||
|
|
||||||
result.putAll(newDependencies)
|
result.putAll(newDependencies)
|
||||||
|
|
||||||
|
// If there is a default link in immediateLibraries,
|
||||||
|
// and we get the same library as a dependency,
|
||||||
|
// the resultant surviving library should not be a defaultLink anymore.
|
||||||
|
defaultOverrides.forEach {
|
||||||
|
result[it] = LibraryReaderImpl(it, abiVersion, target)
|
||||||
|
}
|
||||||
} while (newDependencies.isNotEmpty())
|
} while (newDependencies.isNotEmpty())
|
||||||
return result.values.toList()
|
return result.values.toList()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user