Skip to content
This repository has been archived by the owner on Nov 12, 2022. It is now read-only.

Commit

Permalink
fix ben-manes#704 can't modify unresolved.dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanlermitage committed Nov 12, 2022
1 parent 1c6a3fd commit bdc306e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Expand Up @@ -8,5 +8,5 @@ package com.github.benmanes.gradle.versions.reporter.result
*/
data class DependenciesGroup<T : Dependency>(
val count: Int,
val dependencies: Set<T> = sortedSetOf(),
val dependencies: MutableSet<T> = mutableSetOf(),
)
Expand Up @@ -176,38 +176,38 @@ class DependencyUpdatesReporter(
)
}

private fun buildCurrentGroup(): Set<Dependency> {
private fun buildCurrentGroup(): MutableSet<Dependency> {
return sortByGroupAndName(upToDateVersions)
.map { dep ->
updateKey(dep.key as HashMap)
buildDependency(dep.value, dep.key)
}.toSortedSet() as TreeSet<Dependency>
}.toSortedSet()
}

private fun buildOutdatedGroup(): Set<DependencyOutdated> {
private fun buildOutdatedGroup(): MutableSet<DependencyOutdated> {
return sortByGroupAndName(upgradeVersions)
.map { dep ->
updateKey(dep.key as HashMap)
buildOutdatedDependency(dep.value, dep.key)
}.toSortedSet() as TreeSet<DependencyOutdated>
}.toSortedSet()
}

private fun buildExceededGroup(): Set<DependencyLatest> {
private fun buildExceededGroup(): MutableSet<DependencyLatest> {
return sortByGroupAndName(downgradeVersions)
.map { dep ->
updateKey(dep.key as HashMap)
buildExceededDependency(dep.value, dep.key)
}.toSortedSet() as TreeSet<DependencyLatest>
}.toSortedSet()
}

private fun buildUndeclaredGroup(): Set<Dependency> {
private fun buildUndeclaredGroup(): MutableSet<Dependency> {
return undeclared
.map { coordinate ->
Dependency(coordinate.groupId, coordinate.artifactId)
}.toSortedSet() as TreeSet<Dependency>
}.toSortedSet()
}

private fun buildUnresolvedGroup(): Set<DependencyUnresolved> {
private fun buildUnresolvedGroup(): MutableSet<DependencyUnresolved> {
return unresolved
.sortedWith { a, b ->
compareKeys(keyOf(a.selector), keyOf(b.selector))
Expand Down Expand Up @@ -311,7 +311,7 @@ class DependencyUpdatesReporter(
)
}

private fun <T : Dependency> buildDependenciesGroup(dependencies: Set<T>): DependenciesGroup<T> {
private fun <T : Dependency> buildDependenciesGroup(dependencies: MutableSet<T>): DependenciesGroup<T> {
return DependenciesGroup<T>(dependencies.size, dependencies)
}

Expand Down

0 comments on commit bdc306e

Please sign in to comment.