Check if serialization plugin presents in the facet compiler classpath before applying extensions logic

#KT-27166 Fixed
This commit is contained in:
Leonid Startsev
2018-09-26 16:09:57 +03:00
parent 088cd4b5e3
commit b611facd71
12 changed files with 156 additions and 30 deletions
@@ -7,8 +7,19 @@ package org.jetbrains.kotlin.idea.core
import com.intellij.facet.FacetManager
import com.intellij.openapi.module.Module
import org.jetbrains.kotlin.analyzer.ModuleInfo
import org.jetbrains.kotlin.idea.caches.project.ModuleSourceInfo
import org.jetbrains.kotlin.idea.caches.project.PlatformModuleInfo
fun Module.isAndroidModule(): Boolean {
val facets = FacetManager.getInstance(this).allFacets
return facets.any { it.javaClass.simpleName == "AndroidFacet" }
}
fun ModuleInfo.unwrapModuleSourceInfo(): ModuleSourceInfo? {
return when (this) {
is ModuleSourceInfo -> this
is PlatformModuleInfo -> this.platformModule
else -> null
}
}