diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7958061..d49f6be 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,17 +26,16 @@ jobs: - name: Compile run: | make clean - make check make compile make compile-with-nextflow + - name: Test + run: make test + env: + GRADLE_OPTS: '-Dorg.gradle.daemon=false' + - name: Build run: make build - name: Install run: make install-local - - - name: Test - run: make test - env: - GRADLE_OPTS: '-Dorg.gradle.daemon=false' diff --git a/Makefile b/Makefile index 79b01a2..cad48c2 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,7 @@ version ?= $(shell grep 'Plugin-Version' plugins/nf-dotenv/src/resources/META-INF/MANIFEST.MF | awk '{ print $$2 }') -.PHONY: check -check: - ./gradlew check --warning-mode all +.PHONY: all +all: compile build .PHONY: clean clean: diff --git a/README.md b/README.md index d5fca39..66b77af 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # nf-dotenv [![CI](https://github.com/fulcrumgenomics/nf-dotenv/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/fulcrumgenomics/nf-dotenv/actions/workflows/test.yml?query=branch%3Amain) -[![Nextflow](https://img.shields.io/badge/Nextflow%20DSL2-%E2%89%A522.10.0-blue.svg)](https://www.nextflow.io/) +[![Nextflow](https://img.shields.io/badge/Nextflow%20DSL2-%E2%89%A522.10.2-blue.svg)](https://www.nextflow.io/) [![Java Versions](https://img.shields.io/badge/java-8_|_11_|_17_|_21-blue)](https://github.com/fulcrumgenomics/nf-dotenv) Automatically source [dotenv](https://hexdocs.pm/dotenvy/dotenv-file-format.html) files into your Nextflow scope. @@ -119,10 +119,9 @@ samtools 1.16 ## Testing the Plugin Locally -Execute the following to check, compile, and run unit tests for the plugin: +Execute the following to compile and run unit tests for the plugin: ``` -make check make compile make test ``` diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle deleted file mode 100644 index 4fa76d0..0000000 --- a/buildSrc/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -plugins { - id 'groovy-gradle-plugin' -} - -repositories { - 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 a64d74f..0000000 --- a/buildSrc/src/main/groovy/io.nextflow.groovy-application-conventions.gradle +++ /dev/null @@ -1,4 +0,0 @@ -plugins { - id 'io.nextflow.groovy-common-conventions' - 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 e588935..0000000 --- a/buildSrc/src/main/groovy/io.nextflow.groovy-common-conventions.gradle +++ /dev/null @@ -1,42 +0,0 @@ -plugins { - id 'groovy' -} - -repositories { - mavenCentral() -} - -java { - toolchain { - languageVersion = JavaLanguageVersion.of(19) - } -} - -compileJava { - options.release.set(11) -} - -tasks.withType(GroovyCompile) { - sourceCompatibility = '11' - targetCompatibility = '11' -} - -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 794b370..0000000 --- a/buildSrc/src/main/groovy/io.nextflow.groovy-library-conventions.gradle +++ /dev/null @@ -1,4 +0,0 @@ -plugins { - id 'io.nextflow.groovy-common-conventions' - id 'java-library' -} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..f332058 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,2 @@ +groovyVersion = 3.0.14 +nextflowVersion = 22.10.2 diff --git a/plugins/build.gradle b/plugins/build.gradle index 83c45af..b649d78 100644 --- a/plugins/build.gradle +++ b/plugins/build.gradle @@ -12,7 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - import io.nextflow.gradle.tasks.GithubRepositoryPublisher import io.nextflow.gradle.tasks.GithubUploader import org.apache.commons.codec.digest.DigestUtils @@ -22,6 +21,7 @@ import java.time.format.DateTimeFormatter plugins { id "java" + id "groovy" id "io.nextflow.nf-build-plugin" version "1.0.1" } @@ -32,22 +32,25 @@ ext.github_commit_email = project.findProperty('github_commit_email') ?: System. jar.enabled = false +/** Generate a sha512 hash of the given file. */ static String computeSha512(File file) { - if (!file.exists()) + if (!file.exists()) { throw new GradleException("Missing file: $file -- cannot compute SHA-512") + } return DigestUtils.sha512Hex(file.bytes) } +/** The time is now! */ String now() { "${OffsetDateTime.now().format(DateTimeFormatter.ISO_DATE_TIME)}" } +/** All the plugins we intend to compile, test, build, install, and publish. */ List allPlugins() { - def plugins = [] - new File(rootProject.rootDir, 'plugins') .eachDir { if(it.name.startsWith('nf-')) plugins.add(it.name) } - return plugins + return [new File(rootProject.rootDir, 'plugins/nf-dotenv')] as List } +/** Get the metadata for this plugin from the MANIFEST file. */ static String metaFromManifest(String meta, File file) { def str = file.text def regex = ~/(?m)^$meta:\s*([\w-\.<>=]+)$/ @@ -71,7 +74,7 @@ subprojects { mavenCentral() } - version = metaFromManifest('Plugin-Version',file('src/resources/META-INF/MANIFEST.MF')) + version = metaFromManifest('Plugin-Version', file('src/resources/META-INF/MANIFEST.MF')) tasks.withType(Jar).configureEach { duplicatesStrategy = DuplicatesStrategy.INCLUDE @@ -97,7 +100,7 @@ subprojects { "requires": "${metaFromManifest('Plugin-Requires', file('src/resources/META-INF/MANIFEST.MF'))}", "sha512sum": "${computeSha512(zip)}" } - """.stripIndent() + """.trim().stripIndent() file("$buildDir/tmp/makeZip").deleteDir() } outputs.file("$buildDir/libs/${project.name}-${project.version}.zip") @@ -107,18 +110,19 @@ subprojects { tasks.register('copyPluginLibs', Sync) { from configurations.runtimeClasspath into 'build/target/libs' + duplicatesStrategy 'exclude' } /** Copy the plugin into the project root build/plugins directory. */ tasks.register('copyPluginZip', Copy) { - dependsOn project.tasks.findByName('makeZip') + dependsOn 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}" + src: "$rootProject.buildDir/plugins/${project.name}-${project.version}.zip", + dest: "$rootProject.buildDir/plugins/${project.name}-${project.version}" ) } } @@ -129,8 +133,10 @@ subprojects { tasks.register('uploadPlugin', GithubUploader) { dependsOn makeZip assets = providers.provider { - ["$buildDir/libs/${project.name}-${project.version}.zip", - "$buildDir/libs/${project.name}-${project.version}-meta.json"] + [ + "$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 } @@ -139,19 +145,6 @@ subprojects { authToken = github_access_token skipExisting = true } - - jar { - from sourceSets.main.allSource - doLast { - file("$buildDir/tmp/jar").deleteDir() - } - } - - tasks.withType(GenerateModuleMetadata).configureEach { - enabled = false - } - - task upload(dependsOn: [uploadPlugin] ) { } } /** Upload all plugins to the corresponding GitHub repos. */ diff --git a/plugins/nf-dotenv/build.gradle b/plugins/nf-dotenv/build.gradle index 7635675..c4de9dd 100644 --- a/plugins/nf-dotenv/build.gradle +++ b/plugins/nf-dotenv/build.gradle @@ -12,15 +12,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - plugins { - // TODO: Figure out how to build all this for cross-Java support without needing ./buildSrc! - id 'io.nextflow.groovy-library-conventions' + id 'groovy' id 'idea' } group = 'io.nextflow' +java { + toolchain { + languageVersion = JavaLanguageVersion.of(11) + } +} + idea { module.inheritOutputDirs = true } @@ -46,33 +50,31 @@ sourceSets { test.resources.srcDirs = ['src/testResources'] } -ext { - nextflowVersion = '23.04.0' -} - dependencies { // This dependency is exported to consumers, that is to say, it is found on their compile classpath. compileOnly "io.nextflow:nextflow:$nextflowVersion" - compileOnly 'org.slf4j:slf4j-api:2.0.9' - compileOnly 'org.pf4j:pf4j:3.10.0' + compileOnly 'org.slf4j:slf4j-api:1.7.10' + compileOnly 'org.pf4j:pf4j:3.4.1' // Plugin dependencies. implementation 'io.github.cdimascio:dotenv-java:3.0.0' // Test configuration. - testImplementation "org.codehaus.groovy:groovy:3.0.19" - testImplementation "org.codehaus.groovy:groovy-nio:3.0.19" testImplementation "io.nextflow:nextflow:$nextflowVersion" - testImplementation ("org.codehaus.groovy:groovy-test:3.0.19") { exclude group: 'org.codehaus.groovy' } + testImplementation "org.codehaus.groovy:groovy:$groovyVersion" + testImplementation "org.codehaus.groovy:groovy-nio:$groovyVersion" + testImplementation ("org.codehaus.groovy:groovy-test:$groovyVersion") { exclude group: 'org.codehaus.groovy' } testImplementation ("cglib:cglib-nodep:3.3.0") - testImplementation ("org.objenesis:objenesis:3.3") - testImplementation ("org.spockframework:spock-core:2.3-groovy-3.0") { exclude group: 'org.codehaus.groovy'; exclude group: 'net.bytebuddy' } - testImplementation ('org.spockframework:spock-junit4:2.3-groovy-3.0') { exclude group: 'org.codehaus.groovy'; exclude group: 'net.bytebuddy' } - testImplementation ('com.google.jimfs:jimfs:1.3.0') + testImplementation ("org.objenesis:objenesis:3.1") + testImplementation ("org.spockframework:spock-core:2.0-M3-groovy-3.0") { exclude group: 'org.codehaus.groovy'; exclude group: 'net.bytebuddy' } + testImplementation ('org.spockframework:spock-junit4:2.0-M3-groovy-3.0') { exclude group: 'org.codehaus.groovy'; exclude group: 'net.bytebuddy' } testImplementation(testFixtures("io.nextflow:nextflow:$nextflowVersion")) testImplementation(testFixtures("io.nextflow:nf-commons:$nextflowVersion")) + testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") + testRuntimeOnly("org.junit.platform:junit-platform-launcher") + // 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") }