Skip to content

Commit

Permalink
Bump Groovy 4 (nextflow-io#4443) [ci fast]
Browse files Browse the repository at this point in the history
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Jorge Aguilera <jorge.aguilera@seqera.io>
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
Co-authored-by: Jorge Aguilera <jorge.aguilera@seqera.io>
Co-authored-by: Ben Sherman <bentshermann@gmail.com>
Co-authored-by: Dr Marco Claudio De La Pierre <marco.delapierre@gmail.com>
Signed-off-by: Niklas Schandry <niklas@bio.lmu.de>
  • Loading branch information
4 people authored and nschan committed Apr 3, 2024
1 parent 751408a commit 813ea35
Show file tree
Hide file tree
Showing 37 changed files with 185 additions and 100 deletions.
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if (groovyVer) {

configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.codehaus.groovy') {
if (details.requested.group == 'org.apache.groovy') {
if( groovyVer.contains(':') )
details.useTarget(groovyVer)
else
Expand Down Expand Up @@ -95,8 +95,8 @@ allprojects {

configurations {
// see https://docs.gradle.org/4.1/userguide/dependency_management.html#sub:exclude_transitive_dependencies
all*.exclude group: 'org.codehaus.groovy', module: 'groovy-all'
all*.exclude group: 'org.codehaus.groovy', module: 'groovy-cli-picocli'
all*.exclude group: 'org.apache.groovy', module: 'groovy-all'
all*.exclude group: 'org.apache.groovy', module: 'groovy-cli-picocli'
// groovydoc libs
groovyDoc.extendsFrom runtime
}
Expand All @@ -109,8 +109,8 @@ allprojects {

// Documentation required libraries
groovyDoc 'org.fusesource.jansi:jansi:1.11'
groovyDoc "org.codehaus.groovy:groovy-groovydoc:3.0.19"
groovyDoc "org.codehaus.groovy:groovy-ant:3.0.19"
groovyDoc "org.apache.groovy:groovy-groovydoc:4.0.18"
groovyDoc "org.apache.groovy:groovy-ant:4.0.18"
}

test {
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
org.gradle.caching=true
org.gradle.jvmargs=-Xmx4g
20 changes: 10 additions & 10 deletions modules/nextflow/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ compileGroovy {
dependencies {
api(project(':nf-commons'))
api(project(':nf-httpfs'))
api "org.codehaus.groovy:groovy:3.0.19"
api "org.codehaus.groovy:groovy-nio:3.0.19"
api "org.codehaus.groovy:groovy-xml:3.0.19"
api "org.codehaus.groovy:groovy-json:3.0.19"
api "org.codehaus.groovy:groovy-templates:3.0.19"
api "org.codehaus.groovy:groovy-yaml:3.0.19"
api "org.apache.groovy:groovy:4.0.18"
api "org.apache.groovy:groovy-nio:4.0.18"
api "org.apache.groovy:groovy-xml:4.0.18"
api "org.apache.groovy:groovy-json:4.0.18"
api "org.apache.groovy:groovy-templates:4.0.18"
api "org.apache.groovy:groovy-yaml:4.0.18"
api "org.slf4j:jcl-over-slf4j:2.0.7"
api "org.slf4j:jul-to-slf4j:2.0.7"
api "org.slf4j:log4j-over-slf4j:2.0.7"
Expand All @@ -48,19 +48,19 @@ dependencies {
testImplementation 'org.subethamail:subethasmtp:3.1.7'

// test configuration
testFixturesApi ("org.codehaus.groovy:groovy-test:3.0.19") { exclude group: 'org.codehaus.groovy' }
testFixturesApi ("org.apache.groovy:groovy-test:4.0.18") { exclude group: 'org.apache.groovy' }
testFixturesApi ("cglib:cglib-nodep:3.3.0")
testFixturesApi ("org.objenesis:objenesis:3.2")
testFixturesApi ("org.spockframework:spock-core:2.3-groovy-3.0") { exclude group: 'org.codehaus.groovy'; exclude group: 'net.bytebuddy' }
testFixturesApi ('org.spockframework:spock-junit4:2.3-groovy-3.0') { exclude group: 'org.codehaus.groovy'; exclude group: 'net.bytebuddy' }
testFixturesApi ("org.spockframework:spock-core:2.3-groovy-4.0") { exclude group: 'org.apache.groovy'; exclude group: 'net.bytebuddy' }
testFixturesApi ('org.spockframework:spock-junit4:2.3-groovy-4.0') { exclude group: 'org.apache.groovy'; exclude group: 'net.bytebuddy' }
testFixturesApi 'com.google.jimfs:jimfs:1.2'

}


test {
minHeapSize = "512m"
maxHeapSize = "2048m"
maxHeapSize = "4096m"
}

application {
Expand Down
25 changes: 13 additions & 12 deletions modules/nextflow/src/main/groovy/nextflow/conda/CondaCache.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class CondaCache {

private String createOptions

private boolean useMamba
private boolean useMamba

private boolean useMicromamba

Expand Down Expand Up @@ -98,23 +98,24 @@ class CondaCache {
CondaCache(CondaConfig config) {
this.config = config

if( config.createTimeout )
createTimeout = config.createTimeout as Duration
if( config.createTimeout() )
createTimeout = config.createTimeout()

if( config.createOptions )
createOptions = config.createOptions
if( config.createOptions() )
createOptions = config.createOptions()

if( config.cacheDir )
configCacheDir0 = (config.cacheDir as Path).toAbsolutePath()
if( config.cacheDir() )
configCacheDir0 = config.cacheDir().toAbsolutePath()

if( config.useMamba && config.useMicroMamba)
if( config.useMamba() && config.useMicromamba() )
throw new IllegalArgumentException("Both conda.useMamba and conda.useMicromamba were enabled -- Please choose only one")

if( config.useMamba )
useMamba = config.useMamba as boolean
if( config.useMamba() ) {
useMamba = config.useMamba()
}

if( config.useMicromamba )
useMicromamba = config.useMicromamba as boolean
if( config.useMicromamba() )
useMicromamba = config.useMicromamba()

if( config.getChannels() )
channels = config.getChannels()
Expand Down
23 changes: 23 additions & 0 deletions modules/nextflow/src/main/groovy/nextflow/conda/CondaConfig.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@

package nextflow.conda

import java.nio.file.Path

import groovy.transform.CompileStatic
import nextflow.util.Duration

/**
* Model Conda configuration
Expand Down Expand Up @@ -57,4 +60,24 @@ class CondaConfig extends LinkedHashMap {

throw new IllegalArgumentException("Unexpected conda.channels value: $value")
}

Duration createTimeout() {
get('createTimeout') as Duration
}

String createOptions() {
get('createOptions') as String
}

Path cacheDir() {
get('cacheDir') as Path
}

boolean useMamba() {
get('useMamba') as boolean
}

boolean useMicromamba() {
get('useMicromamba') as boolean
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package nextflow.executor

import groovy.xml.XmlSlurper

import java.nio.file.Path

import groovy.transform.CompileDynamic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import org.yaml.snakeyaml.Yaml
/**
* Add helper methods to {@link groovy.json.JsonSlurper} class
*
* Check resource file: `META-INF/services/org.codehaus.groovy.runtime.ExtensionModule
* Check resource file: `META-INF/services/org.apache.groovy.runtime.ExtensionModule
*
* @author Paolo Di Tommaso <paolo.ditommaso@gmail.com>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package nextflow.k8s

import groovy.transform.MapConstructor

import java.lang.reflect.Field
import java.nio.file.NoSuchFileException
import java.nio.file.Path
Expand Down Expand Up @@ -48,6 +50,7 @@ import org.codehaus.groovy.runtime.MethodClosure
* @author Paolo Di Tommaso <paolo.ditommaso@gmail.com>
*/
@Slf4j
@MapConstructor(includeFields = true)
class K8sDriverLauncher {

/**
Expand All @@ -60,12 +63,12 @@ class K8sDriverLauncher {
*/
private String headImage

/**
/**
* Request CPUs to be used for the Nextflow driver pod
*/
private int headCpus

/**
/**
* Request memory to be used for the Nextflow driver pod
*/
private String headMemory
Expand Down Expand Up @@ -580,6 +583,26 @@ class K8sDriverLauncher {
ProviderConfig.getScmConfigPath()
}

String getPodImage() {
return podImage
}

int getHeadCpus() {
return headCpus
}

String getHeadMemory() {
return headMemory
}

String getRunName() {
return runName
}

CmdKubeRun getCmd() {
return cmd
}

protected String getPipelineName() {
return pipelineName
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ class K8sTaskHandler extends TaskHandler implements FusionAwareTask {
}

// get input files paths
final paths = DockerBuilder.inputFilesToPaths(builder.getInputFiles())
final binDirs = builder.binDirs
final workDir = builder.workDir
final List<Path> paths = DockerBuilder.inputFilesToPaths(builder.getInputFiles())
final List<Path> binDirs = builder.binDirs
final Path workDir = builder.workDir
// add standard paths
if( binDirs )
paths.addAll(binDirs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,10 @@ class TaskConfig extends LazyMap implements Cloneable {
throw new IllegalArgumentException("Not a valid PublishDir collection [${dirs.getClass().getName()}] $dirs")
}

String getClusterOptions() {
return get('clusterOptions')
}

def getContainer() {
return get('container')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ class TaskContext implements Map<String,Object>, Cloneable {
"DelegateMap[process: $name; script: ${script?.class?.name}; holder: ${holder}]"
}

@Override
Object get(Object property) {
private Object get0(Object property, boolean throwMissingProperty) {
assert property

if( holder.containsKey(property) ) {
Expand All @@ -140,7 +139,14 @@ class TaskContext implements Map<String,Object>, Cloneable {
return script.getBinding().getVariable(property.toString())
}

throw new MissingPropertyException("Unknown variable '$property' -- Make sure it is not misspelled or defined later in the script", property as String, null)
if( throwMissingProperty )
throw new MissingPropertyException("Unknown variable '$property' -- Make sure it is not misspelled or defined later in the script", property as String, null)
return null
}

@Override
Object get(Object property) {
return get0(property, false)
}

/**
Expand All @@ -162,7 +168,7 @@ class TaskContext implements Map<String,Object>, Cloneable {

@Override
def getProperty( String name ) {
get((String)name)
get0((String)name, true)
}

@Override
Expand All @@ -171,7 +177,7 @@ class TaskContext implements Map<String,Object>, Cloneable {
}

@Override
put(String property, Object newValue) {
Object put(String property, Object newValue) {

if( property == 'task' && !(newValue instanceof TaskConfig ) && !overrideWarnShown.getAndSet(true) ) {
log.warn "Process $name overrides reserved variable `task`"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -980,11 +980,11 @@ class AssetManager {
return

List<String> filter = []
if( modules instanceof List ) {
filter.addAll(modules as List)
if( modules instanceof List<String> ) {
filter.addAll(modules)
}
else if( modules instanceof String ) {
filter.addAll( (modules as String).tokenize(', ') )
filter.addAll( modules.tokenize(', ') )
}

final init = git.submoduleInit()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ class ScriptBinding extends WorkflowBinding {
// create and populate args
args = new ArrayList<>()
if( vars.args ) {
if( !(vars.args instanceof List) ) throw new IllegalArgumentException("ScriptBinding 'args' must be a List value")
args.addAll((List)vars.args)
if( !(vars.args instanceof List<String>) ) throw new IllegalArgumentException("ScriptBinding 'args' must be a List value")
args.addAll((List<String>)vars.args)
}
vars.put('args', args)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package nextflow.script

import java.lang.reflect.Modifier
import java.nio.file.Path
import java.nio.file.Paths
import java.time.OffsetDateTime
Expand Down Expand Up @@ -424,7 +425,7 @@ class WorkflowMetadata {
final allProperties = this.metaClass.getProperties()
final result = new LinkedHashMap(allProperties.size())
for( MetaProperty property : allProperties ) {
if( property.name == 'class' )
if( property.name == 'class' || !Modifier.isPublic(property.modifiers) )
continue
try {
result[property.name] = property.getProperty(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class ResourcesBundle {
final private static List<String> BIN_PATHS = ['bin','usr/bin','usr/local/bin']

List<Path> getBinDirs() {
final result = new ArrayList(10)
final result = new ArrayList<Path>(10)
for( Map.Entry<String,Path> it : content ) {
if( it.key in BIN_PATHS && Files.isDirectory(it.value) && !result.contains(it.value) )
result.add(it.value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package nextflow.script.params

import groovy.transform.InheritConstructors
import nextflow.script.TokenVar
import org.codehaus.groovy.runtime.InvokerHelper


/**
Expand Down Expand Up @@ -57,7 +58,7 @@ class ValueOutParam extends BaseOutParam {

switch( target ) {
case TokenVar:
return context.get(target.name)
return InvokerHelper.getProperty(context,target.name)

case Closure:
return target.cloneWith(context).call()
Expand Down
Loading

0 comments on commit 813ea35

Please sign in to comment.