-
Notifications
You must be signed in to change notification settings - Fork 352
Package curation provider plugins #6308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
eddd815
FilePackageCurationProvider: Verify the curation directory
mnonnenmacher 83229cb
PluginManager: Add a `ConfigurablePluginFactory`
mnonnenmacher 0d10fb8
analyzer: Add a `PackageCurationProviderFactory`
mnonnenmacher 4937f49
OrtConfiguration: Add a missing space
mnonnenmacher d38b483
model: Add a configuration model for package curation providers
mnonnenmacher d6c5767
AnalyzerCommand: Create package curation providers from config file
mnonnenmacher aac6f5b
reference.yml: Align order with `OrtConfiguration` class
mnonnenmacher 588c696
OrtConfigurationTest: Align order of verification with reference.yml
mnonnenmacher fd95d54
OrtConfigurationTest: Add missing verifications for reference.yml
mnonnenmacher 6538a3b
AnalyzerConfiguration: Remove unused SW360 configuration
mnonnenmacher File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,35 @@ package org.ossreviewtoolkit.analyzer | |
|
||
import org.ossreviewtoolkit.model.Identifier | ||
import org.ossreviewtoolkit.model.PackageCuration | ||
import org.ossreviewtoolkit.model.config.PackageCurationProviderConfiguration | ||
import org.ossreviewtoolkit.utils.common.ConfigurablePluginFactory | ||
mnonnenmacher marked this conversation as resolved.
Show resolved
Hide resolved
sschuberth marked this conversation as resolved.
Show resolved
Hide resolved
|
||
import org.ossreviewtoolkit.utils.common.NamedPlugin | ||
|
||
/** | ||
* The extension point for [PackageCurationProvider]s. | ||
*/ | ||
interface PackageCurationProviderFactory<CONFIG> : ConfigurablePluginFactory<PackageCurationProvider> { | ||
companion object { | ||
val ALL = NamedPlugin.getAll<PackageCurationProviderFactory<*>>() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note to myself: I was actually surprised that this (is supposed to) work(s) here as generic types get erased at compile time. But after reading through the excellent https://typealias.com/guides/star-projections-and-how-they-work/ I see how this could work. |
||
|
||
fun create(configurations: List<PackageCurationProviderConfiguration>) = | ||
// Reverse the list so that curations from providers with higher priority are applied later and can | ||
// overwrite curations from providers with lower priority. | ||
configurations.filter { it.enabled }.map { ALL.getValue(it.name).create(it.config) }.asReversed() | ||
} | ||
|
||
override fun create(config: Map<String, String>): PackageCurationProvider = create(parseConfig(config)) | ||
|
||
/** | ||
* Create a new [PackageCurationProvider] with [config]. | ||
*/ | ||
fun create(config: CONFIG): PackageCurationProvider | ||
|
||
/** | ||
* Parse the [config] map into an object. | ||
*/ | ||
fun parseConfig(config: Map<String, String>): CONFIG | ||
} | ||
|
||
/** | ||
* A provider for [PackageCuration]s. | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
.../resources/META-INF/services/org.ossreviewtoolkit.analyzer.PackageCurationProviderFactory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
org.ossreviewtoolkit.analyzer.curation.ClearlyDefinedPackageCurationProviderFactory | ||
org.ossreviewtoolkit.analyzer.curation.DefaultDirPackageCurationProviderFactory | ||
org.ossreviewtoolkit.analyzer.curation.DefaultFilePackageCurationProviderFactory | ||
org.ossreviewtoolkit.analyzer.curation.FilePackageCurationProviderFactory | ||
org.ossreviewtoolkit.analyzer.curation.OrtConfigPackageCurationProviderFactory | ||
org.ossreviewtoolkit.analyzer.curation.Sw360PackageCurationProviderFactory |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.