Ensure execution stops on failure
Some checks failed
bld-ci / build-project (17) (push) Has been cancelled
bld-ci / build-project (19) (push) Has been cancelled
bld-ci / build-project (20) (push) Has been cancelled
javadocs-pages / deploy (push) Has been cancelled

This commit is contained in:
Erik C. Thauvin 2024-06-24 20:57:45 -07:00
parent 2c7f9f9e3e
commit abb52f281a
Signed by: erik
GPG key ID: 776702A6A2DA330E

View file

@ -6,6 +6,7 @@ package rife.bld.extension;
import org.antlr.v4.Tool;
import rife.bld.operations.AbstractOperation;
import rife.bld.operations.exceptions.ExitStatusException;
import java.io.File;
import java.util.*;
@ -51,7 +52,10 @@ public class Antlr4Operation extends AbstractOperation<Antlr4Operation> {
}
if (sources.isEmpty()) {
throw new IllegalArgumentException("ERROR: no ANTLR grammars found");
if (!silent()) {
System.out.println("ERROR: no ANTLR grammars found.");
}
throw new ExitStatusException(1);
}
var arguments = new ArrayList<>(arguments_);
@ -83,10 +87,15 @@ public class Antlr4Operation extends AbstractOperation<Antlr4Operation> {
var argument_array = new String[arguments.size()];
arguments.toArray(argument_array);
new Tool(argument_array).processGrammarsOnCommandLine();
var tool = new Tool(argument_array);
tool.processGrammarsOnCommandLine();
if (tool.getNumErrors() == 0) {
if (!silent()) {
System.out.println("ANTLR4 grammar processed successfully.");
}
} else {
throw new ExitStatusException(1);
}
}
/**