Skip to content

Commit eacccc7

Browse files
committed
build: Use nextflow gradle plugin
Signed-off-by: Edmund Miller <[email protected]>
1 parent 0cca8fa commit eacccc7

23 files changed

+103
-297
lines changed

Makefile

+11-61
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,21 @@
1-
config ?= compileClasspath
2-
3-
ifdef module
4-
mm = :${module}:
5-
else
6-
mm =
7-
endif
1+
# Build the plugin
2+
assemble:
3+
./gradlew assemble
84

95
clean:
106
rm -rf .nextflow*
117
rm -rf work
128
rm -rf build
13-
rm -rf plugins/*/build
149
./gradlew clean
1510

16-
compile:
17-
./gradlew compileGroovy
18-
@echo "DONE `date`"
19-
20-
21-
check:
22-
./gradlew check
23-
24-
25-
#
26-
# Show dependencies try `make deps config=runtime`, `make deps config=google`
27-
#
28-
deps:
29-
./gradlew -q ${mm}dependencies --configuration ${config}
30-
31-
deps-all:
32-
./gradlew -q dependencyInsight --configuration ${config} --dependency ${module}
33-
34-
#
35-
# Refresh SNAPSHOTs dependencies
36-
#
37-
refresh:
38-
./gradlew --refresh-dependencies
39-
40-
#
41-
# Run all tests or selected ones
42-
#
11+
# Run plugin unit tests
4312
test:
44-
ifndef class
45-
./gradlew ${mm}test
46-
else
47-
./gradlew ${mm}test --tests ${class}
48-
endif
49-
50-
assemble:
51-
./gradlew assemble
52-
53-
#
54-
# generate build zips under build/plugins
55-
# you can install the plugin copying manually these files to $HOME/.nextflow/plugins
56-
#
57-
buildPlugins:
58-
./gradlew copyPluginZip
59-
60-
#
61-
# Upload JAR artifacts to Maven Central
62-
#
63-
upload:
64-
./gradlew upload
65-
13+
./gradlew test
6614

67-
upload-plugins:
68-
./gradlew plugins:upload
15+
# Install the plugin into local nextflow plugins dir
16+
install:
17+
./gradlew install
6918

70-
publish-index:
71-
./gradlew plugins:publishIndex
19+
# Publish the plugin
20+
release:
21+
./gradlew releasePlugin

plugins/nf-sqldb/build.gradle renamed to build.gradle

+84-56
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,34 @@
1414
* limitations under the License.
1515
*/
1616

