Skip to content

Commit

Permalink
combine scope, then create pair
Browse files Browse the repository at this point in the history
  • Loading branch information
benmusson authored and brianeray committed Aug 16, 2024
1 parent 738a9f5 commit 376f0a2
Showing 1 changed file with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,17 +223,15 @@ open class WriteModuleXml @Inject constructor(_objects: ObjectFactory) : Default
.flatMap { mani -> mani.artifacts }
.groupBy { arti -> arti.jarName }
.map { (jar, artifacts) ->
Pair(
jar,
// Combine all scopes for the artifact
artifacts.fold(setOf<Char>()) { scope, arti ->
scope.union(
manifests
.filter { mani -> arti in mani.artifacts }
.flatMap { mani -> mani.scope.toList() }
)
}.joinToString("")
)
val combinedScope = artifacts.fold(setOf<Char>()) { scope, arti ->
scope.union(
manifests
.filter { mani -> arti in mani.artifacts }
.flatMap { mani -> mani.scope.toList() }
)
}.joinToString("")

jar to combinedScope
}.sortedWith(
compareByDescending<Pair<String, String>> { (_, scope) -> scope.length }
.thenBy { (_, scope) -> scope }
Expand Down

0 comments on commit 376f0a2

Please sign in to comment.