1818import org .gradle .api .tasks .PathSensitive ;
1919import org .gradle .api .tasks .PathSensitivity ;
2020import org .gradle .api .tasks .TaskAction ;
21+ import org .gradle .process .ExecOperations ;
2122
2223import static org .hibernate .orm .antlr .AntlrHelper .stripSillyGeneratedFromLines ;
2324
2728@ CacheableTask
2829public abstract class SplitGrammarGenerationTask extends DefaultTask {
2930 private final SplitGrammarDescriptor grammarDescriptor ;
31+ private final ExecOperations execOperations ;
3032
3133 private final Provider <RegularFile > lexerGrammarFile ;
3234 private final Provider <RegularFile > parserGrammarFile ;
@@ -35,8 +37,12 @@ public abstract class SplitGrammarGenerationTask extends DefaultTask {
3537 private final Provider <Directory > outputDirectory ;
3638
3739 @ Inject
38- public SplitGrammarGenerationTask (SplitGrammarDescriptor grammarDescriptor , AntlrSpec antlrSpec ) {
40+ public SplitGrammarGenerationTask (
41+ SplitGrammarDescriptor grammarDescriptor ,
42+ AntlrSpec antlrSpec ,
43+ ExecOperations execOperations ) {
3944 this .grammarDescriptor = grammarDescriptor ;
45+ this .execOperations = execOperations ;
4046
4147 lexerGrammarFile = getProject ().provider ( () -> {
4248 final Directory grammarBaseDirectory = antlrSpec .getGrammarBaseDirectory ().get ();
@@ -109,7 +115,7 @@ private void generateLexer(File outputDir) {
109115 );
110116
111117
112- getProject () .javaexec (
118+ execOperations .javaexec (
113119 (javaExecSpec ) -> {
114120 javaExecSpec .setMain ( "org.antlr.v4.Tool" );
115121 javaExecSpec .classpath ( getProject ().getConfigurations ().getByName ( "antlr" ) );
@@ -133,7 +139,7 @@ private void generateParser(File outputDir) {
133139 );
134140
135141
136- getProject () .javaexec (
142+ execOperations .javaexec (
137143 (javaExecSpec ) -> {
138144 javaExecSpec .setMain ( "org.antlr.v4.Tool" );
139145 javaExecSpec .classpath ( getProject ().getConfigurations ().named ( "antlr" ) );
0 commit comments