Merge branch 'maven-updates' into master

This commit is contained in:
Sam Harwell 2012-11-26 22:34:48 -06:00
commit 8e9619a731
8 changed files with 147 additions and 67 deletions

View File

@ -194,20 +194,20 @@
<dependency> <dependency>
<groupId>org.apache.maven</groupId> <groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId> <artifactId>maven-plugin-api</artifactId>
<version>2.0</version> <version>3.0.4</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.maven</groupId> <groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId> <artifactId>maven-project</artifactId>
<version>2.0</version> <version>2.2.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.codehaus.plexus</groupId> <groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-api</artifactId> <artifactId>plexus-compiler-api</artifactId>
<version>1.8.6</version> <version>2.0</version>
</dependency> </dependency>
<!-- <!--
@ -228,7 +228,7 @@
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>4.10</version> <version>4.11</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
@ -239,7 +239,14 @@
<version>1.1</version> <version>1.1</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.2</version>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
@ -258,7 +265,7 @@
<plugin> <plugin>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version> <version>2.5.1</version>
<configuration> <configuration>
<source>1.6</source> <source>1.6</source>
<target>1.6</target> <target>1.6</target>
@ -270,16 +277,40 @@
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.2</version>
<configuration>
<!-- see http://jira.codehaus.org/browse/MNG-5346 -->
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
<executions>
<execution>
<id>mojo-descriptor</id>
<goals>
<goal>descriptor</goal>
</goals>
</execution>
<execution>
<id>help-goal</id>
<goals>
<goal>helpmojo</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId> <artifactId>maven-site-plugin</artifactId>
<version>3.0</version> <version>3.2</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId> <artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.4</version> <version>2.6</version>
<configuration> <configuration>
<dependencyLocationsEnabled>false</dependencyLocationsEnabled> <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
</configuration> </configuration>
@ -288,7 +319,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId> <artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version> <version>2.2.1</version>
<executions> <executions>
<execution> <execution>
<id>attach-sources</id> <id>attach-sources</id>
@ -299,6 +330,20 @@
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>

View File

