Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
drernie committed Dec 21, 2024
1 parent 7ee41d8 commit 1a178d5
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 42 deletions.
55 changes: 27 additions & 28 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ plugins {
// Add ability to test with upcoming versions of Groovy
def groovyVer = System.getenv('CI_GROOVY_VERSION') ?: '4.0.23'
if (groovyVer) {
def repo = groovyVer.startsWith('com.github.apache:') ? 'https://jitpack.io' : 'https://oss.jfrog.org/oss-snapshot-local/'
def repo = 'https://jitpack.io' // groovyVer.startsWith('com.github.apache:') ? 'https://jitpack.io' : 'https://oss.jfrog.org/oss-snapshot-local/'
logger.lifecycle "Overriden Groovy dependency to use $groovyVer - repository: $repo"
allprojects {
repositories {
maven { url repo }
}

configurations.all {
configurations.configureEach {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if ((details.requested.group == 'org.apache.groovy' || details.requested.group == 'org.apache.groovy') && details.requested.version != groovyVer) {
if (groovyVer.contains(':')) {
Expand All @@ -49,9 +49,6 @@ if (groovyVer) {
}
}

def projects(String...args) {
args.collect { project(it) }
}

// group = 'io.nextflow'

Expand All @@ -78,7 +75,7 @@ allprojects {
options.release = 21
}

tasks.withType(GroovyCompile) {
tasks.withType(GroovyCompile).configureEach {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
Expand Down Expand Up @@ -132,42 +129,44 @@ allprojects {
// Disable strict javadoc checks
// See http://blog.joda.org/2014/02/turning-off-doclint-in-jdk-8-javadoc.html
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
tasks.withType(Javadoc).configureEach {
options.addStringOption('Xdoclint:none', '-quiet')
}
}

tasks.withType(Jar) {
tasks.withType(Jar).configureEach {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}

// patched as described here
// http://forums.gradle.org/gradle/topics/gradle_task_groovydoc_failing_with_noclassdeffounderror
tasks.withType(Groovydoc) {
tasks.withType(Groovydoc).configureEach {
groovyClasspath = project.configurations.groovyDoc
includes = ['nextflow/**']
}

// Required to run tests on Java 9 and higher in compatibility mode
if (JavaVersion.current() >= JavaVersion.VERSION_1_9) {
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',
])
tasks.withType(Test).tap {
configureEach {
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',
])
}
}
}
}
Expand Down Expand Up @@ -200,7 +199,7 @@ task exportClasspath {
dependsOn allprojects.jar
doLast {
def all = getRuntimeConfigs()
def libs = all.collect { File file -> file.canonicalPath; }
def libs = all.collect { File file -> file.canonicalPath }
['nextflow', 'nf-commons', 'nf-httfs'].each { libs << file("modules/$it/build/libs/${it}-${nextflowVersion}.jar").canonicalPath }
file('.launch.classpath').text = libs.unique().join(':')
}
Expand Down
37 changes: 23 additions & 14 deletions plugins/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
import io.nextflow.gradle.tasks.GithubRepositoryPublisher
import io.nextflow.gradle.tasks.GithubUploader
import org.apache.commons.codec.digest.DigestUtils
import org.codehaus.groovy.runtime.GStringImpl

import java.time.OffsetDateTime
import java.time.format.DateTimeFormatter

/*
* Copyright 2021-2022, Seqera Labs
*
Expand All @@ -24,19 +32,19 @@ ext.github_organization = project.findProperty('github_organization') ?: 'nextfl
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') ?: '[email protected]'
ext.github_index_url = "https://github.com/${github_organization}/plugins/main/plugins.json"
ext.github_index_url = "https://github.com/${github_organization}/plugins/main/plugins.json" as GStringImpl

jar.enabled = false

String computeSha512(File file) {
static 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)
return DigestUtils.sha512Hex(file.bytes)
}

String now() {
"${java.time.OffsetDateTime.now().format(java.time.format.DateTimeFormatter.ISO_DATE_TIME)}"
static String now() {
"${OffsetDateTime.now().format(DateTimeFormatter.ISO_DATE_TIME)}"
}

List<String> allPlugins() {
Expand Down Expand Up @@ -71,14 +79,14 @@ subprojects {

version = metaFromManifest('Plugin-Version', file('src/resources/META-INF/MANIFEST.MF'))

tasks.withType(Jar) {
tasks.withType(Jar).configureEach {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}

/*
* Creates plugin zip and json meta file in plugin `build/libs` directory
*/
task makeZip(type: Jar) {
tasks.register('makeZip', Jar) {
into('classes') { with jar }
into('lib') { from configurations.runtimeClasspath }
manifest.from file('src/resources/META-INF/MANIFEST.MF')
Expand Down Expand Up @@ -106,7 +114,7 @@ subprojects {
/*
* Copy the plugin dependencies in the subproject `build/target/libs` directory
*/
task copyPluginLibs(type: Sync) {
tasks.register('copyPluginLibs', Sync) {
from configurations.runtimeClasspath
into 'build/target/libs'
duplicatesStrategy 'exclude'
Expand All @@ -115,7 +123,8 @@ subprojects {
/*
* Copy the plugin in the project root build/plugins directory
*/
task copyPluginZip(type: Copy, dependsOn: project.tasks.findByName('makeZip')) {
tasks.register('copyPluginZip', Copy) {
dependsOn project.tasks.findByName('makeZip')
from makeZip
into "$rootProject.buildDir/plugins"
outputs.file("$rootProject.buildDir/plugins/${project.name}-${project.version}.zip")
Expand All @@ -132,10 +141,10 @@ subprojects {
*/
project.parent.tasks.getByName('assemble').dependsOn << copyPluginZip

task uploadPlugin(type: io.nextflow.gradle.tasks.GithubUploader, dependsOn: makeZip) {
task uploadPlugin(type: 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 }
"$buildDir/libs/${project.name}-${project.version}-meta.json" ]} as Provider<? extends Iterable<? extends String>>
release = providers.provider { project.version } as Provider<? extends String>
repo = providers.provider { project.name }
owner = github_organization
userName = github_username
Expand All @@ -144,14 +153,14 @@ subprojects {
}
}

task upload(dependsOn: [subprojects.uploadPlugin]) { }
tasks.register('upload') { dependsOn[subprojects.uploadPlugin] }

classes.dependsOn subprojects.copyPluginLibs

/*
* Merge and publish the plugins index file
*/
task publishIndex(type: io.nextflow.gradle.tasks.GithubRepositoryPublisher) {
tasks.register('publishIndex', GithubRepositoryPublisher) {
indexUrl = github_index_url
repos = allPlugins()
owner = github_organization
Expand Down

0 comments on commit 1a178d5

Please sign in to comment.