[Gradle][MPP] GranularMetadataTransformation: Avoid re-processing dependencies

Do not process any dependency that was already processed previously.
When filling up the 'resolvedDependencyQueue' there is already
one filter present, checking that the resolved dependency was not
already visited.

However, this filter is insufficient, since the queue is just an
ArrayDeque and not a set. It happened that many dependencies
were enqueued multiple, multiple times.
This commit is contained in:
sebastian.sellmair
2022-06-08 16:08:44 +02:00
committed by Space
parent 8c904fdab2
commit 8b595cd804
@@ -162,7 +162,10 @@ internal class GranularMetadataTransformation(
while (resolvedDependencyQueue.isNotEmpty()) {
val (resolvedDependency: ResolvedComponentResult, parent: ResolvedComponentResult?) = resolvedDependencyQueue.poll()
visitedDependencies.add(resolvedDependency)
if (!visitedDependencies.add(resolvedDependency)) {
/* Already processed this dependency */
continue
}
val dependencyResult = processDependency(
resolvedDependency,