Skip to content
This repository has been archived by the owner on Dec 22, 2023. It is now read-only.

Commit

Permalink
allow to specify services in idx
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorge Aguilera committed Dec 13, 2023
1 parent 35bfe1c commit d03b7fc
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 5 deletions.
18 changes: 14 additions & 4 deletions buildSrc/src/main/groovy/nextflow/plugins/GenerateIdxTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@ package nextflow.plugins

import org.gradle.api.DefaultTask
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction


class GenerateIdxTask extends DefaultTask{
abstract class GenerateIdxTask extends DefaultTask{

@Internal
abstract ListProperty<String> extensionPoints

@OutputFile
final abstract RegularFileProperty outputFile =
Expand All @@ -20,13 +25,18 @@ class GenerateIdxTask extends DefaultTask{

@TaskAction
def runTask() {
def matcher = new SourcesMatcher(project)
def output = outputFile.get().asFile

if( extensionPoints.getOrElse([]).size() ){
output.text = extensionPoints.getOrElse([]).join('\n')
return
}

def matcher = new SourcesMatcher(project)
def extensionsClassName = matcher.pluginExtensions
def traceClassName = matcher.traceObservers

output.text = (extensionsClassName+traceClassName).join('\n')
def all = extensionsClassName+traceClassName
output.text = all.join('\n')
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class NextflowPlugin implements Plugin<Project>{
downloadUrl = nextflowPluginExtension.downloadUrl
})
target.tasks.register('generateIdx', GenerateIdxTask, {
extensionPoints = nextflowPluginExtension.extensionPoints
})
target.tasks.findByName("processResources").dependsOn(target.tasks.findByName("generateIdx"))
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package nextflow.plugins

import org.gradle.api.Project
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.Property

class NextflowPluginExtension {
Expand All @@ -13,6 +14,8 @@ class NextflowPluginExtension {

final Property<String> pluginClassName

final ListProperty<String> extensionPoints

final private Project project

NextflowPluginExtension(Project project){
Expand All @@ -21,6 +24,7 @@ class NextflowPluginExtension {
downloadUrl = project.objects.property(String)
githubOrganization = project.objects.property(String)
pluginClassName = project.objects.property(String)
extensionPoints = project.objects.listProperty(String)
}

void setNextflowVersion(String nextflowVersion){
Expand Down Expand Up @@ -57,4 +61,8 @@ class NextflowPluginExtension {
this.pluginClassName.set(pluginClassName)
}

void setExtensionPoints(List<String> extensions){
this.extensionPoints.set(extensions)
}

}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=0.3.0
version=0.4.0
7 changes: 7 additions & 0 deletions nf-plugin.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
nextflowPlugin{
githubOrganization = 'YOUR_GITHUB_ACCOUNT'

// pluginClassName, if not specified, can be calculated by gradle tasks
// pluginClassName = 'com.nextflow.plugin.ExamplePlugin'

// GenerateIdx scan your classes and generate the idx.
// In case you want to specify which extensions to use you can use extensionPoints
extensionPoints = [
// i.e 'com.nextflow.plugin.ExampleFunctions'
]
}

dependencies {
Expand Down

0 comments on commit d03b7fc

Please sign in to comment.