Skip to content

Commit

Permalink
Improve error message for missing plugin extension [ci fast]
Browse files Browse the repository at this point in the history
Signed-off-by: Paolo Di Tommaso <[email protected]>
  • Loading branch information
pditommaso committed Jun 19, 2022
1 parent 7118849 commit 4a43db8
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import groovyx.gpars.dataflow.DataflowReadChannel
import groovyx.gpars.dataflow.DataflowWriteChannel
import nextflow.Global
import nextflow.Session
import nextflow.exception.AbortOperationException
import nextflow.plugin.Plugins
import nextflow.script.ChannelOut
/**
Expand Down Expand Up @@ -104,10 +105,12 @@ class ChannelExtensionProvider implements ExtensionProvider {
* The class itself to allow method chaining
*/
ChannelExtensionProvider loadPluginExtensionMethods(String pluginId, Map<String, String> includedNames){
final ext= findPluginExtensionMethods(pluginId)
if( ext ) {
loadPluginExtensionMethods(ext, includedNames)
}
final extensions= Plugins.getExtensionsInPluginId(ChannelExtensionPoint, pluginId)
if( !extensions )
throw new AbortOperationException("Plugin '$pluginId' does not implement any extension point")
if( extensions.size()>1 )
throw new AbortOperationException("Plugin '$pluginId' implements more than one extension point: ${extensions.collect(it -> it.class.getSimpleName()).join(',')}")
loadPluginExtensionMethods(extensions.first(), includedNames)
return instance = this
}

Expand Down Expand Up @@ -214,10 +217,6 @@ class ChannelExtensionProvider implements ExtensionProvider {
}
}

protected ChannelExtensionPoint findPluginExtensionMethods(String pluginId) {
Plugins.getExtensionsInPluginId(ChannelExtensionPoint, pluginId)?.first()
}

@Deprecated
static void reloadExtensionPoints() {
if( !instance )
Expand Down

0 comments on commit 4a43db8

Please sign in to comment.