java.lang.Objectantlr.build.Tool
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
Field Summary | |
java.lang.String |
os
|
Constructor Summary | |
Tool()
|
Method Summary | |
void |
antlr(java.lang.String fullyQualifiedFilename)
Run ANTLR on a grammar file, leaving the output in the directory of the grammar file. |
void |
error(java.lang.String msg)
|
void |
error(java.lang.String msg,
java.lang.Exception e)
|
void |
log(java.lang.String cmd)
|
static void |
main(java.lang.String[] args)
|
void |
perform(java.lang.String app,
java.lang.String action)
Find a class named after the app and then find a method within that is named after the action. |
void |
stderr(java.lang.String s)
Stderr from executing sub tools |
void |
stdout(java.lang.String s)
Stdout from executing sub tools |
void |
system(java.lang.String cmd)
A portable system command execution routine that logs stdout/stderr and handles cmd-line wildcards properly. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public java.lang.String os
Constructor Detail |
public Tool()
Method Detail |
public static void main(java.lang.String[] args)
public void perform(java.lang.String app, java.lang.String action)
public void system(java.lang.String cmd)
public void antlr(java.lang.String fullyQualifiedFilename)
public void stdout(java.lang.String s)
public void stderr(java.lang.String s)
public void error(java.lang.String msg)
public void log(java.lang.String cmd)
public void error(java.lang.String msg, java.lang.Exception e)