Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: include project description json at both external and internal coordinates. #1277

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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