[KLIB] Add error message when failed to resolve library

This commit is contained in:
Svyatoslav Kuzmich
2019-11-13 20:32:04 +03:00
parent 3e8c15c62a
commit c8e5b2f2f8
@@ -98,13 +98,18 @@ abstract class KotlinLibrarySearchPathResolver<L: KotlinLibrary>(
override fun resolve(unresolved: UnresolvedLibrary, isDefaultLink: Boolean): L { override fun resolve(unresolved: UnresolvedLibrary, isDefaultLink: Boolean): L {
val givenPath = unresolved.path val givenPath = unresolved.path
val fileSequence = resolutionSequence(givenPath) try {
val matching = fileSequence.map { libraryBuilder(it, isDefaultLink) } val fileSequence = resolutionSequence(givenPath)
.map { it.takeIf { libraryMatch(it, unresolved) } } val matching = fileSequence.map { libraryBuilder(it, isDefaultLink) }
.filterNotNull() .map { it.takeIf { libraryMatch(it, unresolved) } }
.filterNotNull()
return matching.firstOrNull() ?: run { return matching.firstOrNull() ?: run {
logger.fatal("Could not find \"$givenPath\" in ${searchRoots.map { it.absolutePath }}.") logger.fatal("Could not find \"$givenPath\" in ${searchRoots.map { it.absolutePath }}.")
}
} catch (e: Throwable) {
logger.error("Failed to resolve Kotlin library: $givenPath")
throw e
} }
} }