MCPcopy Create free account
hub / github.com/QuiltMC/chasm / GenerateParserTask

Class GenerateParserTask

buildSrc/src/main/java/GenerateParserTask.java:13–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11import org.gradle.api.tasks.TaskAction;
12
13public abstract class GenerateParserTask extends DefaultTask {
14 @InputFile
15 public abstract RegularFileProperty getGrammarFile();
16
17 @OutputDirectory
18 public abstract DirectoryProperty getOutputDir();
19
20 @TaskAction
21 public void run() {
22 getProject().delete(getOutputDir());
23
24 int returnValue;
25 try {
26 returnValue = Main.mainProgram(
27 getGrammarFile().get().getAsFile().toPath(),
28 getOutputDir().get().getAsFile().toPath(),
29 "java",
30 8,
31 true,
32 Collections.emptyMap()
33 );
34 } catch (Exception e) {
35 throw new RuntimeException(e);
36 }
37
38 if (returnValue != 0) {
39 throw new RuntimeException("JavaCC returned a non-zero exit code.");
40 }
41 }
42}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected