From 3ed956be9a1bbe68bdef0f18117aa242be0a4392 Mon Sep 17 00:00:00 2001 From: Rob Syme Date: Wed, 4 Dec 2024 16:37:01 -0500 Subject: [PATCH 1/5] Add Make command to install plugin locally for testing Signed-off-by: Rob Syme --- Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ad40b01..71d12be 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,3 @@ - config ?= compileClasspath ifdef module @@ -53,7 +52,6 @@ assemble: # # generate build zips under build/plugins -# you can install the plugin copying manually these files to $HOME/.nextflow/plugins # buildPlugins: ./gradlew copyPluginZip @@ -70,3 +68,9 @@ upload-plugins: publish-index: ./gradlew plugins:publishIndex + +# +# Install plugin to ~/.nextflow/plugins using Gradle +# +install-plugin: + ./gradlew installPlugin From 1f0a1617bf4299d972d252421d0e779ae8306c67 Mon Sep 17 00:00:00 2001 From: Rob Syme Date: Wed, 4 Dec 2024 16:37:32 -0500 Subject: [PATCH 2/5] Explicitly adds the JUnit Platform Launcher as a test runtime dependency This fix is to address the deprecation warning that occurs when running tests. This solution follows the recommended approach from the Gradle documentation and should resolve the deprecation warning while maintaining the same test functionality. Signed-off-by: Rob Syme --- plugins/nf-hello/build.gradle | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/plugins/nf-hello/build.gradle b/plugins/nf-hello/build.gradle index c051b00..204e5ac 100644 --- a/plugins/nf-hello/build.gradle +++ b/plugins/nf-hello/build.gradle @@ -78,6 +78,9 @@ dependencies { modules { module("commons-logging:commons-logging") { replacedBy("org.slf4j:jcl-over-slf4j") } } + + // Add this line to explicitly declare the test framework launcher + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' } // use JUnit 5 platform @@ -85,3 +88,33 @@ test { useJUnitPlatform() } +// Task to install the plugin to the Nextflow plugins directory +task installPlugin(type: Copy, dependsOn: copyPluginZip) { + def pluginsDir = System.getenv('NXF_PLUGINS_DIR') ?: + System.getenv('NXF_HOME') ? "${System.getenv('NXF_HOME')}/plugins" : + "${System.getProperty('user.home')}/.nextflow/plugins" + + def pluginZip = file("$rootProject.buildDir/plugins/${project.name}-${project.version}.zip") + def pluginDir = file("$pluginsDir/${project.name}-${project.version}") + + doFirst { + println "Installing plugin to: $pluginDir" + pluginDir.mkdirs() + } + + from zipTree(pluginZip) + into pluginDir + + doLast { + println "Plugin installed successfully!" + println "Installation location determined by:" + if (System.getenv('NXF_PLUGINS_DIR')) { + println " - NXF_PLUGINS_DIR environment variable" + } else if (System.getenv('NXF_HOME')) { + println " - NXF_HOME environment variable" + } else { + println " - Default location (~/.nextflow/plugins)" + } + } +} + From 78600c5570f810a425a2c539b2d1e05c400a11c7 Mon Sep 17 00:00:00 2001 From: Rob Syme Date: Thu, 5 Dec 2024 22:40:17 -0500 Subject: [PATCH 3/5] Move plugin install command to top level and make generic Signed-off-by: Rob Syme --- Makefile | 7 +++- README.md | 25 ++++++++++++- plugins/build.gradle | 69 +++++++++++++++++++++++++++++++++++ plugins/nf-hello/build.gradle | 30 --------------- 4 files changed, 99 insertions(+), 32 deletions(-) diff --git a/Makefile b/Makefile index 71d12be..875daf3 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,11 @@ publish-index: # # Install plugin to ~/.nextflow/plugins using Gradle +# Usage: make install-plugin [plugin=nf-hello] # install-plugin: - ./gradlew installPlugin +ifdef plugin + ./gradlew installSpecificPlugin -Pplugin=${plugin} +else + ./gradlew installPlugins +endif \ No newline at end of file diff --git a/README.md b/README.md index dc8bc09..6973f22 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,30 @@ To build and test the plugin during development, configure a local Nextflow buil The plugin can be tested without using a local Nextflow build using the following steps: 1. Build the plugin: `make buildPlugins` -2. Copy `build/plugins/` to `$HOME/.nextflow/plugins` +2. Install the plugin using one of these methods: + + ```bash + # Install a specific plugin (if you have added new plugins to the plugins/ directory) + make install-plugin plugin=nf-hello + + # Install all available plugins + make install-plugin + ``` + + The plugins will be installed to one of these locations, in order of precedence: + - Directory specified by `NXF_PLUGINS_DIR` environment variable + - `$NXF_HOME/plugins` if `NXF_HOME` is set + - `$HOME/.nextflow/plugins` (default location) + + Alternatively, you can use Gradle commands directly: + ```bash + # Install a specific plugin + ./gradlew installSpecificPlugin -Pplugin=nf-hello + + # Install all plugins + ./gradlew installPlugins + ``` + 3. Create a pipeline that uses your plugin and run it: `nextflow run ./my-pipeline-script.nf` ## Package, upload, and publish diff --git a/plugins/build.gradle b/plugins/build.gradle index ed5a617..3c92c2a 100644 --- a/plugins/build.gradle +++ b/plugins/build.gradle @@ -153,6 +153,44 @@ subprojects { } task upload(dependsOn: [uploadPlugin] ) { } + + /* + * Task to install plugin to the Nextflow plugins directory for local testing and development. + * For production deployment, see "Package, upload, and publish" section in README.md. + */ + task installPlugin(type: Copy, dependsOn: copyPluginZip) { + description = "Installs ${project.name} plugin to the Nextflow plugins directory" + group = 'Plugin Installation' + + def pluginsDir = System.getenv('NXF_PLUGINS_DIR') ?: + System.getenv('NXF_HOME') ? "${System.getenv('NXF_HOME')}/plugins" : + "${System.getProperty('user.home')}/.nextflow/plugins" + + // Use the subproject's name and version + def pluginZip = file("$rootProject.buildDir/plugins/${project.name}-${project.version}.zip") + def pluginDir = file("$pluginsDir/${project.name}-${project.version}") + + doFirst { + println "Installing plugin ${project.name} version ${project.version} to: $pluginDir" + pluginDir.mkdirs() + } + + from zipTree(pluginZip) + into pluginDir + + doLast { + println "Plugin ${project.name} installed successfully!" + println "Installation location: $pluginDir" + println "Installation location determined by:" + if (System.getenv('NXF_PLUGINS_DIR')) { + println " - NXF_PLUGINS_DIR environment variable" + } else if (System.getenv('NXF_HOME')) { + println " - NXF_HOME environment variable" + } else { + println " - Default location (~/.nextflow/plugins)" + } + } + } } /* @@ -176,3 +214,34 @@ task publishIndex( type: io.nextflow.gradle.tasks.GithubRepositoryPublisher ) { githubEmail = github_commit_email githubToken = github_access_token } + +/* + * Task to install all plugins to the Nextflow plugins directory + */ +task installPlugins() { + description = 'Installs all plugins to the Nextflow plugins directory' + group = 'Plugin Installation' + + dependsOn subprojects.installPlugin +} + +/* + * Task to install a specific plugin by name + * Usage: ./gradlew installPlugin -Pplugin=nf-hello + */ +task installSpecificPlugin { + description = 'Installs a specific plugin (specify with -Pplugin=plugin-name)' + group = 'Plugin Installation' + + doFirst { + if (!project.hasProperty('plugin')) { + throw new GradleException("Please specify a plugin name using -Pplugin=plugin-name") + } + def pluginName = project.property('plugin') + def pluginProject = project.findProject(":plugins:${pluginName}") + if (!pluginProject) { + throw new GradleException("Plugin '${pluginName}' not found") + } + dependsOn pluginProject.installPlugin + } +} diff --git a/plugins/nf-hello/build.gradle b/plugins/nf-hello/build.gradle index 204e5ac..0f1bec2 100644 --- a/plugins/nf-hello/build.gradle +++ b/plugins/nf-hello/build.gradle @@ -88,33 +88,3 @@ test { useJUnitPlatform() } -// Task to install the plugin to the Nextflow plugins directory -task installPlugin(type: Copy, dependsOn: copyPluginZip) { - def pluginsDir = System.getenv('NXF_PLUGINS_DIR') ?: - System.getenv('NXF_HOME') ? "${System.getenv('NXF_HOME')}/plugins" : - "${System.getProperty('user.home')}/.nextflow/plugins" - - def pluginZip = file("$rootProject.buildDir/plugins/${project.name}-${project.version}.zip") - def pluginDir = file("$pluginsDir/${project.name}-${project.version}") - - doFirst { - println "Installing plugin to: $pluginDir" - pluginDir.mkdirs() - } - - from zipTree(pluginZip) - into pluginDir - - doLast { - println "Plugin installed successfully!" - println "Installation location determined by:" - if (System.getenv('NXF_PLUGINS_DIR')) { - println " - NXF_PLUGINS_DIR environment variable" - } else if (System.getenv('NXF_HOME')) { - println " - NXF_HOME environment variable" - } else { - println " - Default location (~/.nextflow/plugins)" - } - } -} - From 1db8a5208b4a8f89f04eec18b17834b35d407f06 Mon Sep 17 00:00:00 2001 From: Robert Syme Date: Fri, 6 Dec 2024 15:55:03 -0500 Subject: [PATCH 4/5] Apply suggestions from Tom's code review Co-authored-by: Tom Sellman Signed-off-by: Rob Syme --- Makefile | 4 ++-- README.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 875daf3..ea7d655 100644 --- a/Makefile +++ b/Makefile @@ -75,7 +75,7 @@ publish-index: # install-plugin: ifdef plugin - ./gradlew installSpecificPlugin -Pplugin=${plugin} + ./gradlew :plugins:${plugin}:installPlugin else - ./gradlew installPlugins + ./gradlew installPlugin endif \ No newline at end of file diff --git a/README.md b/README.md index 6973f22..822e749 100644 --- a/README.md +++ b/README.md @@ -108,10 +108,10 @@ The plugin can be tested without using a local Nextflow build using the followin Alternatively, you can use Gradle commands directly: ```bash # Install a specific plugin - ./gradlew installSpecificPlugin -Pplugin=nf-hello + ./gradlew :plugins:nf-hello:installPlugin # Install all plugins - ./gradlew installPlugins + ./gradlew installPlugin ``` 3. Create a pipeline that uses your plugin and run it: `nextflow run ./my-pipeline-script.nf` From e633cc1d3c30656d752646d4edded64a07d45b1d Mon Sep 17 00:00:00 2001 From: Robert Syme Date: Fri, 10 Jan 2025 09:04:16 -0500 Subject: [PATCH 5/5] Update plugins/build.gradle Co-authored-by: Tom Sellman Signed-off-by: Rob Syme --- plugins/build.gradle | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/plugins/build.gradle b/plugins/build.gradle index 3c92c2a..95ac35b 100644 --- a/plugins/build.gradle +++ b/plugins/build.gradle @@ -215,33 +215,3 @@ task publishIndex( type: io.nextflow.gradle.tasks.GithubRepositoryPublisher ) { githubToken = github_access_token } -/* - * Task to install all plugins to the Nextflow plugins directory - */ -task installPlugins() { - description = 'Installs all plugins to the Nextflow plugins directory' - group = 'Plugin Installation' - - dependsOn subprojects.installPlugin -} - -/* - * Task to install a specific plugin by name - * Usage: ./gradlew installPlugin -Pplugin=nf-hello - */ -task installSpecificPlugin { - description = 'Installs a specific plugin (specify with -Pplugin=plugin-name)' - group = 'Plugin Installation' - - doFirst { - if (!project.hasProperty('plugin')) { - throw new GradleException("Please specify a plugin name using -Pplugin=plugin-name") - } - def pluginName = project.property('plugin') - def pluginProject = project.findProject(":plugins:${pluginName}") - if (!pluginProject) { - throw new GradleException("Plugin '${pluginName}' not found") - } - dependsOn pluginProject.installPlugin - } -}