Skip to content

Commit 9eec1ef

Browse files
authored
Merge pull request #547 from mdedetrich/add-ability-filter-configurations
2 parents e502604 + f5cae95 commit 9eec1ef

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

core/src/main/scala/sbt/librarymanagement/UpdateReportExtra.scala

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -142,18 +142,25 @@ private[librarymanagement] abstract class UpdateReportExtra {
142142
}
143143
}
144144

145-
def allModuleReports: Vector[ModuleReport] = {
146-
configurations.flatMap(_.modules).groupBy(mR => moduleKey(mR.module)).toVector map {
147-
case (_, v) =>
148-
v reduceLeft { (agg, x) =>
149-
agg.withConfigurations(
150-
(agg.configurations, x.configurations) match {
151-
case (v, _) if v.isEmpty => x.configurations
152-
case (ac, v) if v.isEmpty => ac
153-
case (ac, xc) => ac ++ xc
154-
}
155-
)
156-
}
145+
def allModuleReports: Vector[ModuleReport] = allModuleReports(_ => true)
146+
147+
def allModuleReports(
148+
filterConfiguration: ConfigurationReport => Boolean
149+
): Vector[ModuleReport] = {
150+
configurations
151+
.filter(filterConfiguration)
152+
.flatMap(_.modules)
153+
.groupBy(mR => moduleKey(mR.module))
154+
.toVector map { case (_, v) =>
155+
v reduceLeft { (agg, x) =>
156+
agg.withConfigurations(
157+
(agg.configurations, x.configurations) match {
158+
case (v, _) if v.isEmpty => x.configurations
159+
case (ac, v) if v.isEmpty => ac
160+
case (ac, xc) => ac ++ xc
161+
}
162+
)
163+
}
157164
}
158165
}
159166

0 commit comments

Comments
 (0)