Skip to content

Commit

Permalink
chore(pub): Align the Gradle check with DependencyGraphNavigator
Browse files Browse the repository at this point in the history
Do not just pick the first Gradle package manager but throw if there are
multiple ones, similar to [1].

[1]: https://github.com/oss-review-toolkit/ort/blob/6d576c3d365e63535b15177bd9a41d5e4b7a51e9/model/src/main/kotlin/DependencyGraphNavigator.kt#L52-L55

Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Oct 4, 2024
1 parent 6ab1310 commit 23f425c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion plugins/package-managers/pub/src/main/kotlin/Pub.kt
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,15 @@ class Pub(

private val flutterAbsolutePath = flutterHome.resolve("bin")

private val gradleFactory = analyzerConfig.determineEnabledPackageManagers().find { it.type.startsWith("Gradle") }
private val gradleFactory = analyzerConfig.determineEnabledPackageManagers()
.filter { it.type.startsWith("Gradle") }
.let { managers ->
require(managers.size < 2) {
"All of the $managers managers are able to manage 'Gradle' projects. Please enable only one of them."
}

managers.firstOrNull()
}

private data class ParsePackagesResult(
val packages: Map<Identifier, Package>,
Expand Down

0 comments on commit 23f425c

Please sign in to comment.