17-
plugins {
18-
// Apply the groovy plugin to add support for Groovy
19-
id 'io.nextflow.groovy-library-conventions'
20-
id 'idea'
21-
id 'de.undercouch.download' version '4.1.2'
17+
// Add the download plugin
18+
buildscript {
19+
repositories {
20+
mavenCentral()
21+
}
22+
dependencies {
23+
classpath 'de.undercouch:gradle-download-task:4.1.2'
24+
}
2225
}
2326

24-
group = 'io.nextflow'
25-
// DO NOT SET THE VERSION HERE
26-
// THE VERSION FOR PLUGINS IS DEFINED IN THE `/resources/META-INF/MANIFEST.NF` file
27+
plugins {
28+
id 'io.nextflow.nextflow-plugin' version '0.0.1-alpha'
29+
}
2730

28-
idea {
29-
module.inheritOutputDirs = true
31+
sourceSets {
32+
main {
33+
groovy {
34+
srcDirs = ['src/main/groovy']
35+
}
36+
resources {
37+
srcDirs = ['src/main/resources']
38+
}
39+
}
40+
test {
41+
groovy {
42+
srcDirs = ['src/test/groovy']
43+
}
44+
}
3045
}
3146

3247
repositories {
@@ -36,75 +51,86 @@ repositories {
3651
maven { url = 'https://s3-eu-west-1.amazonaws.com/maven.seqera.io/snapshots' }
3752
}
3853

39-
configurations {
40-
// see https://docs.gradle.org/4.1/userguide/dependency_management.html#sub:exclude_transitive_dependencies
41-
runtimeClasspath.exclude group: 'org.slf4j', module: 'slf4j-api'
42-
}
43-
44-
sourceSets {
45-
main.java.srcDirs = []
46-
main.groovy.srcDirs = ['src/main']
47-
main.resources.srcDirs = ['src/resources']
48-
test.groovy.srcDirs = ['src/test']
49-
test.java.srcDirs = []
50-
test.resources.srcDirs = []
51-
}
52-
53-
ext{
54-
nextflowVersion = '24.04.0'
55-
}
56-
5754
dependencies {
58-
compileOnly "io.nextflow:nextflow:$nextflowVersion"
59-
compileOnly 'org.slf4j:slf4j-api:2.0.7'
60-
compileOnly 'org.pf4j:pf4j:3.12.0'
61-
55+
// API dependencies from the original build.gradle
6256
api("org.apache.groovy:groovy-sql:4.0.23") { transitive = false }
6357
api 'com.h2database:h2:1.4.200'
6458
api 'mysql:mysql-connector-java:8.0.33'
6559
api 'org.mariadb.jdbc:mariadb-java-client:2.7.0'
6660
api 'org.postgresql:postgresql:42.7.4'
6761
api 'org.xerial:sqlite-jdbc:3.47.0.0'
6862
api 'org.duckdb:duckdb_jdbc:0.10.2'
69-
70-
71-
// JDBC driver setup for AWS Athena - the 3rd party JAR are being downloaded and setup as gradle tasks below.
72-
// Reference https://docs.aws.amazon.com/athena/latest/ug/connect-with-jdbc.html
63+
64+
// Replace commons-logging with jcl-over-slf4j
65+
implementation 'org.slf4j:jcl-over-slf4j:2.0.7'
66+
67+
// JDBC driver for AWS Athena
7368
api files('src/dist/lib/AthenaJDBC42_2.0.25.1001.jar')
74-
75-
//NOTE: Had to remove the slf4j jar due to a conflict
7669
implementation fileTree(dir: 'src/dist/lib/libs', include: '*.jar')
77-
78-
// test configuration
70+
71+
// Test dependencies
7972
testImplementation "org.apache.groovy:groovy:4.0.23"
8073
testImplementation "org.apache.groovy:groovy-nio:4.0.23"
81-
testImplementation "io.nextflow:nextflow:$nextflowVersion"
8274
testImplementation ("org.apache.groovy:groovy-test:4.0.23") { exclude group: 'org.apache.groovy' }
8375
testImplementation ("cglib:cglib-nodep:3.3.0")
8476
testImplementation ("org.objenesis:objenesis:3.1")
8577
testImplementation ("org.spockframework:spock-core:2.3-groovy-4.0") { exclude group: 'org.apache.groovy'; exclude group: 'net.bytebuddy' }
8678
testImplementation ('org.spockframework:spock-junit4:2.3-groovy-4.0') { exclude group: 'org.apache.groovy'; exclude group: 'net.bytebuddy' }
8779
testImplementation ('com.google.jimfs:jimfs:1.1')
8880

89-
testImplementation(testFixtures("io.nextflow:nextflow:$nextflowVersion"))
90-
testImplementation(testFixtures("io.nextflow:nf-commons:$nextflowVersion"))
81+
// Add back Nextflow test dependencies
82+
testImplementation "io.nextflow:nextflow:${nextflowPlugin.nextflowVersion}"
83+
testImplementation(testFixtures("io.nextflow:nextflow:${nextflowPlugin.nextflowVersion}"))
84+
testImplementation(testFixtures("io.nextflow:nf-commons:${nextflowPlugin.nextflowVersion}"))
85+
}
86+
87+
configurations {
88+
// see https://docs.gradle.org/4.1/userguide/dependency_management.html#sub:exclude_transitive_dependencies
89+
runtimeClasspath.exclude group: 'org.slf4j', module: 'slf4j-api'
90+
}
9191

92-
// see https://docs.gradle.org/4.1/userguide/dependency_management.html#sec:module_replacement
93-
modules {
94-
module("commons-logging:commons-logging") { replacedBy("org.slf4j:jcl-over-slf4j") }
92+
// Use the version from the MANIFEST.MF
93+
version = '0.6.0'
94+
95+
nextflowPlugin {
96+
// From the MANIFEST.MF
97+
nextflowVersion = '24.04.0'
98+
99+
provider = 'Seqera Labs'
100+
className = 'nextflow.sql.SqlPlugin'
101+
extensionPoints = [
102+
'nextflow.sql.ChannelSqlExtension'
103+
]
104+
105+
publishing {
106+
github {
107+
repository = 'seqera/nf-sqldb'
108+
userName = project.findProperty('github_username')
109+
authToken = project.findProperty('github_access_token')
110+
email = project.findProperty('github_commit_email')
111+
112+
// You may need to adjust this URL if the central plugin index is different
113+
indexUrl = 'https://github.com/nextflow-io/plugins/main/plugins.json'
114+
}
95115
}
96116
}
97117

118+
// Configure the packagePlugin task to handle duplicates
119+
tasks.named('packagePlugin') {
120+
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
121+
}
122+
123+
// Add test configuration for Java modules
98124
test {
99125
useJUnitPlatform()
126+
jvmArgs = ['--add-opens=java.base/java.lang=ALL-UNNAMED',
127+
'--add-opens=java.base/java.util=ALL-UNNAMED',
128+
'--add-opens=java.base/java.lang.reflect=ALL-UNNAMED']
100129
}
101130

102-
/**
103-
* AWS Athena
104-
* The following tasks download and confirm the MD5 checksum of the ZIP archive
105-
* for Simba Athena JDBC driver and extract its contents to the build directory
106-
* Reference: https://docs.aws.amazon.com/athena/latest/ug/connect-with-jdbc.html
107-
*/
131+
// AWS Athena dependencies setup - migrated from the original build.gradle
132+
apply plugin: 'de.undercouch.download'
133+
108134
task downloadAthenDep(type: Download) {
109135
src 'https://s3.amazonaws.com/athena-downloads/drivers/JDBC/SimbaAthenaJDBC-2.0.25.1001/SimbaAthenaJDBC-2.0.25.1001.zip'
110136
dest new File(buildDir, 'downloads/SimbaAthenaJDBC-2.0.25.1001.zip')
@@ -122,11 +148,13 @@ task unzipAthenDep(dependsOn: verifyAthenDep, type: Copy) {
122148
into "${buildDir}/downloads/unzip/awsathena/"
123149
}
124150

125-
// Files under src/dist are included into the distribution zip
126-
// https://docs.gradle.org/current/userguide/application_plugin.html
127151
task copyAthenDep(dependsOn: unzipAthenDep, type: Copy) {
128152
from file(new File(buildDir, '/downloads/unzip/awsathena/SimbaAthenaJDBC-2.0.25.1001/AthenaJDBC42_2.0.25.1001.jar'))
129153
into "src/dist/lib"
130154
}
131-
project.copyPluginLibs.dependsOn('copyAthenDep')
132-
project.compileGroovy.dependsOn('copyAthenDep')
155+
156+
// Make sure compileGroovy depends on copyAthenDep
157+
compileGroovy.dependsOn(copyAthenDep)
158+
159+
// Hook into the assemble task to ensure Athena dependencies are properly set up
160+
assemble.dependsOn('copyAthenDep')

0 commit comments

Comments
 (0)