Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ianoc committed Aug 18, 2022
1 parent f313ff7 commit a9f435f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/scala/com/github/johnynek/bazel_deps/GradleResolver.scala
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ class GradleResolver(
private def cleanUpMap(
depMap: Map[String, GradleLockDependency]
): Try[Map[String, GradleLockDependency]] = {
// First check its fully connected
val noContentDeps: Map[String, Option[Version]] = gradleTpe.getNoContentDeps

// First check its fully connected
val connected = depMap.foldLeft(Try(())) { case (p, (outerK, v)) =>
v.transitive.getOrElse(Nil).foldLeft(p) { case (p, luK) =>
if (!depMap.contains(luK)) {
Expand Down Expand Up @@ -112,7 +112,11 @@ class GradleResolver(
case h :: t =>
val hData = projectsRemoved.getOrElse(
h,
sys.error(s"Map in invalid state, tried to get: $h from projectsRemoved but it wasn't present.")
sys.error(s"""
|Map in invalid state
|tried to get: $h but it wasn't present
|this dependency is a project? Not expected here.
|Looking for $nK ---> $nV""".stripMargin)
)
val matchNoContentRes = noContentDeps
.get(h)
Expand All @@ -135,7 +139,8 @@ class GradleResolver(
go(t, loop, h :: acc)
}
case Nil =>
val lst = acc.sorted.distinct
// we are recursing a transitive chain, we need to repeat the filter here
val lst = acc.sorted.distinct.filter(projectsRemoved.contains(_))
if (loop) {
go(lst, false, Nil)
} else {
Expand Down

0 comments on commit a9f435f

Please sign in to comment.