Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0-beta.5
1.0.0-beta.6
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dependencies {
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'org.apache.httpcomponents:httpclient:4.5.14'
implementation 'org.apache.httpcomponents:httpmime:4.5.14'
implementation 'org.pf4j:pf4j:3.9.0'

testImplementation('org.spockframework:spock-core:2.3-groovy-3.0')
testImplementation 'org.wiremock:wiremock:3.5.4'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Copyright 2013-2024, Seqera Labs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.nextflow.gradle.extensions

import org.pf4j.ExtensionPoint

/**
* Extension point interface for plugins that want to register top-level CLI commands.
*
* Plugins implementing this interface can provide commands that appear as first-class
* citizens in the Nextflow CLI, accessible directly as 'nextflow <command>' rather than
* through the legacy 'nextflow plugin <pluginId>:<command>' syntax.
*
* Example:
* - Instead of: nextflow plugin nf-wave:get-container
* - Enable: nextflow wave get-container
*
* @author Edmund Miller <edmund@seqera.io>
*/
interface CommandExtensionPoint extends ExtensionPoint {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be nextflow core classes/interfaces, not the other way around


/**
* Get the primary command name that this plugin registers.
* This will be the top-level command name (e.g., "wave", "launch").
*
* @return The command name that will be available at the top level
*/
String getCommandName()

/**
* Get the command description for help output.
* This description will appear in the main help listing.
*
* @return A brief description of what this command does
*/
String getCommandDescription()

/**
* Get the priority for this command extension.
* Higher priority commands will take precedence in case of name conflicts.
* Built-in commands have priority 1000 by default.
*
* @return Priority value (higher = higher priority), defaults to 100
*/
default int getPriority() { return 100 }

/**
* Create the actual command instance that will handle execution.
* This method is called when the command needs to be instantiated.
*
* Note: This returns Object to avoid coupling the gradle plugin to Nextflow's CmdBase.
* Implementations should return a nextflow.cli.CmdBase instance.
*
* @return A CmdBase instance that will handle the command execution
*/
Object createCommand()

}
36 changes: 36 additions & 0 deletions src/main/groovy/io/nextflow/gradle/extensions/Factory.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright 2013-2024, Seqera Labs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package io.nextflow.gradle.extensions

/**
* An annotation interface for channel factories that the plugin want to expose
* Nextflow will search for all methods annotated with @Factory in the ExtensionPoint and allow to the user imported them
*
* @author : jorge <jorge.aguilera@seqera.io>
*
*/
import java.lang.annotation.ElementType
import java.lang.annotation.Retention
import java.lang.annotation.RetentionPolicy
import java.lang.annotation.Target

@Retention(RetentionPolicy.RUNTIME)
@Target([ElementType.METHOD])
@interface Factory {

}
36 changes: 36 additions & 0 deletions src/main/groovy/io/nextflow/gradle/extensions/Function.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright 2013-2024, Seqera Labs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package io.nextflow.gradle.extensions

/**
* An annotation interface for functions that the plugin want to expose
* Nextflow will search for all methods annotated with @Functions in the ExtensionPoint and allow to the user imported them
*
* @author : jorge <jorge.aguilera@seqera.io>
*
*/
import java.lang.annotation.ElementType
import java.lang.annotation.Retention
import java.lang.annotation.RetentionPolicy
import java.lang.annotation.Target

@Retention(RetentionPolicy.RUNTIME)
@Target([ElementType.METHOD])
@interface Function {

}
36 changes: 36 additions & 0 deletions src/main/groovy/io/nextflow/gradle/extensions/Operator.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright 2013-2024, Seqera Labs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package io.nextflow.gradle.extensions

/**
* An annotation interface for operators that the plugin want to expose
* Nextflow will search for all methods annotated with @Operators in the ExtensionPoint and allow to the user imported them
*
* @author : jorge <jorge.aguilera@seqera.io>
*
*/
import java.lang.annotation.ElementType
import java.lang.annotation.Retention
import java.lang.annotation.RetentionPolicy
import java.lang.annotation.Target

@Retention(RetentionPolicy.RUNTIME)
@Target([ElementType.METHOD])
@interface Operator {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Copyright 2013-2024, Seqera Labs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package io.nextflow.gradle.extensions

import groovy.transform.PackageScope
import org.pf4j.ExtensionPoint

/**
* Define plugin extension points. A plugin can provide extension methods
* to add custom channel factories, channel operators and custom function
* in the including context.
*
* The extending subclass should mark the extension methods with the
* corresponding annotation {@link Factory}, {@link Operator} and {@link Function}
*
* Note: This returns Object for session to avoid coupling the gradle plugin
* to Nextflow's internal Session class. Implementations should expect a
* nextflow.Session instance.
*
* @author Paolo Di Tommaso <paolo.ditommaso@gmail.com>
*/
abstract class PluginExtensionPoint implements ExtensionPoint {

private boolean initialised

synchronized void checkInit(Object session) {
if( !initialised ) {
init(session)
initialised = true
}
}

/**
* Channel factory initialization. This method is invoked one and only once before
* the before target extension method is called.
*
* @param session The current nextflow Session (passed as Object to avoid coupling)
*/
abstract protected void init(Object session)

}