From ccab49be5e3172fff34cfe14019679ce72978735 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Thu, 10 Apr 2025 09:08:37 -0500 Subject: [PATCH 1/2] build: Use nextflow gradle plugin Signed-off-by: Edmund Miller --- Makefile | 79 +------ plugins/nf-sqldb/build.gradle => build.gradle | 61 ++---- plugins/build.gradle | 206 ------------------ settings.gradle | 10 +- .../nextflow/sql/ChannelSqlExtension.groovy | 0 .../groovy}/nextflow/sql/InsertHandler.groovy | 0 .../groovy}/nextflow/sql/QueryHandler.groovy | 0 .../main/groovy}/nextflow/sql/QueryOp.groovy | 0 .../groovy}/nextflow/sql/SqlPlugin.groovy | 0 .../nextflow/sql/config/DriverRegistry.groovy | 0 .../nextflow/sql/config/SqlConfig.groovy | 0 .../nextflow/sql/config/SqlDataSource.groovy | 0 .../main}/resources/META-INF/MANIFEST.MF | 0 .../main}/resources/META-INF/extensions.idx | 0 .../src/testResources/test-h2/main.nf | 0 .../src/testResources/test-h2/nextflow.config | 0 .../sql/ChannelSqlExtensionTest.groovy | 0 .../nextflow/sql/InsertHandlerTest.groovy | 0 .../nextflow/sql/QueryHandlerTest.groovy | 0 .../groovy}/nextflow/sql/SqlDslTest.groovy | 0 .../nextflow/sql/SqlExecutionTest.groovy | 0 .../sql/SqlPluginIntegrationTest.groovy | 0 .../nextflow/sql/config/SqlConfigTest.groovy | 0 .../sql/config/SqlDataSourceTest.groovy | 0 .../test/groovy}/test/BaseSpec.groovy | 0 .../groovy}/test/helpers/MockHelpers.groovy | 0 .../groovy}/test/helpers/TestHelper.groovy | 0 27 files changed, 38 insertions(+), 318 deletions(-) rename plugins/nf-sqldb/build.gradle => build.gradle (76%) delete mode 100644 plugins/build.gradle rename {plugins/nf-sqldb/src/main => src/main/groovy}/nextflow/sql/ChannelSqlExtension.groovy (100%) rename {plugins/nf-sqldb/src/main => src/main/groovy}/nextflow/sql/InsertHandler.groovy (100%) rename {plugins/nf-sqldb/src/main => src/main/groovy}/nextflow/sql/QueryHandler.groovy (100%) rename {plugins/nf-sqldb/src/main => src/main/groovy}/nextflow/sql/QueryOp.groovy (100%) rename {plugins/nf-sqldb/src/main => src/main/groovy}/nextflow/sql/SqlPlugin.groovy (100%) rename {plugins/nf-sqldb/src/main => src/main/groovy}/nextflow/sql/config/DriverRegistry.groovy (100%) rename {plugins/nf-sqldb/src/main => src/main/groovy}/nextflow/sql/config/SqlConfig.groovy (100%) rename {plugins/nf-sqldb/src/main => src/main/groovy}/nextflow/sql/config/SqlDataSource.groovy (100%) rename {plugins/nf-sqldb/src => src/main}/resources/META-INF/MANIFEST.MF (100%) rename {plugins/nf-sqldb/src => src/main}/resources/META-INF/extensions.idx (100%) rename {plugins/nf-sqldb => src}/src/testResources/test-h2/main.nf (100%) rename {plugins/nf-sqldb => src}/src/testResources/test-h2/nextflow.config (100%) rename {plugins/nf-sqldb/src/test => src/test/groovy}/nextflow/sql/ChannelSqlExtensionTest.groovy (100%) rename {plugins/nf-sqldb/src/test => src/test/groovy}/nextflow/sql/InsertHandlerTest.groovy (100%) rename {plugins/nf-sqldb/src/test => src/test/groovy}/nextflow/sql/QueryHandlerTest.groovy (100%) rename {plugins/nf-sqldb/src/test => src/test/groovy}/nextflow/sql/SqlDslTest.groovy (100%) rename {plugins/nf-sqldb/src/test => src/test/groovy}/nextflow/sql/SqlExecutionTest.groovy (100%) rename {plugins/nf-sqldb/src/test => src/test/groovy}/nextflow/sql/SqlPluginIntegrationTest.groovy (100%) rename {plugins/nf-sqldb/src/test => src/test/groovy}/nextflow/sql/config/SqlConfigTest.groovy (100%) rename {plugins/nf-sqldb/src/test => src/test/groovy}/nextflow/sql/config/SqlDataSourceTest.groovy (100%) rename {plugins/nf-sqldb/src/test => src/test/groovy}/test/BaseSpec.groovy (100%) rename {plugins/nf-sqldb/src/test => src/test/groovy}/test/helpers/MockHelpers.groovy (100%) rename {plugins/nf-sqldb/src/test => src/test/groovy}/test/helpers/TestHelper.groovy (100%) diff --git a/Makefile b/Makefile index 0e95e4a..25d004c 100644 --- a/Makefile +++ b/Makefile @@ -1,82 +1,21 @@ -config ?= compileClasspath -version ?= $(shell grep 'Plugin-Version' plugins/nf-sqldb/src/resources/META-INF/MANIFEST.MF | awk '{ print $$2 }') - -ifdef module -mm = :${module}: -else -mm = -endif +# Build the plugin +assemble: + ./gradlew assemble clean: rm -rf .nextflow* rm -rf work rm -rf build - rm -rf plugins/*/build ./gradlew clean -compile: - ./gradlew compileGroovy - @echo "DONE `date`" - - -check: - ./gradlew check - - -# -# Show dependencies try `make deps config=runtime`, `make deps config=google` -# -deps: - ./gradlew -q ${mm}dependencies --configuration ${config} - -deps-all: - ./gradlew -q dependencyInsight --configuration ${config} --dependency ${module} - -# -# Refresh SNAPSHOTs dependencies -# -refresh: - ./gradlew --refresh-dependencies - -# -# Run all tests or selected ones -# +# Run plugin unit tests test: -ifndef class - ./gradlew ${mm}test -else - ./gradlew ${mm}test --tests ${class} -endif - -assemble: - ./gradlew assemble - -# -# generate build zips under build/plugins -# you can install the plugin copying manually these files to $HOME/.nextflow/plugins -# -buildPlugins: - ./gradlew copyPluginZip - -# -# Upload JAR artifacts to Maven Central -# -upload: - ./gradlew upload - - -upload-plugins: - ./gradlew plugins:upload - -publish-index: - ./gradlew plugins:publishIndex + ./gradlew test # Install the plugin into local nextflow plugins dir install: - ./gradlew copyPluginZip - rm -rf ${HOME}/.nextflow/plugins/nf-sqldb-${version} - cp -r build/plugins/nf-sqldb-${version} ${HOME}/.nextflow/plugins/nf-sqldb-${version} - + ./gradlew install -publish-jar: - ./gradlew plugins:nf-sqldb:publishMavenPublicationToMavenRepository +# Publish the plugin +release: + ./gradlew releasePlugin \ No newline at end of file diff --git a/plugins/nf-sqldb/build.gradle b/build.gradle similarity index 76% rename from plugins/nf-sqldb/build.gradle rename to build.gradle index b83c11a..ce89801 100644 --- a/plugins/nf-sqldb/build.gradle +++ b/build.gradle @@ -15,19 +15,12 @@ */ plugins { - // Apply the groovy plugin to add support for Groovy - id 'io.nextflow.groovy-library-conventions' - id 'idea' + id 'io.nextflow.nextflow-plugin' version '1.0.0-beta.6' id 'de.undercouch.download' version '4.1.2' } -group = 'io.nextflow' -// DO NOT SET THE VERSION HERE -// THE VERSION FOR PLUGINS IS DEFINED IN THE `/resources/META-INF/MANIFEST.NF` file - -idea { - module.inheritOutputDirs = true -} +// Plugin version (from latest MANIFEST.MF) +version = '0.7.1' repositories { mavenCentral() @@ -36,29 +29,8 @@ repositories { maven { url = 'https://s3-eu-west-1.amazonaws.com/maven.seqera.io/snapshots' } } -configurations { - // see https://docs.gradle.org/4.1/userguide/dependency_management.html#sub:exclude_transitive_dependencies - runtimeClasspath.exclude group: 'org.slf4j', module: 'slf4j-api' -} - -sourceSets { - main.java.srcDirs = [] - main.groovy.srcDirs = ['src/main'] - main.resources.srcDirs = ['src/resources'] - test.groovy.srcDirs = ['src/test'] - test.java.srcDirs = [] - test.resources.srcDirs = [] -} - -ext{ - nextflowVersion = '25.04.0' -} - dependencies { - compileOnly "io.nextflow:nextflow:$nextflowVersion" - compileOnly 'org.slf4j:slf4j-api:2.0.16' - compileOnly 'org.pf4j:pf4j:3.12.0' - + // Latest database dependencies from master branch api("org.apache.groovy:groovy-sql:4.0.26") { transitive = false } api 'com.h2database:h2:1.4.200' api 'mysql:mysql-connector-java:8.0.33' @@ -77,7 +49,6 @@ dependencies { // test configuration testImplementation "org.apache.groovy:groovy:4.0.26" testImplementation "org.apache.groovy:groovy-nio:4.0.26" - testImplementation "io.nextflow:nextflow:$nextflowVersion" testImplementation ("org.apache.groovy:groovy-test:4.0.26") { exclude group: 'org.apache.groovy' } testImplementation ("cglib:cglib-nodep:3.3.0") testImplementation ("org.objenesis:objenesis:3.1") @@ -85,17 +56,22 @@ dependencies { testImplementation ('org.spockframework:spock-junit4:2.3-groovy-4.0') { exclude group: 'org.apache.groovy'; exclude group: 'net.bytebuddy' } testImplementation ('com.google.jimfs:jimfs:1.1') - testImplementation(testFixtures("io.nextflow:nextflow:$nextflowVersion")) - testImplementation(testFixtures("io.nextflow:nf-commons:$nextflowVersion")) - // see https://docs.gradle.org/4.1/userguide/dependency_management.html#sec:module_replacement modules { module("commons-logging:commons-logging") { replacedBy("org.slf4j:jcl-over-slf4j") } } } -test { - useJUnitPlatform() +nextflowPlugin { + // Minimum Nextflow version + nextflowVersion = '25.04.0' + + // Plugin metadata + provider = 'Seqera Labs' + className = 'nextflow.sql.SqlPlugin' + extensionPoints = [ + 'nextflow.sql.ChannelSqlExtension' + ] } /** @@ -127,5 +103,10 @@ task copyAthenDep(dependsOn: unzipAthenDep, type: Copy) { from file(new File(buildDir, '/downloads/unzip/awsathena/SimbaAthenaJDBC-2.0.25.1001/AthenaJDBC42_2.0.25.1001.jar')) into "src/dist/lib" } -project.copyPluginLibs.dependsOn('copyAthenDep') -project.compileGroovy.dependsOn('copyAthenDep') + +// Hook into the new plugin's build process +compileGroovy.dependsOn('copyAthenDep') + +test { + useJUnitPlatform() +} \ No newline at end of file diff --git a/plugins/build.gradle b/plugins/build.gradle deleted file mode 100644 index 9cc8ba3..0000000 --- a/plugins/build.gradle +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright 2021-2022, 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. - */ - -plugins { - id "java" - id "io.nextflow.nf-build-plugin" version "1.0.1" -} - -ext.github_organization = 'nextflow-io' -ext.github_username = project.findProperty('github_username') ?: 'pditommaso' -ext.github_access_token = project.findProperty('github_access_token') ?: System.getenv('GITHUB_TOKEN') -ext.github_commit_email = project.findProperty('github_commit_email') ?: 'paolo.ditommaso@gmail.com' - -jar.enabled = false - -String computeSha512(File file) { - if( !file.exists() ) - throw new GradleException("Missing file: $file -- cannot compute SHA-512") - return org.apache.commons.codec.digest.DigestUtils.sha512Hex(file.bytes) -} - -String now() { - "${java.time.OffsetDateTime.now().format(java.time.format.DateTimeFormatter.ISO_DATE_TIME)}" -} - -List allPlugins() { - def plugins = [] - new File(rootProject.rootDir, 'plugins') .eachDir { if(it.name.startsWith('nf-')) plugins.add(it.name) } - return plugins -} - -String metaFromManifest(String meta, File file) { - def str = file.text - def regex = ~/(?m)^$meta:\s*([\w-\.<>=]+)$/ - def m = regex.matcher(str) - if( m.find() ) { - def ver = m.group(1) - //println "Set plugin '${file.parentFile.parentFile.parentFile.parentFile.name}' version=${ver}" - return ver - } - throw new GradleException("Cannot find '$meta' for plugin: $file") -} - -def timestamp = now() - -subprojects { - apply plugin: 'java' - apply plugin: 'groovy' - apply plugin: 'io.nextflow.nf-build-plugin' - apply plugin: 'maven-publish' - - repositories { - mavenLocal() - mavenCentral() - } - - version = metaFromManifest('Plugin-Version',file('src/resources/META-INF/MANIFEST.MF')) - - tasks.withType(Jar) { - duplicatesStrategy = DuplicatesStrategy.INCLUDE - } - - /* - * Creates plugin zip and json meta file in plugin `build/libs` directory - */ - task makeZip(type: Jar) { - into('classes') { with jar } - into('lib') { from configurations.runtimeClasspath } - manifest.from file('src/resources/META-INF/MANIFEST.MF') - archiveExtension = 'zip' - preserveFileTimestamps = false - reproducibleFileOrder = true - - doLast { - // create the meta file - final zip = new File("$buildDir/libs/${project.name}-${project.version}.zip") - final json = new File("$buildDir/libs/${project.name}-${project.version}-meta.json") - json.text = """\ - { - "version": "${project.version}", - "date": "${timestamp}", - "url": "https://github.com/${github_organization}/${project.name}/releases/download/${project.version}/${project.name}-${project.version}.zip", - "requires": "${metaFromManifest('Plugin-Requires',file('src/resources/META-INF/MANIFEST.MF'))}", - "sha512sum": "${computeSha512(zip)}" - } - """.stripIndent() - // cleanup tmp dir - file("$buildDir/tmp/makeZip").deleteDir() - } - outputs.file("$buildDir/libs/${project.name}-${project.version}.zip") - } - - /* - * Copy the plugin dependencies in the subproject `build/target/libs` directory - */ - task copyPluginLibs(type: Sync) { - from configurations.runtimeClasspath - into 'build/target/libs' - } - - /* - * Copy the plugin in the project root build/plugins directory - */ - task copyPluginZip(type: Copy, dependsOn: project.tasks.findByName('makeZip')) { - from makeZip - into "$rootProject.buildDir/plugins" - outputs.file("$rootProject.buildDir/plugins/${project.name}-${project.version}.zip") - doLast { - ant.unzip( - src: "$rootProject.buildDir/plugins/${project.name}-${project.version}.zip", - dest: "$rootProject.buildDir/plugins/${project.name}-${project.version}" - ) - } - } - - /* - * "install" the plugin the project root build/plugins directory - */ - project.parent.tasks.getByName("assemble").dependsOn << copyPluginZip - - task uploadPlugin(type: io.nextflow.gradle.tasks.GithubUploader, dependsOn: makeZip) { - assets = providers.provider {["$buildDir/libs/${project.name}-${project.version}.zip", - "$buildDir/libs/${project.name}-${project.version}-meta.json" ]} - release = providers.provider { project.version } - repo = providers.provider { project.name } - owner = github_organization - userName = github_username - authToken = github_access_token - skipExisting = true - } - - jar { - from sourceSets.main.allSource - doLast { - file("$buildDir/tmp/jar").deleteDir() - } - } - - tasks.withType(GenerateModuleMetadata) { - enabled = false - } - - task upload(dependsOn: [uploadPlugin] ) { } - - /* - * publish jars maven repo on S3 - */ - ext.aws_access_key_id = project.findProperty('aws_access_key_id') ?: System.getenv('AWS_ACCESS_KEY_ID') - ext.aws_secret_access_key = project.findProperty('aws_secret_access_key') ?: System.getenv('AWS_SECRET_ACCESS_KEY') - ext.publishRepoUrl = project.findProperty('publish_repo_url') ?: System.getenv('PUBLISH_REPO_URL') ?: ( version.endsWith('-SNAPSHOT') ? "s3://maven.seqera.io/snapshots" : "s3://maven.seqera.io/releases" ) - - publishing { - publications { - maven(MavenPublication) { - from components.java - suppressPomMetadataWarningsFor('testFixturesApiElements') - suppressPomMetadataWarningsFor('testFixturesRuntimeElements') - } - } - repositories { - maven { - url = publishRepoUrl - credentials(AwsCredentials) { - // keys are defined in the `gradle.properties` file - accessKey aws_access_key_id - secretKey aws_secret_access_key - } - } - } - } -} - -/* - * Upload all plugins to the corresponding GitHub repos - */ -task upload(dependsOn: [subprojects.uploadPlugin]) { } - -/* - * Copies the plugins required dependencies in the corresponding lib directory - */ -classes.dependsOn subprojects.copyPluginLibs - -/* - * Merge and publish the plugins index file - */ -task publishIndex( type: io.nextflow.gradle.tasks.GithubRepositoryPublisher ) { - indexUrl = 'https://github.com/nextflow-io/plugins/main/plugins.json' - repos = allPlugins() - owner = github_organization - githubUser = github_username - githubEmail = github_commit_email - githubToken = github_access_token -} diff --git a/settings.gradle b/settings.gradle index 818b0df..8e86890 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,11 @@ +// For the Nextflow plugin Gradle plugin +pluginManagement { + repositories { + mavenLocal() + gradlePluginPortal() + } +} + /* * Copyright 2021, Seqera Labs * @@ -21,6 +29,4 @@ plugins { } rootProject.name = 'nf-sqldb' -include 'plugins' -include('plugins:nf-sqldb') diff --git a/plugins/nf-sqldb/src/main/nextflow/sql/ChannelSqlExtension.groovy b/src/main/groovy/nextflow/sql/ChannelSqlExtension.groovy similarity index 100% rename from plugins/nf-sqldb/src/main/nextflow/sql/ChannelSqlExtension.groovy rename to src/main/groovy/nextflow/sql/ChannelSqlExtension.groovy diff --git a/plugins/nf-sqldb/src/main/nextflow/sql/InsertHandler.groovy b/src/main/groovy/nextflow/sql/InsertHandler.groovy similarity index 100% rename from plugins/nf-sqldb/src/main/nextflow/sql/InsertHandler.groovy rename to src/main/groovy/nextflow/sql/InsertHandler.groovy diff --git a/plugins/nf-sqldb/src/main/nextflow/sql/QueryHandler.groovy b/src/main/groovy/nextflow/sql/QueryHandler.groovy similarity index 100% rename from plugins/nf-sqldb/src/main/nextflow/sql/QueryHandler.groovy rename to src/main/groovy/nextflow/sql/QueryHandler.groovy diff --git a/plugins/nf-sqldb/src/main/nextflow/sql/QueryOp.groovy b/src/main/groovy/nextflow/sql/QueryOp.groovy similarity index 100% rename from plugins/nf-sqldb/src/main/nextflow/sql/QueryOp.groovy rename to src/main/groovy/nextflow/sql/QueryOp.groovy diff --git a/plugins/nf-sqldb/src/main/nextflow/sql/SqlPlugin.groovy b/src/main/groovy/nextflow/sql/SqlPlugin.groovy similarity index 100% rename from plugins/nf-sqldb/src/main/nextflow/sql/SqlPlugin.groovy rename to src/main/groovy/nextflow/sql/SqlPlugin.groovy diff --git a/plugins/nf-sqldb/src/main/nextflow/sql/config/DriverRegistry.groovy b/src/main/groovy/nextflow/sql/config/DriverRegistry.groovy similarity index 100% rename from plugins/nf-sqldb/src/main/nextflow/sql/config/DriverRegistry.groovy rename to src/main/groovy/nextflow/sql/config/DriverRegistry.groovy diff --git a/plugins/nf-sqldb/src/main/nextflow/sql/config/SqlConfig.groovy b/src/main/groovy/nextflow/sql/config/SqlConfig.groovy similarity index 100% rename from plugins/nf-sqldb/src/main/nextflow/sql/config/SqlConfig.groovy rename to src/main/groovy/nextflow/sql/config/SqlConfig.groovy diff --git a/plugins/nf-sqldb/src/main/nextflow/sql/config/SqlDataSource.groovy b/src/main/groovy/nextflow/sql/config/SqlDataSource.groovy similarity index 100% rename from plugins/nf-sqldb/src/main/nextflow/sql/config/SqlDataSource.groovy rename to src/main/groovy/nextflow/sql/config/SqlDataSource.groovy diff --git a/plugins/nf-sqldb/src/resources/META-INF/MANIFEST.MF b/src/main/resources/META-INF/MANIFEST.MF similarity index 100% rename from plugins/nf-sqldb/src/resources/META-INF/MANIFEST.MF rename to src/main/resources/META-INF/MANIFEST.MF diff --git a/plugins/nf-sqldb/src/resources/META-INF/extensions.idx b/src/main/resources/META-INF/extensions.idx similarity index 100% rename from plugins/nf-sqldb/src/resources/META-INF/extensions.idx rename to src/main/resources/META-INF/extensions.idx diff --git a/plugins/nf-sqldb/src/testResources/test-h2/main.nf b/src/src/testResources/test-h2/main.nf similarity index 100% rename from plugins/nf-sqldb/src/testResources/test-h2/main.nf rename to src/src/testResources/test-h2/main.nf diff --git a/plugins/nf-sqldb/src/testResources/test-h2/nextflow.config b/src/src/testResources/test-h2/nextflow.config similarity index 100% rename from plugins/nf-sqldb/src/testResources/test-h2/nextflow.config rename to src/src/testResources/test-h2/nextflow.config diff --git a/plugins/nf-sqldb/src/test/nextflow/sql/ChannelSqlExtensionTest.groovy b/src/test/groovy/nextflow/sql/ChannelSqlExtensionTest.groovy similarity index 100% rename from plugins/nf-sqldb/src/test/nextflow/sql/ChannelSqlExtensionTest.groovy rename to src/test/groovy/nextflow/sql/ChannelSqlExtensionTest.groovy diff --git a/plugins/nf-sqldb/src/test/nextflow/sql/InsertHandlerTest.groovy b/src/test/groovy/nextflow/sql/InsertHandlerTest.groovy similarity index 100% rename from plugins/nf-sqldb/src/test/nextflow/sql/InsertHandlerTest.groovy rename to src/test/groovy/nextflow/sql/InsertHandlerTest.groovy diff --git a/plugins/nf-sqldb/src/test/nextflow/sql/QueryHandlerTest.groovy b/src/test/groovy/nextflow/sql/QueryHandlerTest.groovy similarity index 100% rename from plugins/nf-sqldb/src/test/nextflow/sql/QueryHandlerTest.groovy rename to src/test/groovy/nextflow/sql/QueryHandlerTest.groovy diff --git a/plugins/nf-sqldb/src/test/nextflow/sql/SqlDslTest.groovy b/src/test/groovy/nextflow/sql/SqlDslTest.groovy similarity index 100% rename from plugins/nf-sqldb/src/test/nextflow/sql/SqlDslTest.groovy rename to src/test/groovy/nextflow/sql/SqlDslTest.groovy diff --git a/plugins/nf-sqldb/src/test/nextflow/sql/SqlExecutionTest.groovy b/src/test/groovy/nextflow/sql/SqlExecutionTest.groovy similarity index 100% rename from plugins/nf-sqldb/src/test/nextflow/sql/SqlExecutionTest.groovy rename to src/test/groovy/nextflow/sql/SqlExecutionTest.groovy diff --git a/plugins/nf-sqldb/src/test/nextflow/sql/SqlPluginIntegrationTest.groovy b/src/test/groovy/nextflow/sql/SqlPluginIntegrationTest.groovy similarity index 100% rename from plugins/nf-sqldb/src/test/nextflow/sql/SqlPluginIntegrationTest.groovy rename to src/test/groovy/nextflow/sql/SqlPluginIntegrationTest.groovy diff --git a/plugins/nf-sqldb/src/test/nextflow/sql/config/SqlConfigTest.groovy b/src/test/groovy/nextflow/sql/config/SqlConfigTest.groovy similarity index 100% rename from plugins/nf-sqldb/src/test/nextflow/sql/config/SqlConfigTest.groovy rename to src/test/groovy/nextflow/sql/config/SqlConfigTest.groovy diff --git a/plugins/nf-sqldb/src/test/nextflow/sql/config/SqlDataSourceTest.groovy b/src/test/groovy/nextflow/sql/config/SqlDataSourceTest.groovy similarity index 100% rename from plugins/nf-sqldb/src/test/nextflow/sql/config/SqlDataSourceTest.groovy rename to src/test/groovy/nextflow/sql/config/SqlDataSourceTest.groovy diff --git a/plugins/nf-sqldb/src/test/test/BaseSpec.groovy b/src/test/groovy/test/BaseSpec.groovy similarity index 100% rename from plugins/nf-sqldb/src/test/test/BaseSpec.groovy rename to src/test/groovy/test/BaseSpec.groovy diff --git a/plugins/nf-sqldb/src/test/test/helpers/MockHelpers.groovy b/src/test/groovy/test/helpers/MockHelpers.groovy similarity index 100% rename from plugins/nf-sqldb/src/test/test/helpers/MockHelpers.groovy rename to src/test/groovy/test/helpers/MockHelpers.groovy diff --git a/plugins/nf-sqldb/src/test/test/helpers/TestHelper.groovy b/src/test/groovy/test/helpers/TestHelper.groovy similarity index 100% rename from plugins/nf-sqldb/src/test/test/helpers/TestHelper.groovy rename to src/test/groovy/test/helpers/TestHelper.groovy From c9d57924936dfdc2c6b967dd1b9520e7f5a78634 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Fri, 12 Sep 2025 10:56:21 -0500 Subject: [PATCH 2/2] Address reviewer feedback and simplify build configuration - Remove unnecessary sourceSets configuration per @bentsherman feedback - Remove explicit test dependencies (handled by plugin) - Remove SLF4J and runtime classpath exclusions - Simplify settings.gradle (remove pluginManagement block) - Keep only essential database dependencies and Athena tasks - Update to latest Nextflow Gradle plugin v1.0.0-beta.6 - Maintain full functionality while reducing complexity All tests pass and plugin builds/installs successfully. Co-authored-by: Ben Sherman Signed-off-by: Edmund Miller --- README.md | 1 + build.gradle | 22 ++------- buildSrc/build.gradle | 14 ------ ...flow.groovy-application-conventions.gradle | 11 ----- ....nextflow.groovy-common-conventions.gradle | 48 ------------------- ...nextflow.groovy-library-conventions.gradle | 11 ----- settings.gradle | 30 ------------ 7 files changed, 5 insertions(+), 132 deletions(-) delete mode 100644 buildSrc/build.gradle delete mode 100644 buildSrc/src/main/groovy/io.nextflow.groovy-application-conventions.gradle delete mode 100644 buildSrc/src/main/groovy/io.nextflow.groovy-common-conventions.gradle delete mode 100644 buildSrc/src/main/groovy/io.nextflow.groovy-library-conventions.gradle diff --git a/README.md b/README.md index 4172d8e..7a804f2 100644 --- a/README.md +++ b/README.md @@ -241,3 +241,4 @@ The `CSVREAD` function provided by the H2 database engine allows you to query an Like all dataflow operators in Nextflow, the operators provided by this plugin are executed asynchronously. In particular, data inserted using the `sqlInsert` operator is _not_ guaranteed to be available to any subsequent queries using the `fromQuery` operator, as it is not possible to make a channel factory operation dependent on some upstream operation. + diff --git a/build.gradle b/build.gradle index ce89801..dde2bec 100644 --- a/build.gradle +++ b/build.gradle @@ -30,7 +30,7 @@ repositories { } dependencies { - // Latest database dependencies from master branch + // Database dependencies api("org.apache.groovy:groovy-sql:4.0.26") { transitive = false } api 'com.h2database:h2:1.4.200' api 'mysql:mysql-connector-java:8.0.33' @@ -45,21 +45,6 @@ dependencies { //NOTE: Had to remove the slf4j jar due to a conflict implementation fileTree(dir: 'src/dist/lib/libs', include: '*.jar') - - // test configuration - testImplementation "org.apache.groovy:groovy:4.0.26" - testImplementation "org.apache.groovy:groovy-nio:4.0.26" - testImplementation ("org.apache.groovy:groovy-test:4.0.26") { exclude group: 'org.apache.groovy' } - testImplementation ("cglib:cglib-nodep:3.3.0") - testImplementation ("org.objenesis:objenesis:3.1") - testImplementation ("org.spockframework:spock-core:2.3-groovy-4.0") { exclude group: 'org.apache.groovy'; exclude group: 'net.bytebuddy' } - testImplementation ('org.spockframework:spock-junit4:2.3-groovy-4.0') { exclude group: 'org.apache.groovy'; exclude group: 'net.bytebuddy' } - testImplementation ('com.google.jimfs:jimfs:1.1') - - // see https://docs.gradle.org/4.1/userguide/dependency_management.html#sec:module_replacement - modules { - module("commons-logging:commons-logging") { replacedBy("org.slf4j:jcl-over-slf4j") } - } } nextflowPlugin { @@ -107,6 +92,7 @@ task copyAthenDep(dependsOn: unzipAthenDep, type: Copy) { // Hook into the new plugin's build process compileGroovy.dependsOn('copyAthenDep') -test { - useJUnitPlatform() +// Configure the packagePlugin task to handle duplicates +tasks.named('packagePlugin') { + duplicatesStrategy = DuplicatesStrategy.EXCLUDE } \ No newline at end of file diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle deleted file mode 100644 index 66a0569..0000000 --- a/buildSrc/build.gradle +++ /dev/null @@ -1,14 +0,0 @@ -/* - * This file was generated by the Gradle 'init' task. - */ - -plugins { - // Support convention plugins written in Groovy. Convention plugins are build scripts in 'src/main' that automatically become available as plugins in the main build. - id 'groovy-gradle-plugin' -} - -repositories { - // Use the plugin portal to apply community plugins in convention plugins. - gradlePluginPortal() -} - diff --git a/buildSrc/src/main/groovy/io.nextflow.groovy-application-conventions.gradle b/buildSrc/src/main/groovy/io.nextflow.groovy-application-conventions.gradle deleted file mode 100644 index ecc029b..0000000 --- a/buildSrc/src/main/groovy/io.nextflow.groovy-application-conventions.gradle +++ /dev/null @@ -1,11 +0,0 @@ -/* - * This file was generated by the Gradle 'init' task. - */ - -plugins { - // Apply the common convention plugin for shared build configuration between library and application projects. - id 'io.nextflow.groovy-common-conventions' - - // Apply the application plugin to add support for building a CLI application in Java. - id 'application' -} diff --git a/buildSrc/src/main/groovy/io.nextflow.groovy-common-conventions.gradle b/buildSrc/src/main/groovy/io.nextflow.groovy-common-conventions.gradle deleted file mode 100644 index 9c46488..0000000 --- a/buildSrc/src/main/groovy/io.nextflow.groovy-common-conventions.gradle +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file was generated by the Gradle 'init' task. - */ - -plugins { - // Apply the groovy Plugin to add support for Groovy. - id 'groovy' -} - -repositories { - // Use Maven Central for resolving dependencies. - mavenCentral() -} - -java { - toolchain { - languageVersion = JavaLanguageVersion.of(21) - } -} - -compileJava { - options.release.set(17) -} - -tasks.withType(GroovyCompile) { - sourceCompatibility = 17 - targetCompatibility = 17 -} - -tasks.withType(Test) { - jvmArgs ([ - '--add-opens=java.base/java.lang=ALL-UNNAMED', - '--add-opens=java.base/java.io=ALL-UNNAMED', - '--add-opens=java.base/java.nio=ALL-UNNAMED', - '--add-opens=java.base/java.nio.file.spi=ALL-UNNAMED', - '--add-opens=java.base/java.net=ALL-UNNAMED', - '--add-opens=java.base/java.util=ALL-UNNAMED', - '--add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED', - '--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED', - '--add-opens=java.base/sun.nio.ch=ALL-UNNAMED', - '--add-opens=java.base/sun.nio.fs=ALL-UNNAMED', - '--add-opens=java.base/sun.net.www.protocol.http=ALL-UNNAMED', - '--add-opens=java.base/sun.net.www.protocol.https=ALL-UNNAMED', - '--add-opens=java.base/sun.net.www.protocol.ftp=ALL-UNNAMED', - '--add-opens=java.base/sun.net.www.protocol.file=ALL-UNNAMED', - '--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED', - ]) -} diff --git a/buildSrc/src/main/groovy/io.nextflow.groovy-library-conventions.gradle b/buildSrc/src/main/groovy/io.nextflow.groovy-library-conventions.gradle deleted file mode 100644 index 0183e2c..0000000 --- a/buildSrc/src/main/groovy/io.nextflow.groovy-library-conventions.gradle +++ /dev/null @@ -1,11 +0,0 @@ -/* - * This file was generated by the Gradle 'init' task. - */ - -plugins { - // Apply the common convention plugin for shared build configuration between library and application projects. - id 'io.nextflow.groovy-common-conventions' - // Apply the java-library plugin for API and implementation separation. - id 'java-library' -} - diff --git a/settings.gradle b/settings.gradle index 8e86890..e22d368 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,32 +1,2 @@ -// For the Nextflow plugin Gradle plugin -pluginManagement { - repositories { - mavenLocal() - gradlePluginPortal() - } -} - -/* - * Copyright 2021, 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. - */ -plugins { - // required to download the toolchain (jdk) from a remote repository - // https://github.com/gradle/foojay-toolchains - // https://docs.gradle.org/current/userguide/toolchains.html#sub:download_repositories - id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0" -} - rootProject.name = 'nf-sqldb'