Kotlin Facet: Fix platform detection in android-gradle projects
Sort candidate library names by descending length. Suppress common library if platform-specific one is also present #KT-16827 Fixed
This commit is contained in:
+4
-1
@@ -44,7 +44,10 @@ class PlatformAndroidGradleDetector : KotlinPlatformGradleDetector {
|
||||
.flatMap { it.data.jarLibraryDependencies.asSequence() }
|
||||
.forEach {
|
||||
val libraryName = it.name
|
||||
if (libraryName.substringBeforeLast("-") in libraryIds) return libraryName.substringAfterLast("-")
|
||||
for (libraryId in libraryIds) {
|
||||
val prefix = "$libraryId-"
|
||||
if (libraryName.startsWith(prefix)) return libraryName.substringAfter(prefix)
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user