Skip to content
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

Ensure that all plugins implement Plugin or one of its sub-interfaces #6507

Closed
7 of 8 tasks
sschuberth opened this issue Feb 17, 2023 · 7 comments
Closed
7 of 8 tasks
Labels
configuration About configuration topics enhancement Issues that are considered to be enhancements plugin Topics related to ORT plugins

Comments

@sschuberth
Copy link
Member

sschuberth commented Feb 17, 2023

ORT currently supports the following ServiceLoader-based plugins, grouped by whether they need to support plugin-specific configuration or not.

These are plugins that may require configuration and should implement the org.ossreviewtoolkit.utils.common.TypedConfigurablePluginFactory interface (ticked ones already do):

These are plugins that don't need to support configuration and should just implement the org.ossreviewtoolkit.utils.common.Plugin interface (ticked ones already do):

@sschuberth sschuberth added enhancement Issues that are considered to be enhancements configuration About configuration topics epic A "parent" issue that refers to multiple other issues labels Feb 17, 2023
@sschuberth sschuberth removed the epic A "parent" issue that refers to multiple other issues label Mar 3, 2023
@sschuberth sschuberth added the plugin Topics related to ORT plugins label Mar 3, 2023
sschuberth added a commit that referenced this issue Mar 5, 2023
@sschuberth sschuberth changed the title Ensure that all plugins implement either the ConfigurablePluginFactory or the Plugin interface Ensure that all plugins implement either the TypedConfigurablePluginFactory or the Plugin interface Oct 11, 2023
@sschuberth sschuberth pinned this issue Nov 10, 2023
@sschuberth sschuberth changed the title Ensure that all plugins implement either the TypedConfigurablePluginFactory or the Plugin interface Ensure that all plugins implement Plugin or one of its sub-interfaces Nov 24, 2023
sschuberth added a commit that referenced this issue Nov 24, 2023
Align with all other ORT plugin types and implement the `Plugin`
interface. This will allow for some common handling of all types of
plugins in an upcoming change. Also see [1] for context.

[1]: #6507

Signed-off-by: Sebastian Schuberth <[email protected]>
sschuberth added a commit that referenced this issue Nov 26, 2023
Align with all other ORT plugin types and implement the `Plugin`
interface. This will allow for some common handling of all types of
plugins in an upcoming change. Also see [1] for context.

[1]: #6507

Signed-off-by: Sebastian Schuberth <[email protected]>
@sschuberth sschuberth unpinned this issue Feb 29, 2024
@sschuberth
Copy link
Member Author

@mnonnenmacher, am I correct to assume that this issue is now obsolete in favor of implementing the new KSP-based plugin API?

@sschuberth
Copy link
Member Author

This implies to migrate reporter-specific (CLI) options to config.yml.

Also, now that reporters are migrated to the new KSP-based plugin API, should we remove the code

// Allow overwriting reporter-specific options via the command line.
reportOptions.forEach { (reporterName, option) ->
val reportSpecificConfig = reportConfigMap.getOrPut(reporterName) { PluginConfiguration.EMPTY }
val updatedConfig = reportSpecificConfig.copy(options = reportSpecificConfig.options + option)
reportConfigMap[reporterName] = updatedConfig
}

and require users to leverage the generic -P option to specify reporter-specific options? This would align with package manager plugins.

@mnonnenmacher
Copy link
Member

@mnonnenmacher, am I correct to assume that this issue is now obsolete in favor of implementing the new KSP-based plugin API?

With #9403 this issue is not required anymore.

... require users to leverage the generic -P option to specify reporter-specific options? This would align with package manager plugins.

Does this work? I thought with -P you cannot set map entries.

@sschuberth
Copy link
Member Author

Does this work? I thought with -P you cannot set map entries.

That's true (see sksamuel/hoplite#358), but I thought that with typed plugin options they would not be configured as a map anyway.

@mnonnenmacher
Copy link
Member

Does this work? I thought with -P you cannot set map entries.

I thought that with typed plugin options they would not be configured as a map anyway.

In the ORT config model it still has to be a map, because the model cannot know the config classes of the plugins.

@sschuberth
Copy link
Member Author

because the model cannot know the config classes of the plugins.

Could we solve that by making the plugin config classes of the plugin themselves also discoverable via the ServiceLoader mechanism?

@mnonnenmacher
Copy link
Member

because the model cannot know the config classes of the plugins.

Could we solve that by making the plugin config classes of the plugin themselves also discoverable via the ServiceLoader mechanism?

I don't think so. The config class would need a property of the config class type for the mapping to work, like webAppReporterConfig: WebAppReporterConfig, so it needs to be known at compile time. Or you need some interface like ReporterPluginConfig to determine the type during serialization, but then I don't know how this could work with -P. Anyway, I think it makes sense to have a separate issue for this topic if we don't have one already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
configuration About configuration topics enhancement Issues that are considered to be enhancements plugin Topics related to ORT plugins
Projects
None yet
Development

No branches or pull requests

2 participants