Skip to content

Commit

Permalink
fix: include project description json at both external and internal c…
Browse files Browse the repository at this point in the history
…oordinates.
  • Loading branch information
autonomousapps committed Oct 2, 2024
1 parent a357e9a commit 978172a
Showing 1 changed file with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
// SPDX-License-Identifier: Apache-2.0
package com.autonomousapps.tasks

import com.autonomousapps.internal.utils.*
import com.autonomousapps.internal.utils.bufferWriteJson
import com.autonomousapps.internal.utils.fromJson
import com.autonomousapps.internal.utils.fromJsonSet
import com.autonomousapps.internal.utils.fromNullableJsonSet
import com.autonomousapps.model.*
import com.autonomousapps.model.intermediates.*
import com.autonomousapps.services.InMemoryCache
Expand Down Expand Up @@ -158,13 +161,17 @@ abstract class SynthesizeDependenciesTask @Inject constructor(
dependencies.forEach { dependency ->
// Do not add dependencies that are already known again
val coordinatesAlreadyKnown = builders.values.any {
it.coordinates == dependency || (
// If the dependency is pointing at a project, there might already be an artifact
// stored under matching IncludedBuildCoordinates.
it.coordinates is IncludedBuildCoordinates
&& dependency.identifier == it.coordinates.resolvedProject.identifier
&& dependency.gradleVariantIdentification.variantMatches(it.coordinates.resolvedProject)
)
it.coordinates == dependency
// TODO(tsr): including the following in the check is too aggressive and can lead to failures in the
// ProjectVariant::dependencies function when looking for a file. This can happen, I think, when a dependency
// is specified as an external dependency but ends up getting resolved as a local project dependency instead.
// The simplest thing is to include the json file for this dep twice. Wastes some disk space (etc), but
// solves the problem. I doubt this is the best solution to the problem.
// If the dependency is pointing at a project, there might already be an artifact
// stored under matching IncludedBuildCoordinates.
// || (it.coordinates is IncludedBuildCoordinates
// && dependency.identifier == it.coordinates.resolvedProject.identifier
// && dependency.gradleVariantIdentification.variantMatches(it.coordinates.resolvedProject))
}
if (!coordinatesAlreadyKnown) {
builders.merge(
Expand Down

0 comments on commit 978172a

Please sign in to comment.