MPP: Merge module dependencies if one of them has COMPILE scope
This commit is contained in:
@@ -16,6 +16,12 @@ fun addModuleDependencyIfNeeded(
|
||||
) {
|
||||
val dependencyScope = if (testScope) DependencyScope.TEST else DependencyScope.COMPILE
|
||||
val existingEntry = rootModel.findModuleOrderEntry(dependeeModule)
|
||||
if (existingEntry != null && existingEntry.scope == dependencyScope) return
|
||||
if (existingEntry != null) {
|
||||
val existingScope = existingEntry.scope
|
||||
if (existingScope == DependencyScope.COMPILE || existingScope == dependencyScope) return
|
||||
if (dependencyScope == DependencyScope.COMPILE) {
|
||||
rootModel.removeOrderEntry(existingEntry)
|
||||
}
|
||||
}
|
||||
rootModel.addModuleOrderEntry(dependeeModule).also { it.scope = dependencyScope }
|
||||
}
|
||||
Reference in New Issue
Block a user