-
Notifications
You must be signed in to change notification settings - Fork 317
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
Package curation provider plugins #6308
Conversation
0d7f05f
to
5155072
Compare
*/ | ||
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 comment
The 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.
analyzer/src/main/kotlin/curation/FilePackageCurationProvider.kt
Outdated
Show resolved
Hide resolved
analyzer/src/main/kotlin/curation/Sw360PackageCurationProvider.kt
Outdated
Show resolved
Hide resolved
a099b06
to
faccfa6
Compare
@oss-review-toolkit/core-devs I decided to move the files to the new plugins folder which we discussed yesterday in a separate PR as I added some commits to clean up |
FYI @mnonnenmacher, |
faccfa6
to
55d7695
Compare
Should be fixed now. |
55d7695
to
9cb0765
Compare
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) }.reversed() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use .asReversed()
to avoid creating a copy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually unsure about this. Personally, I would expect curation providers to be queried / curations be applied in the order I define them in the configuration, and not for the order to express a priority.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found it unintuitive for the user that higher priority providers would come later in the list, because a user will likely not know technical details about how curations are applied. For example, if ClearlyDefined
is put before SW360
it seemed clearer to me that in case of a conflict ClearlyDefined
wins.
and not for the order to express a priority
It does either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have other places in the config where order expresses priority that we could align with?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I don't have a strong opinion here, it just confused me. Should we ask for other opinions from @oss-review-toolkit/kotlin-devs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use
.asReversed()
to avoid creating a copy.
I believe this is the only open remark, otherwise I'd simply approve now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
9cb0765
to
cdbe68f
Compare
- name: File | ||
config: | ||
path: '/some-path/curations.yml' | ||
- name: File |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be "Dir" or "Directory"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is currently only the FilePackageCurationProvider
which handles both files and dirs. I would like to split this later on, but not in this PR.
Verify that the curation directory is a directory before trying to find curation files in it. Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.io>
Add the new interface `ConfigurablePluginFactory` which can be implemented by plugins that need to be configured on creation. Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.io>
Add a `PackageCurationProviderFactory` plugin extension point. Fixes #6056. Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.io>
Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.io>
Add the model required to configure package curation providers in the ORT configuration. It will be taken into use in the following commits. Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.io>
Use the `PackageCurationProviderFactory` to create the package curation providers that are configured in the config file and remove the now unused command line options to enable package curation providers. The only exception is currently the provider that reads package curations from the repository configuration, this will be handled in a later commit. Remove the test from `OrtMainFunTest` that tests the removed `--package-curations-file` option and instead apply curations in the "Analyzer creates correct output" test. Fixes #6055. Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.io>
Align the order of top-level configuration options with the order of properties in `OrtConfiguration`. Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.io>
Verify properties in the same order as they are defined in reference.yml. Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.io>
Add verification for properties from `reference.yml` that were not verified before. Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.io>
The configuration was used to configure the `Sw360PackageCurationProvider` which is now configured in a separate section of the configuration file. Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.io>
cdbe68f
to
6538a3b
Compare
Just curious, if |
In the |
On the long term the |
Make package curation providers configurable plugins. Please see the commit messages for details.
Breaking change:
This PR adds a new section
packageCurationProviders
to theconfig.yml
which is used to configure the package curation providers. The configuration of theSw360PackageCurationProvider
moved fromAnalyzerConfiguration
to this new section. The command line options ofAnalzyerCommand
to enable curation providers have been removed, instead this now needs to be configured inconfig.yml
. See the changes toreference.yml
in this PR for possible configuration options, this includes also an example for how to enable/disable a specific provider using an environment variable.