PR: 12961 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274364 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -76,6 +76,9 @@ Fixed bugs: | |||||
| * The <stripjavacomments> filter sometimes removed parts of string | * The <stripjavacomments> filter sometimes removed parts of string | ||||
| constants. Bugzilla Report 17441. | constants. Bugzilla Report 17441. | ||||
| * <antlr> will now recompile your grammar if the supergrammar has | |||||
| changed. Bugzilla Report 12691. | |||||
| Other changes: | Other changes: | ||||
| -------------- | -------------- | ||||
| * Shipped XML parser is now Xerces 2.4.0 | * Shipped XML parser is now Xerces 2.4.0 | ||||
| @@ -21,10 +21,11 @@ | |||||
| the grammar file. | the grammar file. | ||||
| </p> | </p> | ||||
| <p> | <p> | ||||
| This task only invokes ANTLR if the grammar file is newer than the generated | |||||
| files. | |||||
| This task only invokes ANTLR if the grammar file (or the | |||||
| supergrammar specified by the glib attribute) is newer than the | |||||
| generated files. | |||||
| </p> | </p> | ||||
| <p> | |||||
| <p>Antlr 2.7.1 Note: | |||||
| <i> | <i> | ||||
| To successfully run ANTLR, your best option is probably to build the whole | To successfully run ANTLR, your best option is probably to build the whole | ||||
| jar with the provided script <b>mkalljar</b> and drop the resulting jar (about 300KB) | jar with the provided script <b>mkalljar</b> and drop the resulting jar (about 300KB) | ||||
| @@ -33,6 +34,13 @@ | |||||
| to your classpath as described in ANTLR <tt>install.html</tt> document. | to your classpath as described in ANTLR <tt>install.html</tt> document. | ||||
| </i> | </i> | ||||
| </p> | </p> | ||||
| <p>Antlr 2.7.2 Note: | |||||
| <i> | |||||
| Instead of the above, you will need antlrall.jar that can be created | |||||
| by the <b>antlr-all.jar</b> target of the Makefile provided with the | |||||
| download. | |||||
| </i> | |||||
| </p> | |||||
| <h3>Parameters</h3> | <h3>Parameters</h3> | ||||
| <table border="1" cellpadding="2" cellspacing="0"> | <table border="1" cellpadding="2" cellspacing="0"> | ||||
| @@ -170,7 +178,7 @@ href="../using.html#arg">Command line arguments</a>.</p> | |||||
| </p> | </p> | ||||
| <hr> | <hr> | ||||
| <p align="center">Copyright © 2000-2002 Apache Software Foundation. All rights | |||||
| <p align="center">Copyright © 2000-2003 Apache Software Foundation. All rights | |||||
| Reserved.</p> | Reserved.</p> | ||||
| </body> | </body> | ||||
| @@ -276,10 +276,18 @@ public class ANTLR extends Task { | |||||
| validateAttributes(); | validateAttributes(); | ||||
| //TODO: use ANTLR to parse the grammer file to do this. | //TODO: use ANTLR to parse the grammer file to do this. | ||||
| File generatedFile = getGeneratedFile(); | File generatedFile = getGeneratedFile(); | ||||
| if (target.lastModified() > generatedFile.lastModified()) { | |||||
| log("Compiling " + target + " as it is newer than " | |||||
| + generatedFile, Project.MSG_VERBOSE); | |||||
| boolean targetIsOutOfDate = | |||||
| target.lastModified() > generatedFile.lastModified(); | |||||
| boolean superGrammarIsOutOfDate = superGrammar != null && | |||||
| (new File(superGrammar).lastModified() > generatedFile.lastModified()); | |||||
| if (targetIsOutOfDate || superGrammarIsOutOfDate) { | |||||
| if (targetIsOutOfDate) { | |||||
| log("Compiling " + target + " as it is newer than " | |||||
| + generatedFile, Project.MSG_VERBOSE); | |||||
| } else if (superGrammarIsOutOfDate) { | |||||
| log("Compiling " + target + " as " + superGrammar | |||||
| + " is newer than " + generatedFile, Project.MSG_VERBOSE); | |||||
| } | |||||
| populateAttributes(); | populateAttributes(); | ||||
| commandline.createArgument().setValue(target.toString()); | commandline.createArgument().setValue(target.toString()); | ||||