@ -55,7 +55,7 @@ public class Antlr4ErrorLog implements ANTLRToolListener {
/** /**
* Sends an informational message to the Maven log sink. * Sends an informational message to the Maven log sink.
* @param s The message to send to Maven * @param message The message to send to Maven
*/ */
@Override @Override
public void info(String message) { public void info(String message) {

View File

@ -43,6 +43,10 @@ import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.logging.Log; import org.apache.maven.plugin.logging.Log;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.compiler.util.scan.InclusionScanException; import org.codehaus.plexus.compiler.util.scan.InclusionScanException;
import org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner; import org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner;
@ -67,15 +71,14 @@ import java.util.Set;
* Goal that picks up all the ANTLR grammars in a project and moves those that * Goal that picks up all the ANTLR grammars in a project and moves those that
* are required for generation of the compilable sources into the location * are required for generation of the compilable sources into the location
* that we use to compile them, such as target/generated-sources/antlr4 ... * that we use to compile them, such as target/generated-sources/antlr4 ...
*
* @goal antlr
*
* @phase process-sources
* @requiresDependencyResolution compile
* @requiresProject true
* *
* @author <a href="mailto:jimi@temporal-wave.com">Jim Idle</a> * @author <a href="mailto:jimi@temporal-wave.com">Jim Idle</a>
*/ */
@Mojo(
name = "antlr",
defaultPhase = LifecyclePhase.PROCESS_SOURCES,
requiresDependencyResolution = ResolutionScope.COMPILE,
requiresProject = true)
public class Antlr4Mojo public class Antlr4Mojo
extends AbstractMojo { extends AbstractMojo {
@ -86,60 +89,52 @@ public class Antlr4Mojo
* If set to true, then after the tool has processed an input grammar file * If set to true, then after the tool has processed an input grammar file
* it will report variaous statistics about the parser, such as information * it will report variaous statistics about the parser, such as information
* on cyclic DFAs, which rules may use backtracking, and so on. * on cyclic DFAs, which rules may use backtracking, and so on.
*
* @parameter default-value="false"
*/ */
@Parameter(defaultValue = "false")
protected boolean report; protected boolean report;
/** /**
* If set to true, then the ANTLR tool will print a version of the input * If set to true, then the ANTLR tool will print a version of the input
* grammar which is devoid of any actions that may be present in the input file. * grammar which is devoid of any actions that may be present in the input file.
*
* @parameter default-value="false"
*/ */
@Parameter(defaultValue = "false")
protected boolean printGrammar; protected boolean printGrammar;
/** /**
* If set to true, then the code generated by the ANTLR code generator will * If set to true, then the code generated by the ANTLR code generator will
* be set to debug mode. This means that when run, the code will 'hang' and * be set to debug mode. This means that when run, the code will 'hang' and
* wait for a debug connection on a TCP port (49100 by default). * wait for a debug connection on a TCP port (49100 by default).
*
* @parameter default-value="false"
*/ */
@Parameter(defaultValue = "false")
protected boolean debug; protected boolean debug;
/** /**
* If set to true, then then the generated parser will compute and report on * If set to true, then then the generated parser will compute and report on
* profile information at runtime. * profile information at runtime.
*
* @parameter default-value="false"
*/ */
@Parameter(defaultValue = "false")
protected boolean profile; protected boolean profile;
/** /**
* If set to true then the ANTLR tool will generate a description of the atn * If set to true then the ANTLR tool will generate a description of the atn
* for each rule in <a href="http://www.graphviz.org">Dot format</a> * for each rule in <a href="http://www.graphviz.org">Dot format</a>
*
* @parameter default-value="false"
*/ */
@Parameter(defaultValue = "false")
protected boolean atn; protected boolean atn;
/** /**
* If set to true, the generated parser code will log rule entry and exit points * If set to true, the generated parser code will log rule entry and exit points
* to stdout as an aid to debugging. * to stdout as an aid to debugging.
*
* @parameter default-value="false"
*/ */
@Parameter(defaultValue = "false")
protected boolean trace; protected boolean trace;
/** /**
* If this parameter is set, it indicates that any warning or error messages returned * If this parameter is set, it indicates that any warning or error messages returned
* by ANLTR, shoould be formatted in the specified way. Currently, ANTLR suports the * by ANLTR, shoould be formatted in the specified way. Currently, ANTLR suports the
* built-in formats of antlr, gnu and vs2005. * built-in formats of antlr, gnu and vs2005.
*
* @parameter default-value="antlr"
*/ */
@Parameter(defaultValue = "antlr")
protected String messageFormat; protected String messageFormat;
/** /**
* If this parameter is set to true, then ANTLR will report all sorts of things * If this parameter is set to true, then ANTLR will report all sorts of things
* about what it is doing such as the names of files and the version of ANTLR and so on. * about what it is doing such as the names of files and the version of ANTLR and so on.
*
* @parameter default-value="true"
*/ */
@Parameter(defaultValue = "true")
protected boolean verbose; protected boolean verbose;
protected boolean verbose_dfa; protected boolean verbose_dfa;
@ -151,9 +146,8 @@ public class Antlr4Mojo
/** /**
* The number of alts, beyond which ANTLR will not generate a switch statement * The number of alts, beyond which ANTLR will not generate a switch statement
* for the DFA. * for the DFA.
*
* @parameter default-value="300"
*/ */
@Parameter(defaultValue = "300")
private int maxSwitchCaseLabels; private int maxSwitchCaseLabels;
/** /**
@ -177,50 +171,41 @@ public class Antlr4Mojo
* this version of the plugin looks for the directory antlr4 and not the directory * this version of the plugin looks for the directory antlr4 and not the directory
* antlr, so as to avoid clashes and confusion for projects that use both v3 and v4 grammars * antlr, so as to avoid clashes and confusion for projects that use both v3 and v4 grammars
* such as ANTLR itself. * such as ANTLR itself.
*
* @parameter
*/ */
@Parameter
protected Set<String> includes = new HashSet<String>(); protected Set<String> includes = new HashSet<String>();
/** /**
* Provides an explicit list of any grammars that should be excluded from * Provides an explicit list of any grammars that should be excluded from
* the generate phase of the plugin. Files listed here will not be sent for * the generate phase of the plugin. Files listed here will not be sent for
* processing by the ANTLR tool. * processing by the ANTLR tool.
*
* @parameter
*/ */
@Parameter
protected Set<String> excludes = new HashSet<String>(); protected Set<String> excludes = new HashSet<String>();
/** /**
* @parameter expression="${project}"
* @required
* @readonly
*/ */
@Parameter(property = "project", required = true, readonly = true)
protected MavenProject project; protected MavenProject project;
/** /**
* Specifies the Antlr directory containing grammar files. For * Specifies the Antlr directory containing grammar files. For
* antlr version 4.x we default this to a directory in the tree * antlr version 4.x we default this to a directory in the tree
* called antlr4 because the antlr3 directory is occupied by version * called antlr4 because the antlr3 directory is occupied by version
* 3.x grammars. * 3.x grammars.
*
* @parameter default-value="${basedir}/src/main/antlr4"
* @required
*/ */
@Parameter(defaultValue = "${basedir}/src/main/antlr4", required = true)
private File sourceDirectory; private File sourceDirectory;
/** /**
* Location for generated Java files. For antlr version 4.x we default * Location for generated Java files. For antlr version 4.x we default
* this to a directory in the tree called antlr4 because the antlr * this to a directory in the tree called antlr4 because the antlr
* directory is occupied by version 2.x grammars. * directory is occupied by version 2.x grammars.
*
* @parameter default-value="${project.build.directory}/generated-sources/antlr4"
* @required
*/ */
@Parameter(defaultValue = "${project.build.directory}/generated-sources/antlr4", required = true)
private File outputDirectory; private File outputDirectory;
/** /**
* Location for imported token files, e.g. <code>.tokens</code> and imported grammars. * Location for imported token files, e.g. <code>.tokens</code> and imported grammars.
* Note that ANTLR will not try to process grammars that it finds to be imported * Note that ANTLR will not try to process grammars that it finds to be imported
* into other grammars (in the same processing session). * into other grammars (in the same processing session).
*
* @parameter default-value="${basedir}/src/main/antlr4/imports"
*/ */
@Parameter(defaultValue = "${basedir}/src/main/antlr4/imports")
private File libDirectory; private File libDirectory;
public File getSourceDirectory() { public File getSourceDirectory() {
@ -481,7 +466,7 @@ public class Antlr4Mojo
throws TokenStreamException, RecognitionException, IOException, InclusionScanException { throws TokenStreamException, RecognitionException, IOException, InclusionScanException {
// Which files under the source set should we be looking for as grammar files // Which files under the source set should we be looking for as grammar files
// //
SourceMapping mapping = new SuffixMapping("g4", Collections.EMPTY_SET); SourceMapping mapping = new SuffixMapping("g4", Collections.<String>emptySet());
// What are the sets of includes (defaulted or otherwise). // What are the sets of includes (defaulted or otherwise).
// //

View File

@ -15,12 +15,6 @@
<name>ANTLR 4 Runtime</name> <name>ANTLR 4 Runtime</name>
<dependencies> <dependencies>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>ST4</artifactId>
<version>4.0.4</version>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>org.abego.treelayout</groupId> <groupId>org.abego.treelayout</groupId>
<artifactId>org.abego.treelayout.core</artifactId> <artifactId>org.abego.treelayout.core</artifactId>
@ -37,7 +31,7 @@
<plugins> <plugins>
<plugin> <plugin>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version> <version>2.5.1</version>
<configuration> <configuration>
<source>1.6</source> <source>1.6</source>
<target>1.6</target> <target>1.6</target>
@ -49,6 +43,34 @@
<compilerArgument>-Xlint:-serial</compilerArgument> <compilerArgument>-Xlint:-serial</compilerArgument>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>

View File

@ -31,6 +31,7 @@ package org.antlr.v4.runtime.misc;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.List;
/** /**
* *
@ -191,14 +192,14 @@ public class IntegerList {
/** /**
* Compares the specified object with this list for equality. Returns * Compares the specified object with this list for equality. Returns
* {@code true} if and only if the specified object is also an {@code IntegerList}, * {@code true} if and only if the specified object is also an {@link IntegerList},
* both lists have the same size, and all corresponding pairs of elements in * both lists have the same size, and all corresponding pairs of elements in
* the two lists are equal. In other words, two lists are defined to be * the two lists are equal. In other words, two lists are defined to be
* equal if they contain the same elements in the same order. * equal if they contain the same elements in the same order.
* <p> * <p>
* This implementation first checks if the specified object is this * This implementation first checks if the specified object is this
* list. If so, it returns {@code true}; if not, it checks if the * list. If so, it returns {@code true}; if not, it checks if the
* specified object is an {@code IntegerList}. If not, it returns {@code false}; * specified object is an {@link IntegerList}. If not, it returns {@code false};
* if so, it checks the size of both lists. If the lists are not the same size, * if so, it checks the size of both lists. If the lists are not the same size,
* it returns {@code false}; otherwise it iterates over both lists, comparing * it returns {@code false}; otherwise it iterates over both lists, comparing
* corresponding pairs of elements. If any comparison returns {@code false}, * corresponding pairs of elements. If any comparison returns {@code false},
@ -233,8 +234,8 @@ public class IntegerList {
/** /**
* Returns the hash code value for this list. * Returns the hash code value for this list.
* * <p/>
* <p>This implementation uses exactly the code that is used to define the * This implementation uses exactly the code that is used to define the
* list hash function in the documentation for the {@link List#hashCode} * list hash function in the documentation for the {@link List#hashCode}
* method. * method.
* *

View File

@ -110,7 +110,7 @@ public class ParseTreeVisitor<T> {
* *
* @param aggregate The previous aggregate value. In the default * @param aggregate The previous aggregate value. In the default
* implementation, the aggregate value is initialized to * implementation, the aggregate value is initialized to
* {@link #defaultValue}, which is passed as the {@code aggregate} argument * {@link #defaultResult}, which is passed as the {@code aggregate} argument
* to this method after the first child node is visited. * to this method after the first child node is visited.
* @param nextResult The result of the immediately preceeding call to visit * @param nextResult The result of the immediately preceeding call to visit
* a child node. * a child node.
@ -126,7 +126,7 @@ public class ParseTreeVisitor<T> {
* {@link #visitChildren}. This method is first called before the first * {@link #visitChildren}. This method is first called before the first
* child is visited; at that point {@code currentResult} will be the initial * child is visited; at that point {@code currentResult} will be the initial
* value (in the default implementation, the initial value is returned by a * value (in the default implementation, the initial value is returned by a
* call to {@link #defaultValue}. * call to {@link #defaultResult}.
* <p/> * <p/>
* The default implementation always returns {@code true}, indicating that * The default implementation always returns {@code true}, indicating that
* {@code visitChildren} should only return after all children are visited. * {@code visitChildren} should only return after all children are visited.

View File

@ -17,7 +17,7 @@
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>4.10</version> <version>4.11</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -73,16 +73,44 @@
<plugin> <plugin>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version> <version>2.5.1</version>
<configuration> <configuration>
<source>1.6</source> <source>1.6</source>
<target>1.6</target> <target>1.6</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version> <version>2.12.4</version>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

View File

@ -724,7 +724,6 @@ public class Tool {
* given relative to the input directory. * given relative to the input directory.
* *
* @param fileNameWithPath path to input source * @param fileNameWithPath path to input source
* @return
*/ */
public File getOutputDirectory(String fileNameWithPath) { public File getOutputDirectory(String fileNameWithPath) {
File outputDir; File outputDir;