Check bad root presence before checking platform (KT-30442)
Detect platform based on libraries content is a long operation and should not be called from `isConversionNeeded`. Do other checks before it.
This commit is contained in:
@@ -188,12 +188,15 @@ class KotlinNonJvmSourceRootConverterProvider : ConverterProvider("kotlin-non-jv
|
|||||||
override fun isConversionNeeded(settings: ModuleSettings): Boolean {
|
override fun isConversionNeeded(settings: ModuleSettings): Boolean {
|
||||||
if (settings.isExternalModule()) return false
|
if (settings.isExternalModule()) return false
|
||||||
|
|
||||||
val targetPlatform = settings.detectPlatform()
|
val hasMigrationRoots = settings.getSourceFolderElements().any {
|
||||||
if (targetPlatform == JvmPlatform) return false
|
|
||||||
|
|
||||||
return settings.getSourceFolderElements().any {
|
|
||||||
JpsModuleRootModelSerializer.loadSourceRoot(it).rootType in rootTypesToMigrate
|
JpsModuleRootModelSerializer.loadSourceRoot(it).rootType in rootTypesToMigrate
|
||||||
}
|
}
|
||||||
|
if (!hasMigrationRoots) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
val targetPlatform = settings.detectPlatform()
|
||||||
|
return (targetPlatform != JvmPlatform)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun process(settings: ModuleSettings) {
|
override fun process(settings: ModuleSettings) {
|
||||||
|
|||||||
Reference in New Issue
Block a user