Model mapping: simulate associateWith by just adding a module dependency

This commit is contained in:
Sergey Igushkin
2022-02-01 01:15:22 +04:00
committed by Space
parent ab8284d5b8
commit ffec4a1a43
@@ -455,7 +455,12 @@ internal open class VariantMappedCompilationDetails<T : KotlinCommonOptions>(
}
override fun associateWith(other: CompilationDetails<*>) {
throw UnsupportedOperationException("not supported in the mapped model")
if (other !is VariantMappedCompilationDetails<*>)
error("a mapped variant can't be associated with a legacy one")
val otherModule = other.variant.containingModule
if (otherModule === variant.containingModule)
error("cannot associate $compilation with ${other.compilation} as they are mapped to the same $otherModule")
variant.containingModule.dependencies { implementation(otherModule) }
}
override val associateCompilations: Set<CompilationDetails<*>> get() = emptySet()