diff --git a/modules/nextflow/src/main/groovy/nextflow/ast/NextflowDSLImpl.groovy b/modules/nextflow/src/main/groovy/nextflow/ast/NextflowDSLImpl.groovy index 54f604e6e2..10a9c29716 100644 --- a/modules/nextflow/src/main/groovy/nextflow/ast/NextflowDSLImpl.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/ast/NextflowDSLImpl.groovy @@ -203,7 +203,7 @@ class NextflowDSLImpl implements ASTTransformation { if( call.methodAsString=='include' && call.arguments instanceof ArgumentListExpression ) { final allArgs = (ArgumentListExpression)call.arguments if( allArgs.size() != 1 || allArgs[0] !instanceof ClosureExpression ) { - syntaxError(call, "Invalid include statement -- the correct syntax is `include { ... } from '...'`") + syntaxError(call, "Not a valid include statement -- the correct syntax is `include { ... } from '...'`") return } @@ -230,13 +230,13 @@ class NextflowDSLImpl implements ASTTransformation { } // otherwise return an error else { - syntaxError(call, "Invalid include module name") + syntaxError(call, "Not a valid include module name") return } modulesList.addExpression(moduleX) } else { - syntaxError(call, "Invalid include module name") + syntaxError(call, "Not a valid include module name") return } } @@ -815,7 +815,7 @@ class NextflowDSLImpl implements ASTTransformation { def nested = methodCall.objectExpression instanceof MethodCallExpression log.trace "convert > input method: $methodName" - if( methodName in ['val','env','file','each','stdin','path','tuple'] ) { + if( methodName in ['val','env','file','each','set','stdin','path','tuple'] ) { //this methods require a special prefix if( !nested ) methodCall.setMethod( new ConstantExpression('_in_' + methodName) ) @@ -895,7 +895,7 @@ class NextflowDSLImpl implements ASTTransformation { def nested = methodCall.objectExpression instanceof MethodCallExpression log.trace "convert > output method: $methodName" - if( methodName in ['val','env','file','stdout','path','tuple'] && !nested ) { + if( methodName in ['val','env','file','set','stdout','path','tuple'] && !nested ) { // prefix the method name with the string '_out_' methodCall.setMethod( new ConstantExpression('_out_' + methodName) ) fixMethodCall(methodCall) @@ -929,7 +929,7 @@ class NextflowDSLImpl implements ASTTransformation { protected void fixMethodCall( MethodCallExpression methodCall ) { final name = methodCall.methodAsString - withinTupleMethod = name == '_in_tuple' || name == '_out_tuple' + withinTupleMethod = name == '_in_set' || name == '_out_set' || name == '_in_tuple' || name == '_out_tuple' withinEachMethod = name == '_in_each' try { diff --git a/modules/nextflow/src/main/groovy/nextflow/script/BaseScript.groovy b/modules/nextflow/src/main/groovy/nextflow/script/BaseScript.groovy index a0dac5521d..8ea9584951 100644 --- a/modules/nextflow/src/main/groovy/nextflow/script/BaseScript.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/script/BaseScript.groovy @@ -91,7 +91,6 @@ abstract class BaseScript extends Script implements ExecutionContext { } protected process( String name, Closure body ) { - log.info "BaseScript.process ${name}" def process = new ProcessDef(this,body,name) meta.addDefinition(process) } diff --git a/modules/nextflow/src/main/groovy/nextflow/script/IncludeDef.groovy b/modules/nextflow/src/main/groovy/nextflow/script/IncludeDef.groovy index fe9f9d49de..07069f606d 100644 --- a/modules/nextflow/src/main/groovy/nextflow/script/IncludeDef.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/script/IncludeDef.groovy @@ -57,6 +57,17 @@ class IncludeDef { @PackageScope Map addedParams private Session session + @Deprecated + IncludeDef( String module ) { + throw new DeprecationException("Anonymous module inclusion is deprecated -- Replace `include '${module}'` with `include { MODULE_NAME } from '${module}'`") + } + + @Deprecated + IncludeDef(TokenVar token, String alias=null) { + def component = token.name; if(alias) component += " as $alias" + throw new DeprecationException("Unwrapped module inclusion is deprecated -- Replace `include $component from './MODULE/PATH'` with `include { $component } from './MODULE/PATH'`") + } + protected IncludeDef(List modules) { this.modules = new ArrayList<>(modules) } diff --git a/modules/nextflow/src/main/groovy/nextflow/script/ProcessConfig.groovy b/modules/nextflow/src/main/groovy/nextflow/script/ProcessConfig.groovy index e4b5a75b89..1fa9ec6489 100644 --- a/modules/nextflow/src/main/groovy/nextflow/script/ProcessConfig.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/script/ProcessConfig.groovy @@ -49,20 +49,22 @@ class ProcessConfig implements Map, Cloneable { 'afterScript', 'beforeScript', 'cache', - 'cleanup', - 'clusterOptions', 'conda', + 'cpus', 'container', 'containerOptions', - 'cpus', + 'cleanup', + 'clusterOptions', 'debug', 'disk', + 'echo', // deprecated 'errorStrategy', 'executor', 'ext', 'fair', - 'label', 'machineType', + 'queue', + 'label', 'maxErrors', 'maxForks', 'maxRetries', @@ -71,24 +73,24 @@ class ProcessConfig implements Map, Cloneable { 'penv', 'pod', 'publishDir', - 'queue', - 'resourceLabels', 'scratch', - 'secret', 'shell', 'spack', - 'stageInMode', - 'stageOutMode', 'storeDir', 'tag', 'time', // input-output qualifiers 'file', + 'set', 'val', 'each', 'env', + 'secret', 'stdin', - 'stdout' + 'stdout', + 'stageInMode', + 'stageOutMode', + 'resourceLabels' ] /** @@ -533,6 +535,10 @@ class ProcessConfig implements Map, Cloneable { new EachInParam(this).bind(obj) } + InParam _in_set( Object... obj ) { + throw new DeprecationException("Input of type `set` is deprecated -- Use `tuple` instead") + } + InParam _in_tuple( Object... obj ) { new TupleInParam(this).bind(obj) } @@ -597,6 +603,10 @@ class ProcessConfig implements Map, Cloneable { } } + OutParam _out_set( Object... obj ) { + throw new DeprecationException("Output of type `set` is deprecated -- Use `tuple` instead") + } + OutParam _out_tuple( Object... obj ) { new TupleOutParam(this) .bind(obj) } diff --git a/modules/nextflow/src/main/groovy/nextflow/script/params/BaseInParam.groovy b/modules/nextflow/src/main/groovy/nextflow/script/params/BaseInParam.groovy index 9bfaf0a9f9..389a131ecc 100644 --- a/modules/nextflow/src/main/groovy/nextflow/script/params/BaseInParam.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/script/params/BaseInParam.groovy @@ -156,6 +156,10 @@ abstract class BaseInParam extends BaseParam implements InParam { throw new IllegalArgumentException(message) } + BaseInParam from( def obj ) { + throw new ScriptRuntimeException("Process clause `from` is no longer supported in DSL2") + } + void setFrom( obj ) { checkFromNotNull(obj) fromObject = obj @@ -169,6 +173,10 @@ abstract class BaseInParam extends BaseParam implements InParam { throw new IllegalStateException("Missing input channel") } + BaseInParam from( Object... obj ) { + throw new ScriptRuntimeException("Process clause `from` is no longer supported in DSL2") + } + def decodeInputs( List inputs ) { final UNDEF = -1 as short def value = inputs[index] diff --git a/modules/nextflow/src/main/groovy/nextflow/script/params/BaseOutParam.groovy b/modules/nextflow/src/main/groovy/nextflow/script/params/BaseOutParam.groovy index 944af9e8f7..2e15767e0f 100644 --- a/modules/nextflow/src/main/groovy/nextflow/script/params/BaseOutParam.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/script/params/BaseOutParam.groovy @@ -150,6 +150,14 @@ abstract class BaseOutParam extends BaseParam implements OutParam { return this } + BaseOutParam into( def value ) { + throw new ScriptRuntimeException("Process clause `into` is no longer supported in DSL2") + } + + BaseOutParam into( TokenVar... vars ) { + throw new ScriptRuntimeException("Process clause `into` is no longer supported in DSL2") + } + void setInto( Object obj ) { intoObj = obj } @@ -159,6 +167,12 @@ abstract class BaseOutParam extends BaseParam implements OutParam { return outChannels ? outChannels.get(0) : null } + @Deprecated + List getOutChannels() { + init() + return outChannels + } + String getName() { if( nameObj != null ) return nameObj.toString() diff --git a/modules/nextflow/src/main/groovy/nextflow/script/params/InParam.groovy b/modules/nextflow/src/main/groovy/nextflow/script/params/InParam.groovy index a682016f49..c806e23d7b 100644 --- a/modules/nextflow/src/main/groovy/nextflow/script/params/InParam.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/script/params/InParam.groovy @@ -32,6 +32,10 @@ interface InParam extends Cloneable { Object getRawChannel() + InParam from( Object value ) + + InParam from( Object... values ) + short index short mapIndex diff --git a/modules/nextflow/src/test/groovy/nextflow/script/ScriptIncludesTest.groovy b/modules/nextflow/src/test/groovy/nextflow/script/ScriptIncludesTest.groovy index 715987e399..916a69a6b7 100644 --- a/modules/nextflow/src/test/groovy/nextflow/script/ScriptIncludesTest.groovy +++ b/modules/nextflow/src/test/groovy/nextflow/script/ScriptIncludesTest.groovy @@ -1158,7 +1158,7 @@ class ScriptIncludesTest extends Dsl2Spec { def result = runner.setScript(SCRIPT).execute() then: def e = thrown(ScriptCompilationException) - e.message.contains "Invalid include statement -- the correct syntax is `include { ... } from '...'`" + e.message.contains "Not a valid include statement -- the correct syntax is `include { ... } from '...'`" }