Skip to content

Commit

Permalink
feat(analyzer): Also fail early if managers for the same type are ena…
Browse files Browse the repository at this point in the history
…bled

This fails early additionally to the check the `DependencyGraphNavigator`
does in `directDependencies()`. The latter check is still and anyway
required to unambiguously get the direct dependencies for a project
unless the API is changed.

Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Jan 18, 2025
1 parent 0946545 commit 2273808
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions analyzer/src/main/kotlin/Analyzer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ class Analyzer(private val config: AnalyzerConfiguration, private val labels: Ma
Pair(manager, mappedFiles).takeIf { mappedFiles.isNotEmpty() }
}.toMap(mutableMapOf())

// Fail early if multiple managers for the same project type are enabled.
managedFiles.keys.groupBy { it.projectType }.forEach { (projectType, managers) ->
val managerNames = managers.map { it.managerName }
requireNotNull(managers.singleOrNull()) {
"All of the $managerNames managers are able to manage '$projectType' projects. Please enable only " +
"one of them."
}
}

// Check whether there are unmanaged files (because of deactivated, unsupported, or non-present package
// managers) which need to get attached to an artificial "unmanaged" project.
val managedDirs = managedFiles.values.flatten().mapNotNull { it.parentFile }
Expand Down

0 comments on commit 2273808

Please sign in to comment.