Public Member Functions | |
Tool () | |
void | perform (String app, String action) |
void | system (String cmd) |
void | antlr (String fullyQualifiedFilename) |
void | stdout (String s) |
void | stderr (String s) |
void | error (String msg) |
void | log (String cmd) |
void | error (String msg, Exception e) |
Static Public Member Functions | |
static void | main (String[] args) |
Public Attributes | |
String | os = null |
An application-specific build tool for ANTLR. Old build was a shell script that of course is not portable. All it did though was to compile; this Java program is a portable compile script. :)
This class knows how to portable invoke a system command with wildcard expansion. It also knows to how dynamically load a project description based upon the name. Actions are just method names within that object. The ANTLR object defines build and jar methods that use Tool to portably compile and jar--it is the replacement the script.
I almost used Python for this, but I hate forcing users to download yet another tool just to compile this one. (Another reason not to use Ant).
I am using a class to describe the build (e.g., ANTLR) rather than a file format at the moment since I am not sure how all this will progress.
Properties antlr.build.compiler and antlr.build.root may be set according to your needs. They default to "javac" and ".". The root is the dir containing the antlr directory associated with the antlr Java package.
To build this builder, run "javac *.java" in this dir.
To build ANTLR, just run
java antlr.build.Tool build"
from the directory containing package antlr's "antlr" dir. Or, use something like:
java -Dantlr.build.root=/usr/local/antlr-2.7.2 antlr.build.Tool build
To make the antlr.jar file, use
java antlr.build.Tool jar
antlr.build.Tool.Tool | ( | ) |
References antlr.build.Tool.os.
Referenced by antlr.build.Tool.main().
void antlr.build.Tool.antlr | ( | String | fullyQualifiedFilename | ) |
Run ANTLR on a grammar file, leaving the output in the directory of the grammar file.
References antlr.build.Tool.error(), and antlr.build.Tool.log().
Referenced by antlr.build.ANTLR.build(), and antlr.build.Tool.perform().
void antlr.build.Tool.error | ( | String | msg, | |
Exception | e | |||
) |
void antlr.build.Tool.error | ( | String | msg | ) |
void antlr.build.Tool.log | ( | String | cmd | ) |
Referenced by antlr.build.Tool.antlr(), and antlr.build.Tool.system().
static void antlr.build.Tool.main | ( | String[] | args | ) | [static] |
References antlr.build.Tool.perform(), and antlr.build.Tool.Tool().
void antlr.build.Tool.perform | ( | String | app, | |
String | action | |||
) |
Find a class named after the app and then find a method within that is named after the action.
References antlr.build.Tool.antlr(), and antlr.build.Tool.error().
Referenced by antlr.build.Tool.main().
void antlr.build.Tool.stderr | ( | String | s | ) |
Stderr from executing sub tools
Referenced by antlr.build.StreamScarfer.run().
void antlr.build.Tool.stdout | ( | String | s | ) |
Stdout from executing sub tools
Referenced by antlr.build.StreamScarfer.run().
void antlr.build.Tool.system | ( | String | cmd | ) |
A portable system command execution routine that logs stdout/stderr and handles cmd-line wildcards properly.
References antlr.build.Tool.error(), antlr.build.Tool.log(), and antlr.build.Tool.os.
Referenced by antlr.build.ANTLR.build(), and antlr.build.ANTLR.jar().
String antlr.build.Tool.os = null |
Referenced by antlr.build.Tool.system(), and antlr.build.Tool.Tool().