Skip to content
This repository was archived by the owner on Sep 1, 2025. It is now read-only.

Commit 0dc8999

Browse files
committed
Move plugin install command to top level and make generic
1 parent c6d5999 commit 0dc8999

File tree

4 files changed

+99
-32
lines changed

4 files changed

+99
-32
lines changed

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ publish-index:
7171

7272
#
7373
# Install plugin to ~/.nextflow/plugins using Gradle
74+
# Usage: make install-plugin [plugin=nf-hello]
7475
#
7576
install-plugin:
76-
./gradlew installPlugin
77+
ifdef plugin
78+
./gradlew installSpecificPlugin -Pplugin=${plugin}
79+
else
80+
./gradlew installPlugins
81+
endif

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,30 @@ To build and test the plugin during development, configure a local Nextflow buil
9090
The plugin can be tested without using a local Nextflow build using the following steps:
9191

9292
1. Build the plugin: `make buildPlugins`
93-
2. Copy `build/plugins/<your-plugin>` to `$HOME/.nextflow/plugins`
93+
2. Install the plugin using one of these methods:
94+
95+
```bash
96+
# Install a specific plugin (if you have added new plugins to the plugins/ directory)
97+
make install-plugin plugin=nf-hello
98+
99+
# Install all available plugins
100+
make install-plugin
101+
```
102+
103+
The plugins will be installed to one of these locations, in order of precedence:
104+
- Directory specified by `NXF_PLUGINS_DIR` environment variable
105+
- `$NXF_HOME/plugins` if `NXF_HOME` is set
106+
- `$HOME/.nextflow/plugins` (default location)
107+
108+
Alternatively, you can use Gradle commands directly:
109+
```bash
110+
# Install a specific plugin
111+
./gradlew installSpecificPlugin -Pplugin=nf-hello
112+
113+
# Install all plugins
114+
./gradlew installPlugins
115+
```
116+
94117
3. Create a pipeline that uses your plugin and run it: `nextflow run ./my-pipeline-script.nf`
95118

96119
## Package, upload, and publish

plugins/build.gradle

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,44 @@ subprojects {
153153
}
154154

155155
task upload(dependsOn: [uploadPlugin] ) { }
156+
157+
/*
158+
* Task to install plugin to the Nextflow plugins directory for local testing and development.
159+
* For production deployment, see "Package, upload, and publish" section in README.md.
160+
*/
161+
task installPlugin(type: Copy, dependsOn: copyPluginZip) {
162+
description = "Installs ${project.name} plugin to the Nextflow plugins directory"
163+
group = 'Plugin Installation'
164+
165+
def pluginsDir = System.getenv('NXF_PLUGINS_DIR') ?:
166+
System.getenv('NXF_HOME') ? "${System.getenv('NXF_HOME')}/plugins" :
167+
"${System.getProperty('user.home')}/.nextflow/plugins"
168+
169+
// Use the subproject's name and version
170+
def pluginZip = file("$rootProject.buildDir/plugins/${project.name}-${project.version}.zip")
171+
def pluginDir = file("$pluginsDir/${project.name}-${project.version}")
172+
173+
doFirst {
174+
println "Installing plugin ${project.name} version ${project.version} to: $pluginDir"
175+
pluginDir.mkdirs()
176+
}
177+
178+
from zipTree(pluginZip)
179+
into pluginDir
180+
181+
doLast {
182+
println "Plugin ${project.name} installed successfully!"
183+
println "Installation location: $pluginDir"
184+
println "Installation location determined by:"
185+
if (System.getenv('NXF_PLUGINS_DIR')) {
186+
println " - NXF_PLUGINS_DIR environment variable"
187+
} else if (System.getenv('NXF_HOME')) {
188+
println " - NXF_HOME environment variable"
189+
} else {
190+
println " - Default location (~/.nextflow/plugins)"
191+
}
192+
}
193+
}
156194
}
157195

158196
/*
@@ -176,3 +214,34 @@ task publishIndex( type: io.nextflow.gradle.tasks.GithubRepositoryPublisher ) {
176214
githubEmail = github_commit_email
177215
githubToken = github_access_token
178216
}
217+
218+
/*
219+
* Task to install all plugins to the Nextflow plugins directory
220+
*/
221+
task installPlugins() {
222+
description = 'Installs all plugins to the Nextflow plugins directory'
223+
group = 'Plugin Installation'
224+
225+
dependsOn subprojects.installPlugin
226+
}
227+
228+
/*
229+
* Task to install a specific plugin by name
230+
* Usage: ./gradlew installPlugin -Pplugin=nf-hello
231+
*/
232+
task installSpecificPlugin {
233+
description = 'Installs a specific plugin (specify with -Pplugin=plugin-name)'
234+
group = 'Plugin Installation'
235+
236+
doFirst {
237+
if (!project.hasProperty('plugin')) {
238+
throw new GradleException("Please specify a plugin name using -Pplugin=plugin-name")
239+
}
240+
def pluginName = project.property('plugin')
241+
def pluginProject = project.findProject(":plugins:${pluginName}")
242+
if (!pluginProject) {
243+
throw new GradleException("Plugin '${pluginName}' not found")
244+
}
245+
dependsOn pluginProject.installPlugin
246+
}
247+
}

plugins/nf-hello/build.gradle

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -88,33 +88,3 @@ test {
8888
useJUnitPlatform()
8989
}
9090

91-
// Task to install the plugin to the Nextflow plugins directory
92-
task installPlugin(type: Copy, dependsOn: copyPluginZip) {
93-
def pluginsDir = System.getenv('NXF_PLUGINS_DIR') ?:
94-
System.getenv('NXF_HOME') ? "${System.getenv('NXF_HOME')}/plugins" :
95-
"${System.getProperty('user.home')}/.nextflow/plugins"
96-
97-
def pluginZip = file("$rootProject.buildDir/plugins/${project.name}-${project.version}.zip")
98-
def pluginDir = file("$pluginsDir/${project.name}-${project.version}")
99-
100-
doFirst {
101-
println "Installing plugin to: $pluginDir"
102-
pluginDir.mkdirs()
103-
}
104-
105-
from zipTree(pluginZip)
106-
into pluginDir
107-
108-
doLast {
109-
println "Plugin installed successfully!"
110-
println "Installation location determined by:"
111-
if (System.getenv('NXF_PLUGINS_DIR')) {
112-
println " - NXF_PLUGINS_DIR environment variable"
113-
} else if (System.getenv('NXF_HOME')) {
114-
println " - NXF_HOME environment variable"
115-
} else {
116-
println " - Default location (~/.nextflow/plugins)"
117-
}
118-
}
119-
}
120-

0 commit comments

Comments
 (0)