Skip to content

Commit

Permalink
Add deprecation warning for shell block
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Sherman <[email protected]>
  • Loading branch information
bentsherman committed Nov 14, 2024
1 parent 87fa476 commit 32c814b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/main/groovy/nextflow/script/v2/ScriptAstBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ private ProcessNode processDef(ProcessDefContext ctx) {

if( ctx.body.blockStatements() != null ) {
if( !(directives instanceof EmptyStatement) || !(inputs instanceof EmptyStatement) || !(outputs instanceof EmptyStatement) )
collectSyntaxError(new SyntaxException("The `script:`, `shell:`, or `exec:` label is required when other sections are present", exec));
collectSyntaxError(new SyntaxException("The `script:` or `exec:` label is required when other sections are present", exec));
}

var result = ast( new ProcessNode(name, directives, inputs, outputs, when, type, exec, stub), ctx );
Expand Down Expand Up @@ -483,12 +483,14 @@ private String processType(ProcessExecContext ctx) {
if( ctx == null )
return "script";

if( ctx.EXEC() != null )
if( ctx.EXEC() != null ) {
return "exec";
else if( ctx.SHELL() != null )
}
if( ctx.SHELL() != null ) {
collectWarning("The `shell` block is deprecated, use `script` instead", ast( new EmptyExpression(), ctx.SHELL() ));
return "shell";
else
return "script";
}
return "script";
}

private Statement processStub(ProcessStubContext ctx) {
Expand Down

0 comments on commit 32c814b

Please sign in to comment.