MPP: Allow 'implements' relation only within the same Gradle project

Also allow COMMON modules on the "implementer" side
This commit is contained in:
Alexey Sedunov
2018-09-14 17:24:40 +03:00
parent 9e6637dced
commit 619e2bc0db
6 changed files with 18 additions and 2 deletions
@@ -28,6 +28,9 @@ import org.jetbrains.kotlin.resolve.TargetPlatform
val Module.isNewMPPModule: Boolean
get() = KotlinFacet.get(this)?.configuration?.settings?.kind?.isNewMPP ?: false
val Module.externalProjectId: String
get() = KotlinFacet.get(this)?.configuration?.settings?.externalProjectId ?: ""
val Module.isMPPModule: Boolean
get() {
val settings = KotlinFacet.get(this)?.configuration?.settings ?: return false
@@ -42,7 +45,7 @@ val Module.implementingModules: List<Module>
CachedValueProvider.Result(
if (isNewMPPModule) {
moduleManager.getModuleDependentModules(this).filter {
it.isNewMPPModule && it.platform !is CommonIdePlatformKind.Platform
it.isNewMPPModule && it.externalProjectId == externalProjectId
}
} else {
moduleManager.modules.filter { name in it.findOldFashionedImplementedModuleNames() }
@@ -56,7 +59,9 @@ val Module.implementedModules: List<Module>
CachedValueProvider {
CachedValueProvider.Result(
if (isNewMPPModule) {
rootManager.dependencies.filter { it.isNewMPPModule && it.platform is CommonIdePlatformKind.Platform }
rootManager.dependencies.filter {
it.isNewMPPModule && it.platform is CommonIdePlatformKind.Platform && it.externalProjectId == externalProjectId
}
} else {
val modelsProvider = IdeModelsProviderImpl(project)
findOldFashionedImplementedModuleNames().mapNotNull { modelsProvider.findIdeModule(it) }