Skip to content
This repository has been archived by the owner on Feb 17, 2025. It is now read-only.

Commit

Permalink
Fix a potential StackOverflowError in PDMGenDependenciesTask.kt that …
Browse files Browse the repository at this point in the history
…would be caused if there was a cycle in transitive dependencies (eg adventure-api / adventure-bom)
  • Loading branch information
bristermitten committed Jan 31, 2021
1 parent 554c24e commit b85ffff
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ class PDMGenDependenciesTask(
searchRepositories: Boolean,
repositories: Map<String, Repository>,
isProject: Boolean,
excludeRules: List<ExcludeRule>
excludeRules: List<ExcludeRule>,
resolved: MutableSet<Artifact> = mutableSetOf()
): PDMDependency
{
if(isProject && config.projectRepository != null)
Expand Down Expand Up @@ -160,8 +161,11 @@ class PDMGenDependenciesTask(
}

val dependencies = containingRepo.second?.getTransitiveDependencies(this)
?.asSequence()
?.filterNot { excludeRules.any { rule -> rule.match(it) } }
?.map { it.resolvePDMDependency(spigot, searchRepositories, repositories, isProject, excludeRules) }
?.filterNot { it in resolved }
?.onEach { resolved.add(it) }
?.map { it.resolvePDMDependency(spigot, searchRepositories, repositories, isProject, excludeRules, resolved) }
?.toSet()

return PDMDependency(groupId, artifactId, version, containingRepo.first, dependencies)
Expand Down

0 comments on commit b85ffff

Please sign in to comment.