Fix KotlinLibraryResolverImpl.kt on Windows
`absoluteFile` is not enough to make path unique. For example, it doesn't expand things like '..' and 'IDEAPR~1' on Windows. `canonicalFile` seems to solve the problem.
This commit is contained in:
+5
-5
@@ -111,7 +111,7 @@ class KotlinLibraryResolverImpl<L: KotlinLibrary> internal constructor(
|
|||||||
val result = KotlinLibraryResolverResultImpl(rootLibraries)
|
val result = KotlinLibraryResolverResultImpl(rootLibraries)
|
||||||
|
|
||||||
val cache = mutableMapOf<File, KotlinResolvedLibrary>()
|
val cache = mutableMapOf<File, KotlinResolvedLibrary>()
|
||||||
cache.putAll(rootLibraries.map { it.library.libraryFile.absoluteFile to it })
|
cache.putAll(rootLibraries.map { it.library.libraryFile.canonicalFile to it })
|
||||||
|
|
||||||
var newDependencies = rootLibraries
|
var newDependencies = rootLibraries
|
||||||
do {
|
do {
|
||||||
@@ -121,12 +121,12 @@ class KotlinLibraryResolverImpl<L: KotlinLibrary> internal constructor(
|
|||||||
.filterNot { searchPathResolver.isProvidedByDefault(it) }
|
.filterNot { searchPathResolver.isProvidedByDefault(it) }
|
||||||
.mapNotNull { searchPathResolver.resolve(it)?.let(::KotlinResolvedLibraryImpl) }
|
.mapNotNull { searchPathResolver.resolve(it)?.let(::KotlinResolvedLibraryImpl) }
|
||||||
.map { resolved ->
|
.map { resolved ->
|
||||||
val absoluteFile = resolved.library.libraryFile.absoluteFile
|
val canonicalFile = resolved.library.libraryFile.canonicalFile
|
||||||
if (absoluteFile in cache) {
|
if (canonicalFile in cache) {
|
||||||
library.addDependency(cache[absoluteFile]!!)
|
library.addDependency(cache[canonicalFile]!!)
|
||||||
null
|
null
|
||||||
} else {
|
} else {
|
||||||
cache.put(absoluteFile, resolved)
|
cache.put(canonicalFile, resolved)
|
||||||
library.addDependency(resolved)
|
library.addDependency(resolved)
|
||||||
resolved
|
resolved
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user