From 0a1718e1640359adcf572d3c97291f7e92992c75 Mon Sep 17 00:00:00 2001 From: Paolo Di Tommaso Date: Sun, 15 Jan 2023 19:24:55 +0100 Subject: [PATCH] Update build This commit udates the gradle build. More in details: - Update Gradle to version 7.6 - Update Nextflow runtime to version 22.10.x - Update Groovy runtime to version 3.0.14 - Fixed some failing tests - Update Java min version to 11 - Update GitHub action build Signed-off-by: Paolo Di Tommaso --- .github/workflows/build.yml | 20 +++++++------ buildSrc/build.gradle | 14 ++++++++++ ...flow.groovy-application-conventions.gradle | 11 ++++++++ ....nextflow.groovy-common-conventions.gradle | 28 +++++++++++++++++++ ...nextflow.groovy-library-conventions.gradle | 11 ++++++++ gradle.properties | 2 ++ gradle/wrapper/gradle-wrapper.properties | 2 +- plugins/build.gradle | 26 +++++++++++++++-- plugins/nf-validation/build.gradle | 19 ++++--------- .../validation/SchemaValidator.groovy | 16 +++++------ .../PluginExtensionMethodsTest.groovy | 15 ++++------ 11 files changed, 121 insertions(+), 43 deletions(-) create mode 100644 buildSrc/build.gradle create mode 100644 buildSrc/src/main/groovy/io.nextflow.groovy-application-conventions.gradle create mode 100644 buildSrc/src/main/groovy/io.nextflow.groovy-common-conventions.gradle create mode 100644 buildSrc/src/main/groovy/io.nextflow.groovy-library-conventions.gradle create mode 100644 gradle.properties diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index defb2ec3..e24e343b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,23 +17,25 @@ jobs: strategy: fail-fast: false matrix: - java_version: [8, 11] + java_version: [11, 17] steps: - name: Environment run: env | sort - name: Checkout - uses: actions/checkout@v1 + uses: actions/checkout@v3 with: fetch-depth: 1 submodules: true - name: Setup Java ${{ matrix.java_version }} - uses: actions/setup-java@v1 + uses: actions/setup-java@v3 with: java-version: ${{matrix.java_version}} + distribution: 'adopt' architecture: x64 + cache: gradle - name: Compile run: ./gradlew assemble @@ -43,10 +45,10 @@ jobs: env: GRADLE_OPTS: '-Dorg.gradle.daemon=false' - - name: Publish + - name: Publish tests report if: failure() - run: bash pub-tests.sh github - env: - TEST_JDK: ${{ matrix.java_version }} - NXF_AWS_ACCESS: ${{ secrets.NXF_AWS_ACCESS }} - NXF_AWS_SECRET: ${{ secrets.NXF_AWS_SECRET }} + uses: actions/upload-artifact@v3 + with: + name: test-reports-jdk-${{ matrix.java_version }} + path: | + ./plugins/nf-validation/build/reports/tests/test/** diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle new file mode 100644 index 00000000..66a0569c --- /dev/null +++ b/buildSrc/build.gradle @@ -0,0 +1,14 @@ +/* + * 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 new file mode 100644 index 00000000..ecc029b2 --- /dev/null +++ b/buildSrc/src/main/groovy/io.nextflow.groovy-application-conventions.gradle @@ -0,0 +1,11 @@ +/* + * 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 new file mode 100644 index 00000000..eb9ac877 --- /dev/null +++ b/buildSrc/src/main/groovy/io.nextflow.groovy-common-conventions.gradle @@ -0,0 +1,28 @@ +/* + * 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(17) + } +} + +compileJava { + options.release.set(11) +} + +tasks.withType(GroovyCompile) { + sourceCompatibility = '11' + targetCompatibility = '11' +} diff --git a/buildSrc/src/main/groovy/io.nextflow.groovy-library-conventions.gradle b/buildSrc/src/main/groovy/io.nextflow.groovy-library-conventions.gradle new file mode 100644 index 00000000..0183e2cc --- /dev/null +++ b/buildSrc/src/main/groovy/io.nextflow.groovy-library-conventions.gradle @@ -0,0 +1,11 @@ +/* + * 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/gradle.properties b/gradle.properties new file mode 100644 index 00000000..04003651 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,2 @@ +nextflowVersion = 22.10.0 +groovyVersion = 3.0.14 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2e6e5897..070cb702 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/plugins/build.gradle b/plugins/build.gradle index 53ee4415..66d279fd 100644 --- a/plugins/build.gradle +++ b/plugins/build.gradle @@ -23,7 +23,6 @@ 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' -ext.nextflowVersion = '22.08.1-edge' jar.enabled = false @@ -59,7 +58,7 @@ subprojects { apply plugin: 'java' apply plugin: 'groovy' apply plugin: 'io.nextflow.nf-build-plugin' - + repositories { mavenLocal() mavenCentral() @@ -95,6 +94,8 @@ subprojects { "sha512sum": "${computeSha512(zip)}" } """.stripIndent() + // cleanup tmp dir + file("$buildDir/tmp/makeZip").deleteDir() } outputs.file("$buildDir/libs/${project.name}-${project.version}.zip") } @@ -138,13 +139,32 @@ subprojects { skipExisting = true } + jar { + from sourceSets.main.allSource + doLast { + file("$buildDir/tmp/jar").deleteDir() + } + } + + tasks.withType(GenerateModuleMetadata) { + enabled = false + } + + task upload(dependsOn: [uploadPlugin] ) { } } +/* + * Upload all plugins to the corresponding GitHub repos + */ task upload(dependsOn: [subprojects.uploadPlugin]) { } -classes.dependsOn subprojects.copyPluginLibs /* + * 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 ) { diff --git a/plugins/nf-validation/build.gradle b/plugins/nf-validation/build.gradle index cd2376f8..ae2652ff 100644 --- a/plugins/nf-validation/build.gradle +++ b/plugins/nf-validation/build.gradle @@ -16,19 +16,13 @@ plugins { // Apply the groovy plugin to add support for Groovy - id 'groovy' - id 'java-library' + id 'io.nextflow.groovy-library-conventions' id 'idea' } group = 'io.nextflow' // DO NOT SET THE VERSION HERE // THE VERSION FOR PLUGINS IS DEFINED IN THE `/resources/META-INF/MANIFEST.NF` file -java { - toolchain { - languageVersion = JavaLanguageVersion.of(11) - } -} idea { module.inheritOutputDirs = true @@ -63,14 +57,14 @@ dependencies { api 'com.github.everit-org.json-schema:org.everit.json.schema:1.14.1' // test configuration - testImplementation "org.codehaus.groovy:groovy:3.0.10" - testImplementation "org.codehaus.groovy:groovy-nio:3.0.10" testImplementation "io.nextflow:nextflow:$nextflowVersion" - testImplementation ("org.codehaus.groovy:groovy-test:3.0.10") { 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.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 ("org.spockframework:spock-core:2.2-groovy-3.0") { exclude group: 'org.codehaus.groovy'; exclude group: 'net.bytebuddy' } + testImplementation ('org.spockframework:spock-junit4:2.2-groovy-3.0') { exclude group: 'org.codehaus.groovy'; exclude group: 'net.bytebuddy' } testImplementation ('com.google.jimfs:jimfs:1.1') testImplementation(testFixtures("io.nextflow:nextflow:$nextflowVersion")) @@ -86,4 +80,3 @@ dependencies { test { useJUnitPlatform() } - diff --git a/plugins/nf-validation/src/main/nextflow/validation/SchemaValidator.groovy b/plugins/nf-validation/src/main/nextflow/validation/SchemaValidator.groovy index 1a985dc0..91c45099 100644 --- a/plugins/nf-validation/src/main/nextflow/validation/SchemaValidator.groovy +++ b/plugins/nf-validation/src/main/nextflow/validation/SchemaValidator.groovy @@ -157,7 +157,7 @@ class SchemaValidator extends PluginExtensionPoint { for (p in properties) { def String key = (String) p.key expectedParams.push(key) - def Map property = properties[key] + def Map property = properties[key] as Map if (property.containsKey('enum')) { enums[key] = property['enum'] } @@ -270,9 +270,9 @@ class SchemaValidator extends PluginExtensionPoint { def String param = params.help def Map get_param = [:] for (group in params_map.keySet()) { - def Map group_params = params_map.get(group) // This gets the parameters of that particular group + def Map group_params = params_map.get(group) as Map // This gets the parameters of that particular group if (group_params.containsKey(param)) { - get_param = group_params.get(param) + get_param = group_params.get(param) as Map } } if (!get_param) { @@ -299,9 +299,9 @@ class SchemaValidator extends PluginExtensionPoint { for (group in params_map.keySet()) { Integer num_params = 0 String group_output = "$colors.underlined$colors.bold$group$colors.reset\n" - def Map group_params = params_map.get(group) // This gets the parameters of that particular group + def Map group_params = params_map.get(group) as Map // This gets the parameters of that particular group for (String param in group_params.keySet()) { - def Map get_param = group_params.get(param) + def Map get_param = group_params.get(param) as Map def String type = '[' + get_param.type + ']' def String enums_string = "" if (get_param.enum != null) { @@ -374,11 +374,11 @@ class SchemaValidator extends PluginExtensionPoint { def Map params_map = paramsLoad( Path.of(getSchemaPath(baseDir, schema_filename)) ) for (group in params_map.keySet()) { def sub_params = new LinkedHashMap() - def Map group_params = params_map.get(group) // This gets the parameters of that particular group + def Map group_params = params_map.get(group) as Map // This gets the parameters of that particular group for (String param in group_params.keySet()) { if (params.containsKey(param)) { def String params_value = params.get(param) - def Map group_params_value = group_params.get(param) + def Map group_params_value = group_params.get(param) as Map def String schema_value = group_params_value.default def String param_type = group_params_value.type if (schema_value != null) { @@ -430,7 +430,7 @@ class SchemaValidator extends PluginExtensionPoint { def LinkedHashMap params_map = paramsSummaryMap(workflow, schema_filename) def max_chars = paramsMaxChars(params_map) for (group in params_map.keySet()) { - def Map group_params = params_map.get(group) // This gets the parameters of that particular group + def Map group_params = params_map.get(group) as Map // This gets the parameters of that particular group if (group_params) { output += "$colors.bold$group$colors.reset\n" for (String param in group_params.keySet()) { diff --git a/plugins/nf-validation/src/test/nextflow/validation/PluginExtensionMethodsTest.groovy b/plugins/nf-validation/src/test/nextflow/validation/PluginExtensionMethodsTest.groovy index d83ad064..e2c9186c 100644 --- a/plugins/nf-validation/src/test/nextflow/validation/PluginExtensionMethodsTest.groovy +++ b/plugins/nf-validation/src/test/nextflow/validation/PluginExtensionMethodsTest.groovy @@ -1,5 +1,7 @@ package nextflow.validation +import java.nio.file.Path + import nextflow.plugin.Plugins import nextflow.plugin.TestPluginDescriptorFinder import nextflow.plugin.TestPluginManager @@ -7,13 +9,8 @@ import nextflow.plugin.extension.PluginExtensionProvider import org.junit.Rule import org.pf4j.PluginDescriptorFinder import spock.lang.Shared -import spock.lang.TempDir import test.Dsl2Spec import test.OutputCapture - -import java.nio.file.Path - - /** * @author : jorge * @@ -398,7 +395,7 @@ class PluginExtensionMethodsTest extends Dsl2Spec{ then: noExceptionThrown() - stdout.size == 10 + stdout.size() == 10 } def 'should print a help message with argument options' () { @@ -424,7 +421,7 @@ class PluginExtensionMethodsTest extends Dsl2Spec{ then: noExceptionThrown() - stdout.size == 1 + stdout.size() == 1 } def 'should print a help message of one parameter' () { @@ -457,7 +454,7 @@ class PluginExtensionMethodsTest extends Dsl2Spec{ then: noExceptionThrown() - stdout.size == 7 + stdout.size() == 7 } def 'should fail when help param doesnt exist' () { @@ -517,7 +514,7 @@ class PluginExtensionMethodsTest extends Dsl2Spec{ then: noExceptionThrown() - stdout.size == 11 + stdout.size() == 11 stdout ==~ /.*\[0;34moutdir : .\[0;32moutDir.*/ } }