Skip to content

Commit

Permalink
refactor(maven): Operate on sets of repositories
Browse files Browse the repository at this point in the history
This addresses an inspection hint about performance.

Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Nov 10, 2023
1 parent 72cbc73 commit 17f3ad1
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -509,10 +509,10 @@ class MavenSupport(private val workspaceReader: WorkspaceReader) {
val artifactDescriptorRequest = ArtifactDescriptorRequest(artifact, repositories, "project")
val artifactDescriptorResult = repoSystem
.readArtifactDescriptor(repositorySystemSession, artifactDescriptorRequest)
(repositories + artifactDescriptorResult.repositories).distinct()
repositories + artifactDescriptorResult.repositories
} else {
repositories
}
}.toSet()

val cacheKey = "$artifact@$allRepositories"

Expand All @@ -529,7 +529,7 @@ class MavenSupport(private val workspaceReader: WorkspaceReader) {
val proxy = repositorySystemSession.proxySelector.getProxy(repository)
val authentication = repositorySystemSession.authenticationSelector.getAuthentication(repository)
RemoteRepository.Builder(repository).setAuthentication(authentication).setProxy(proxy).build()
}
}.toSet()

if (allRepositories.size > remoteRepositories.size) {
logger.debug { "Ignoring local repositories ${allRepositories - remoteRepositories}." }
Expand Down

0 comments on commit 17f3ad1

Please sign in to comment.