Skip to content

Commit

Permalink
feat(cli): Use the resolved resolutions in NotifierCommand
Browse files Browse the repository at this point in the history
If available, use only the resolved resolutions in the
`NotifierCommand` instead of resolving them again. This increases
consistency with previously executed ORT commands.

Signed-off-by: Martin Nonnenmacher <[email protected]>
  • Loading branch information
mnonnenmacher committed Mar 15, 2024
1 parent 4bf2ada commit 6279ba7
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions plugins/commands/notifier/src/main/kotlin/NotifierCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,14 @@ class NotifierCommand : OrtCommand(

override fun run() {
val ortResult = readOrtResult(ortFile).mergeLabels(labels)
val notifier = Notifier(
ortResult,
ortConfig.notifier,
DefaultResolutionProvider.create(ortResult, resolutionsFile)
)

// If available, use only the resolved resolutions.
val resolutionProvider = when (ortResult.resolvedConfiguration.resolutions) {
null -> DefaultResolutionProvider.create(ortResult, resolutionsFile)
else -> ortResult
}

val notifier = Notifier(ortResult, ortConfig.notifier, resolutionProvider)

val script = notificationsFile?.readText() ?: readDefaultNotificationsFile()
notifier.run(script)
Expand Down

0 comments on commit 6279ba7

Please sign in to comment.