mirror of
https://github.com/ethauvin/bld-antlr4.git
synced 2025-04-25 08:47:11 -07:00
Merge pull request #1 from ethauvin/main
Ensure execution stops on failure
This commit is contained in:
commit
cb79240c47
2 changed files with 11 additions and 5 deletions
|
@ -3,4 +3,4 @@ bld.downloadExtensionSources=true
|
||||||
bld.extensions=
|
bld.extensions=
|
||||||
bld.repositories=MAVEN_CENTRAL,RIFE2_RELEASES
|
bld.repositories=MAVEN_CENTRAL,RIFE2_RELEASES
|
||||||
bld.downloadLocation=
|
bld.downloadLocation=
|
||||||
bld.version=1.9.1
|
bld.version=2.0.0-SNAPSHOT
|
||||||
|
|
|
@ -6,6 +6,7 @@ package rife.bld.extension;
|
||||||
|
|
||||||
import org.antlr.v4.Tool;
|
import org.antlr.v4.Tool;
|
||||||
import rife.bld.operations.AbstractOperation;
|
import rife.bld.operations.AbstractOperation;
|
||||||
|
import rife.bld.operations.exceptions.ExitStatusException;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -51,7 +52,7 @@ public class Antlr4Operation extends AbstractOperation<Antlr4Operation> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sources.isEmpty()) {
|
if (sources.isEmpty()) {
|
||||||
throw new IllegalArgumentException("ERROR: no ANTLR grammars found");
|
throw new IllegalArgumentException("ERROR: no ANTLR grammars found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
var arguments = new ArrayList<>(arguments_);
|
var arguments = new ArrayList<>(arguments_);
|
||||||
|
@ -83,10 +84,15 @@ public class Antlr4Operation extends AbstractOperation<Antlr4Operation> {
|
||||||
|
|
||||||
var argument_array = new String[arguments.size()];
|
var argument_array = new String[arguments.size()];
|
||||||
arguments.toArray(argument_array);
|
arguments.toArray(argument_array);
|
||||||
new Tool(argument_array).processGrammarsOnCommandLine();
|
var tool = new Tool(argument_array);
|
||||||
|
tool.processGrammarsOnCommandLine();
|
||||||
|
if (tool.getNumErrors() == 0) {
|
||||||
if (!silent()) {
|
if (!silent()) {
|
||||||
System.out.println("ANTLR4 grammar processed successfully.");
|
System.out.println("ANTLR4 grammar processed successfully.");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new ExitStatusException(ExitStatusException.EXIT_FAILURE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue