Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Groovy 4 #4443

Merged
merged 36 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
44482d1
Bumpo JGit 6.1.0.202203080745-r
pditommaso Apr 27, 2022
a999d02
feature: upgrade to groovy 4.0.2
jorgeaguileraseqera Apr 29, 2022
46f4915
feature: upgrade to groovy 4.0.2
jorgeaguileraseqera May 4, 2022
77725f9
ignore k8s test by the moment due conflicts
jorgeaguileraseqera May 4, 2022
31d2c29
Merge branch 'master' into feature-groovy4
pditommaso May 28, 2022
40ecdd8
Bump groovy 4.0.7 + fix tests
pditommaso Dec 25, 2022
0eac124
Merge master at 5eaa04af
pditommaso Dec 25, 2022
f2419ff
Fix XFileSystemProvider hangs with Groovy 4
pditommaso Dec 26, 2022
c1d2aa7
Improve docs
pditommaso Dec 26, 2022
05e2fc4
Bump Groovy 4.0.7
pditommaso Dec 26, 2022
2262bad
Revert changes
pditommaso Dec 26, 2022
0815ff6
Increase jvm mem to 4G
pditommaso Dec 26, 2022
fabbee3
Merge branch 'master' into feature-groovy4
pditommaso Oct 21, 2023
6e89f24
Bump Groovy 4.0.15
pditommaso Oct 21, 2023
32e1c5c
Merge branch 'master' into feature-groovy4
pditommaso Oct 21, 2023
1c9e639
Merge branch 'master' into feature-groovy4
pditommaso Oct 28, 2023
60d6a73
Fix generic type
pditommaso Nov 1, 2023
79b8927
Fix task context getter
pditommaso Nov 1, 2023
167c531
Merge branch 'master' into feature-groovy4
pditommaso Nov 1, 2023
9388919
Merge branch 'master' into feature-groovy4
pditommaso Dec 2, 2023
ae2f992
Do not include non-public method in workflow meta map
pditommaso Dec 3, 2023
d095414
Merge branch 'master' into feature-groovy4
pditommaso Dec 3, 2023
8f49cfa
Minor change [ci fast]
pditommaso Dec 3, 2023
9d727f1
Minor changes
pditommaso Dec 3, 2023
86a9d42
Improve GLS tests
pditommaso Dec 3, 2023
6b88c69
Merge branch 'master' into feature-groovy4
pditommaso Dec 9, 2023
db84cc4
Merge branch 'master' into feature-groovy4
pditommaso Jan 20, 2024
bbee251
Bump groovy 4.0.18
pditommaso Jan 20, 2024
acfe5cf
minor change
bentsherman Jan 23, 2024
bcdbf0e
Merge branch 'master' into feature-groovy4
marcodelapierre Feb 5, 2024
0fe3e69
Merge branch 'master' into feature-groovy4
pditommaso Feb 5, 2024
6d6a716
Revert change [ci fast]
pditommaso Feb 5, 2024
8a212f3
Revert changes
pditommaso Feb 5, 2024
787859e
Revert quirk change [ci fast]
pditommaso Feb 5, 2024
61f86f5
Bump spock 2.3
pditommaso Feb 5, 2024
d73a5f5
Bump groovy 4 to cloudcache
pditommaso Feb 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.2-groovy-4.0") { exclude group: 'org.apache.groovy'; exclude group: 'net.bytebuddy' }
testFixturesApi ('org.spockframework:spock-junit4:2.2-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