Author: vsiveton
Date: Tue May 29 14:42:33 2007
New Revision: 542663

URL: http://svn.apache.org/viewvc?view=rev&rev=542663
Log:
MANTLR-17: Support for Antlr 3
Submitted by: David Holroyd 
Reviewed by: Vincent Siveton

o first import from 
http://svn.badgers-in-foil.co.uk/maven-antlr3-plugin/maven-antlr3-plugin/trunk/ 
(rev 37)

Added:
    maven/sandbox/trunk/plugins/maven-antlr3-plugin/
    maven/sandbox/trunk/plugins/maven-antlr3-plugin/LICENSE.txt   (with props)
    maven/sandbox/trunk/plugins/maven-antlr3-plugin/pom.xml   (with props)
    maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/
    maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/main/
    maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/main/java/
    maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/main/java/org/
    maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/main/java/org/apache/
    
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/main/java/org/apache/maven/
    
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/main/java/org/apache/maven/plugin/
    
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/main/java/org/apache/maven/plugin/antlr3/
    
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/main/java/org/apache/maven/plugin/antlr3/Antlr3PluginMojo.java
   (with props)
    
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/main/java/org/apache/maven/plugin/antlr3/AntlrHelper.java
   (with props)
    maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/
    maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/apt/
    maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/apt/index.apt   
(with props)
    maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/apt/install.apt   
(with props)
    maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/apt/usage.apt   
(with props)
    maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/site.xml   (with 
props)
    maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/
    maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/java/
    maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/java/org/
    maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/java/org/apache/
    
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/java/org/apache/maven/
    
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/java/org/apache/maven/plugin/
    
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/java/org/apache/maven/plugin/antlr3/
    
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/java/org/apache/maven/plugin/antlr3/Antlr3PluginMojoTest.java
   (with props)
    
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/java/org/apache/maven/plugin/antlr3/AntlrHelperTest.java
   (with props)
    maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/resources/
    maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/resources/unit/
    
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/resources/unit/simple-grammar-test/
    
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/resources/unit/simple-grammar-test/simple-grammar-test-plugin-config.xml
   (with props)
    
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/resources/unit/simple-grammar-test/src/
    
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/resources/unit/simple-grammar-test/src/main/
    
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/resources/unit/simple-grammar-test/src/main/antlr/
    
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/resources/unit/simple-grammar-test/src/main/antlr/Simple.g
   (with props)

Added: maven/sandbox/trunk/plugins/maven-antlr3-plugin/LICENSE.txt
URL: 
http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-antlr3-plugin/LICENSE.txt?view=auto&rev=542663
==============================================================================
--- maven/sandbox/trunk/plugins/maven-antlr3-plugin/LICENSE.txt (added)
+++ maven/sandbox/trunk/plugins/maven-antlr3-plugin/LICENSE.txt Tue May 29 
14:42:33 2007
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.

Propchange: maven/sandbox/trunk/plugins/maven-antlr3-plugin/LICENSE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/trunk/plugins/maven-antlr3-plugin/LICENSE.txt
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/trunk/plugins/maven-antlr3-plugin/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-antlr3-plugin/pom.xml?view=auto&rev=542663
==============================================================================
--- maven/sandbox/trunk/plugins/maven-antlr3-plugin/pom.xml (added)
+++ maven/sandbox/trunk/plugins/maven-antlr3-plugin/pom.xml Tue May 29 14:42:33 
2007
@@ -0,0 +1,110 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.maven.plugins</groupId>
+    <artifactId>maven-plugins</artifactId>
+    <version>8</version>
+  </parent>
+
+  <groupId>org.apache.maven.plugin.antlrv3</groupId>
+  <artifactId>maven-antlr3-plugin</artifactId>
+  <packaging>maven-plugin</packaging>
+  <version>0.4-SNAPSHOT</version>
+  <name>Maven ANTLR-v3 Plugin</name>
+  <description>Generate code from ANTLR version 3 grammar 
descriptions</description>
+  <developers>
+    <developer>
+      <id>dave</id>
+      <name>David Holroyd</name>
+      <url>http://david.holroyd.me.uk/</url>
+    </developer>
+  </developers>
+  <inceptionYear>2007</inceptionYear>
+  <organization>
+    <name>David Holroyd</name>
+    <url>http://david.holroyd.me.uk/</url>
+  </organization>
+  <licenses>
+    <license>
+      <name>The Apache License, Version 2.0</name>
+      <url>LICENSE.txt</url>
+    </license>
+  </licenses>
+
+  <scm>
+    
<connection>scm:svn:http://svn.badgers-in-foil.co.uk/maven-antlr3-plugin/maven-antlr3-plugin/trunk</connection>
+    
<developerConnection>scm:svn:http://svn.badgers-in-foil.co.uk/maven-antlr3-plugin/maven-antlr3-plugin/trunk</developerConnection>
+  </scm>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-project</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-compiler-manager</artifactId>
+      <version>1.5.3</version>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.antlr</groupId>
+      <artifactId>antlr</artifactId>
+      <version>3.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.shared</groupId>
+      <artifactId>maven-plugin-testing-harness</artifactId>
+      <version>1.0</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <distributionManagement>
+    <repository>
+      <id>bif-repository</id>
+      <url>scp://maven.badgers-in-foil.co.uk/home/maven/www/maven2</url>
+    </repository>
+    <site>
+      <id>maven-antlr3-plugin-site</id>
+      
<url>scp://maven.badgers-in-foil.co.uk/home/maven/www/sites/maven-antlr3-plugin</url>
+    </site>
+  </distributionManagement>
+
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-plugin-plugin</artifactId>
+      </plugin>
+
+      <plugin>
+        <!-- override the default report set; just reports with useful info -->
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-project-info-reports-plugin</artifactId>
+        <reportSets>
+          <reportSet>
+            <reports>
+              <report>dependencies</report>
+              <report>project-team</report>
+              <report>license</report>
+              <report>scm</report>
+            </reports>
+          </reportSet>
+        </reportSets>
+      </plugin>
+    </plugins>
+  </reporting>
+</project>

Propchange: maven/sandbox/trunk/plugins/maven-antlr3-plugin/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/trunk/plugins/maven-antlr3-plugin/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/main/java/org/apache/maven/plugin/antlr3/Antlr3PluginMojo.java
URL: 
http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/main/java/org/apache/maven/plugin/antlr3/Antlr3PluginMojo.java?view=auto&rev=542663
==============================================================================
--- 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/main/java/org/apache/maven/plugin/antlr3/Antlr3PluginMojo.java
 (added)
+++ 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/main/java/org/apache/maven/plugin/antlr3/Antlr3PluginMojo.java
 Tue May 29 14:42:33 2007
@@ -0,0 +1,269 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.maven.plugin.antlr3;
+
+import org.antlr.Tool;
+import org.antlr.analysis.DFA;
+import org.antlr.codegen.CodeGenerator;
+import org.antlr.tool.BuildDependencyGenerator;
+import org.antlr.tool.Grammar;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.compiler.util.scan.InclusionScanException;
+import org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner;
+import org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner;
+import org.codehaus.plexus.compiler.util.scan.mapping.SourceMapping;
+import org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping;
+import antlr.RecognitionException;
+import antlr.TokenStreamException;
+import java.io.File;
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.Writer;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Generate source code from ANTLRv3 grammar specifications.
+ *
+ * @goal antlr
+ * @phase generate-sources
+ */
+public class Antlr3PluginMojo extends AbstractMojo
+{
+    /**
+     * Specifies the Antlr directory containing grammar files.
+     * 
+     * @parameter expression="${basedir}/src/main/antlr"
+     * @required
+     */
+    protected File sourceDirectory;
+
+    /**
+     * A set of patterns matching files from the sourceDirectory that
+     * should be processed as grammers.
+     * 
+     * @parameter
+     */
+    Set includes = new HashSet();
+
+    /**
+     * Set of exclude patterns
+     * 
+     * @parameter
+     */
+    Set excludes = new HashSet();
+
+    /**
+     * Enables ANTLR-specific network debugging. Requires a tool able to
+     * talk this protocol e.g. ANTLRWorks
+     * 
+     * @parameter
+     */
+    protected boolean debug = false;
+
+    /**
+     * Generate a parser that logs rule entry/exit messages.
+     * 
+     * @parameter
+     */
+    protected boolean trace = false;
+
+    /**
+     * Generate a parser that computes profiling information.
+     * 
+     * @parameter
+     */
+    protected boolean profile = false;
+
+    private Tool tool;
+
+    /**
+     * Location for generated Java files.
+     * 
+     * @parameter 
expression="${project.build.directory}/generated-sources/antlr"
+     * @required
+     */
+    private File outputDirectory;
+
+    /**
+     * The number of milliseconds ANTLR will wait for analysis of each
+     * alternative in the grammar to complete before giving up.
+     * 
+     * @parameter
+     */
+    private int conversionTimeout;
+
+    /**
+     * @parameter expression="${project}"
+     * @required
+     */
+    private MavenProject project;
+
+    public void execute() throws MojoExecutionException
+    {
+        File f = outputDirectory;
+
+        if ( !f.exists() )
+        {
+            f.mkdirs();
+        }
+
+        tool = new Tool();
+        DFA.MAX_TIME_PER_DFA_CREATION = conversionTimeout;
+
+        try
+        {
+            processGrammarFiles();
+        }
+        catch ( Exception e )
+        {
+            throw new MojoExecutionException( "", e );
+        }
+        if ( project != null )
+        {
+            project.addCompileSourceRoot( outputDirectory.getPath() );
+        }
+    }
+
+    private void processGrammarFiles()
+        throws TokenStreamException, RecognitionException, IOException, 
InclusionScanException
+    {
+        SourceMapping mapping = new SuffixMapping( "g", Collections.EMPTY_SET 
);
+        Set includes = getIncludesPatterns();
+        SourceInclusionScanner scan = new SimpleSourceInclusionScanner( 
includes, excludes );
+        scan.addSourceMapping( mapping );
+        Set grammarFiles = scan.getIncludedSources( sourceDirectory, null );
+        if ( grammarFiles.isEmpty() )
+        {
+            if ( getLog().isInfoEnabled() )
+            {
+                getLog().info( "No grammars to process" );
+            }
+        }
+        else
+        {
+            boolean built = false;
+            for ( Iterator i = grammarFiles.iterator(); i.hasNext(); )
+            {
+                built |= processGrammarFile( ( (File) i.next() ).getPath() );
+            }
+            if ( !built && getLog().isInfoEnabled() )
+            {
+                getLog().info( "No grammars processed; generated files are up 
to date" );
+            }
+        }
+    }
+
+    public Set getIncludesPatterns()
+    {
+        if ( includes == null || includes.isEmpty() )
+        {
+            return Collections.singleton( "**/*.g" );
+        }
+        return includes;
+    }
+
+    private boolean processGrammarFile( String grammarFileName )
+        throws TokenStreamException, RecognitionException, IOException
+    {
+        // Hack the output dir such that the output hierarchy will match the
+        // source hierarchy.  This way, grammar authors can arrange their
+        // grammars in a structure that matches the package (assuming Java
+        // output), and the generated files will not produce warnings/errors
+        // from javac due to the path-prefix not matching the package-prefix.
+        // (ANTLR sort-of does this itself, but only when grammar file names
+        // are specified relative to $PWD)
+        String sourceSubdir = findSourceSubdir( grammarFileName );
+        File outputSubdir = new File( outputDirectory, sourceSubdir );
+        tool.setOutputDirectory( outputSubdir.getPath() );
+
+        BuildDependencyGenerator dep = new BuildDependencyGenerator( tool, 
grammarFileName );
+        List outputFiles = dep.getGeneratedFileList();
+        // TODO: processing order for multiple grammars based on 
interdependencies?
+        List dependents = dep.getDependenciesFileList();
+        if ( AntlrHelper.buildRequired( grammarFileName, outputFiles ) )
+        {
+            generate( grammarFileName );
+            return true;
+        }
+        return false;
+    }
+
+    private String findSourceSubdir( String grammarFileName )
+    {
+        String srcPath = sourceDirectory.getPath();
+        if ( !grammarFileName.startsWith( srcPath ) )
+        {
+            throw new IllegalArgumentException( "expected " + grammarFileName
+                                               + " to be prefixed with "
+                                               + sourceDirectory );
+        }
+        File unprefixedGrammarFileName = new File( grammarFileName.substring( 
srcPath.length() ) );
+        return unprefixedGrammarFileName.getParent();
+    }
+
+    private void generate( String grammarFileName ) throws 
TokenStreamException, RecognitionException, IOException
+    {
+        if ( getLog().isInfoEnabled() )
+        {
+            getLog().info( "Processing grammar " + grammarFileName );
+        }
+        Grammar grammar = tool.getGrammar( grammarFileName );
+        processGrammar( grammar );
+
+        // now handle the lexer if one was created for a merged spec
+        String lexerGrammarStr = grammar.getLexerGrammar();
+        if ( grammar.type == Grammar.COMBINED && lexerGrammarStr != null )
+        {
+            String lexerGrammarFileName = 
grammar.getImplicitlyGeneratedLexerFileName();
+            Writer w = tool.getOutputFile( grammar, lexerGrammarFileName );
+            w.write( lexerGrammarStr );
+            w.close();
+            StringReader sr = new StringReader( lexerGrammarStr );
+            Grammar lexerGrammar = new Grammar();
+            lexerGrammar.setTool( tool );
+            File lexerGrammarFullFile = new File( tool.getFileDirectory( 
lexerGrammarFileName ), lexerGrammarFileName );
+            lexerGrammar.setFileName( lexerGrammarFullFile.toString() );
+            lexerGrammar.importTokenVocabulary( grammar );
+            lexerGrammar.setGrammarContent( sr );
+            sr.close();
+            processGrammar( lexerGrammar );
+        }
+    }
+
+    private void processGrammar( Grammar grammar )
+    {
+        String language = (String) grammar.getOption( "language" );
+        if ( language != null )
+        {
+            CodeGenerator generator = new CodeGenerator( tool, grammar, 
language );
+            grammar.setCodeGenerator( generator );
+            generator.setDebug( debug );
+            generator.setProfile( profile );
+            generator.setTrace( trace );
+            generator.genRecognizer();
+        }
+    }
+}
\ No newline at end of file

Propchange: 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/main/java/org/apache/maven/plugin/antlr3/Antlr3PluginMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/main/java/org/apache/maven/plugin/antlr3/Antlr3PluginMojo.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/main/java/org/apache/maven/plugin/antlr3/AntlrHelper.java
URL: 
http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/main/java/org/apache/maven/plugin/antlr3/AntlrHelper.java?view=auto&rev=542663
==============================================================================
--- 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/main/java/org/apache/maven/plugin/antlr3/AntlrHelper.java
 (added)
+++ 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/main/java/org/apache/maven/plugin/antlr3/AntlrHelper.java
 Tue May 29 14:42:33 2007
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.maven.plugin.antlr3;
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.List;
+
+public class AntlrHelper
+{
+    /**
+     * Checks to see if the list of outputFiles all exist, and have
+     * last-modified timestamps which are later than the last-modified
+     * timestamp of the grammar file. If these conditions hold, the method
+     * returns false, otherwise, it returns true,
+     */
+    public static boolean buildRequired( String grammarFileName, List 
outputFiles )
+    {
+        File grammarFile = new File( grammarFileName );
+        long grammarLastModified = grammarFile.lastModified();
+        for ( Iterator i = outputFiles.iterator(); i.hasNext(); )
+        {
+            File outputFile = (File) i.next();
+            if ( !outputFile.exists() || grammarLastModified > 
outputFile.lastModified() )
+            {
+                return true;
+            }
+        }
+        return false;
+    }
+}

Propchange: 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/main/java/org/apache/maven/plugin/antlr3/AntlrHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/main/java/org/apache/maven/plugin/antlr3/AntlrHelper.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/apt/index.apt
URL: 
http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/apt/index.apt?view=auto&rev=542663
==============================================================================
--- maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/apt/index.apt 
(added)
+++ maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/apt/index.apt Tue 
May 29 14:42:33 2007
@@ -0,0 +1,7 @@
+Introduction
+
+ The maven-antlr3-plugin will use the {{{http://www.antlr.org}ANTLR tool}}
+ to process grammars included in your project and generate code (typically
+ Java source code) during the generate-sources phase of the build.
+
+ The plugin doesn't expose all ANTLR features yet.

Propchange: 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/apt/index.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/apt/index.apt
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/apt/install.apt
URL: 
http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/apt/install.apt?view=auto&rev=542663
==============================================================================
--- maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/apt/install.apt 
(added)
+++ maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/apt/install.apt 
Tue May 29 14:42:33 2007
@@ -0,0 +1,115 @@
+Installation
+
+ The plugin has not been pushed to the official Maven repositories yet, so
+ you will need to add the maven-antlr3-plugin repository to your plugin
+ repositories list.  Add the following to your project's POM,
+
++-----+
+<project>
+  ...
+  <pluginRepositories>
+    <pluginRepository>
+      <id>bif-repository</id>
+      <url>http://maven.badgers-in-foil.co.uk/maven2/</url>
+    </pluginRepository>
+  </pluginRepositories>
+  ...
+</project>
++-----+
+
+
+Getting ANTLR v3
+
+ Until the appearence of ANTLR v3 in the Maven repositories you will need to
+ grab a snapshot and install into your local repository.  (NB although
+ there is an existing <<<org.antlr:antlr:3.0>>> artifact, this is actually
+ a beta version of ANTLR from several months before the final release -- do
+ not use it!)
+
+ Download the ANTLR 3 release from {{http://www.antlr.org/download.html}}
+
+ On unpacking the .tar.gz file, you should find <<<antlr-3.0.jar>>> and
+ <<<antlr-runtime-3.0.jar>>> files in the resulting <<<lib>>> subfolder.
+ These should be installed into your repository with the Maven
+ <<<install-file>>> command, using the POM metadata provided below.
+
+ For the tool jar,
+
++-----+
+mvn install:install-file -DgroupId=org.antlr -DartifactId=antlr-tool 
-Dversion=3.0 -Dpackaging=jar -DpomFile=tool.pom -Dfile=lib/antlr-3.0.jar 
++-----+
+
+ For the Java runtime jar,
+
++-----+
+mvn install:install-file -DgroupId=org.antlr -DartifactId=antlr-java-runtime 
-Dversion=3.0 -Dpackaging=jar -DpomFile=runtime.pom 
-Dfile=lib/antlr-runtime-3.0.jar 
++-----+
+
+POM metadata for ANTLR
+
+ When installing ANTLR, please use the following Project Object Models,
+
+ tool.pom:
+
++-----+
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.antlr</groupId>
+  <artifactId>antlr-tool</artifactId>
+  <packaging>jar</packaging>
+  <version>3.0</version>
+  <name>ANTLR Parser Generator Tool</name>
+  <url>http://www.antlr.org/</url>
+  <licenses>
+    <license>
+      <name>BSD License</name>
+      <url>http://www.antlr.org/license.html</url>
+      <distribution>repo</distribution>
+    </license>
+  </licenses>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.antlr</groupId>
+      <artifactId>stringtemplate</artifactId>
+      <version>3.0</version>
+    </dependency>
+    <dependency>
+      <groupId>antlr</groupId>
+      <artifactId>antlr</artifactId>
+      <version>2.7.7</version>
+    </dependency>
+  </dependencies>
+</project>
++-----+
+
+ runtime.pom
+
++-----+
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.antlr</groupId>
+  <artifactId>antlr-java-runtime</artifactId>
+  <packaging>jar</packaging>
+  <version>3.0</version>
+  <name>ANTLR Parser Generator Java Runtime Library</name>
+  <url>http://www.antlr.org/</url>
+  <licenses>
+    <license>
+      <name>BSD License</name>
+      <url>http://www.antlr.org/license.html</url>
+      <distribution>repo</distribution>
+    </license>
+  </licenses>
+</project>
++-----+
+
+
+
+ See {{{usage.html}usage instructions}}.

Propchange: 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/apt/install.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/apt/install.apt
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/apt/usage.apt
URL: 
http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/apt/usage.apt?view=auto&rev=542663
==============================================================================
--- maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/apt/usage.apt 
(added)
+++ maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/apt/usage.apt Tue 
May 29 14:42:33 2007
@@ -0,0 +1,76 @@
+Usage
+
+ To enable the plugin, add the following to you project's pom.xml,
+
++-----+
+<project>
+  ...
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>uk.co.badgersinfoil.maven.plugins</groupId>
+        <artifactId>maven-antlr3-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>antlr</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  ...
+</project>
++-----+
+
+ You should place your ANTLRv3 grammar files in <<<src/main/antlr>>>, and
+ the plugin with scan the subfolders of this folder looking for grammar files
+ (names ending with '.g').
+
+ The generated files will automatically be included in the list of elements
+ to be built in the project's compile phase.
+
+* Alternative Filename Extensions
+
+ To use an extension other than .g for grammar files, use the <<<includes>>>
+ configuration element (remember to have an entry in this list for .g files
+ if you still want them to work as well),
+
++-----+
+      ...
+      <plugin>
+        <groupId>uk.co.badgersinfoil.maven.plugins</groupId>
+        <artifactId>maven-antlr3-plugin</artifactId>
+        ...
+        <configuration>
+          <includes>
+            <include>**/*.g</include>
+            <include>**/*.g3</include>
+          </includes>
+        </configuration>
+      </plugin>
+      ...
++-----+
+
+Compiling generated code
+
+ The generated code should just get compiled by running <<<mvn compile>>> etc.
+ but you will need to include the ANTLR runtime classes as a dependancy of
+ your project.  Add the following dependancy to your POM,
+
++-----+
+  ...
+  <dependency>
+    <groupId>org.antlr</groupId>
+    <artifactId>antlr-java-runtime</artifactId>
+    <packaging>jar</packaging>
+    <version>05-14-2007.17</version>
+  </dependency>
+  ...
++-----+
+
+ Ensure you add a dependancy on the Java runtime rather than on the ANTLR tool
+ artifact, or you will end up adding the transative dependancies on
+ StringTemplate and the old ANTLRv2 to your project, when all you need are the
+ runtime support classes.

Propchange: 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/apt/usage.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/apt/usage.apt
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/site.xml
URL: 
http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/site.xml?view=auto&rev=542663
==============================================================================
--- maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/site.xml (added)
+++ maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/site.xml Tue May 
29 14:42:33 2007
@@ -0,0 +1,16 @@
+<project>
+  <body>
+    <links>
+      <item name="ANTLR" href="http://www.antlr.org/"/>
+    </links>
+
+    <menu name="Overview">
+      <item name="Introduction" href="index.html"/>
+      <item name="Installation" href="install.html"/>
+      <item name="Usage" href="usage.html"/>
+      <item name="Goals" href="plugin-info.html"/>
+    </menu>
+
+    <menu ref="reports"/>
+  </body>
+</project>

Propchange: maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/site.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/site/site.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/java/org/apache/maven/plugin/antlr3/Antlr3PluginMojoTest.java
URL: 
http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/java/org/apache/maven/plugin/antlr3/Antlr3PluginMojoTest.java?view=auto&rev=542663
==============================================================================
--- 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/java/org/apache/maven/plugin/antlr3/Antlr3PluginMojoTest.java
 (added)
+++ 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/java/org/apache/maven/plugin/antlr3/Antlr3PluginMojoTest.java
 Tue May 29 14:42:33 2007
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.maven.plugin.antlr3;
+
+import java.io.File;
+import java.util.Collections;
+import org.apache.maven.plugin.antlr3.Antlr3PluginMojo;
+import org.apache.maven.plugin.testing.AbstractMojoTestCase;
+
+public class Antlr3PluginMojoTest extends AbstractMojoTestCase
+{
+    protected void tearDown() throws Exception
+    {
+        // if we don't override this, the superclass implementation is used,
+        // and fails
+    }
+
+    public void testGetIncludesPatterns()
+    {
+        Antlr3PluginMojo mojo = new Antlr3PluginMojo();
+        assertEquals( Collections.singleton( "**/*.g" ), 
mojo.getIncludesPatterns() );
+        mojo.includes.add( "*.g3" );
+        assertEquals( Collections.singleton( "*.g3" ), 
mojo.getIncludesPatterns() );
+    }
+
+    public void testSimple() throws Exception
+    {
+        File testPom = new File( getBasedir(), 
"src/test/resources/unit/simple-grammar-test/simple-grammar-test-plugin-config.xml"
 );
+        Antlr3PluginMojo mojo = (Antlr3PluginMojo) lookupMojo( "antlr", 
testPom );
+        mojo.execute();
+
+        File out = new File( getBasedir(), 
"target/test/unit/simple-grammar-test/target/generated-sources/antlr");
+        assertExists( new File( out, "SimpleParser.java" ) );
+        assertExists( new File( out, "SimpleLexer.java" ) );
+        assertExists( new File( out, "Simple.tokens" ) );
+    }
+
+    private static final void assertExists(File f) {
+        assertTrue("File should exist "+f, f.exists());
+    }
+}
\ No newline at end of file

Propchange: 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/java/org/apache/maven/plugin/antlr3/Antlr3PluginMojoTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/java/org/apache/maven/plugin/antlr3/Antlr3PluginMojoTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/java/org/apache/maven/plugin/antlr3/AntlrHelperTest.java
URL: 
http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/java/org/apache/maven/plugin/antlr3/AntlrHelperTest.java?view=auto&rev=542663
==============================================================================
--- 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/java/org/apache/maven/plugin/antlr3/AntlrHelperTest.java
 (added)
+++ 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/java/org/apache/maven/plugin/antlr3/AntlrHelperTest.java
 Tue May 29 14:42:33 2007
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.maven.plugin.antlr3;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.plugin.antlr3.AntlrHelper;
+
+import junit.framework.TestCase;
+
+public class AntlrHelperTest extends TestCase
+{
+    private File tmpDir;
+
+    public void setUp() throws IOException
+    {
+        tmpDir = new File( System.getProperty( "java.io.tmpdir" ), 
"maven-antlr3-plugin-test" );
+        tmpDir.mkdir();
+    }
+
+    public void tearDown()
+    {
+        // delete files (assumes no subdirs created),
+        File[] files = tmpDir.listFiles();
+        for ( int i = 0; i < files.length; i++ )
+        {
+            files[i].delete();
+        }
+        // delete the folder itself,
+        tmpDir.delete();
+    }
+
+    public void testBuildRequired() throws IOException, InterruptedException
+    {
+        File fileA = new File( tmpDir, "a" );
+        File fileB = new File( tmpDir, "b" );
+        assertTrue( fileA.createNewFile() );
+        assertTrue( fileA.setLastModified( fileA.lastModified() - 10000 ) );
+        assertTrue( fileB.createNewFile() );
+        List targets = new ArrayList();
+
+        targets.add( fileB );
+        assertFalse( AntlrHelper.buildRequired( fileA.getPath(), targets ) );
+        
+        targets.clear();
+        targets.add( fileA );
+        assertTrue( AntlrHelper.buildRequired( fileB.getPath(), targets ) );
+    }
+}
\ No newline at end of file

Propchange: 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/java/org/apache/maven/plugin/antlr3/AntlrHelperTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/java/org/apache/maven/plugin/antlr3/AntlrHelperTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/resources/unit/simple-grammar-test/simple-grammar-test-plugin-config.xml
URL: 
http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/resources/unit/simple-grammar-test/simple-grammar-test-plugin-config.xml?view=auto&rev=542663
==============================================================================
--- 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/resources/unit/simple-grammar-test/simple-grammar-test-plugin-config.xml
 (added)
+++ 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/resources/unit/simple-grammar-test/simple-grammar-test-plugin-config.xml
 Tue May 29 14:42:33 2007
@@ -0,0 +1,26 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>java-grammar.test</groupId>
+  <artifactId>java-grammar-test</artifactId>
+  <packaging>jar</packaging>
+  <version>1.0-SNAPSHOT</version>
+  <inceptionYear>2006</inceptionYear>
+  <name>Maven Antlr3 Plugin Simple-grammar Test</name>
+  <url>http://maven.apache.org</url>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antlr3-plugin</artifactId>
+        <configuration>
+          <!--project 
implementation="org.apache.maven.plugin.antlr3.stubs.SimpleGrammarTestMavenProjectStub"/-->
+          
<outputDirectory>${basedir}/target/test/unit/simple-grammar-test/target/generated-sources/antlr</outputDirectory>
+          
<sourceDirectory>${basedir}/src/test/resources/unit/simple-grammar-test/src/main/antlr</sourceDirectory>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
+

Propchange: 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/resources/unit/simple-grammar-test/simple-grammar-test-plugin-config.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/resources/unit/simple-grammar-test/simple-grammar-test-plugin-config.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/resources/unit/simple-grammar-test/src/main/antlr/Simple.g
URL: 
http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/resources/unit/simple-grammar-test/src/main/antlr/Simple.g?view=auto&rev=542663
==============================================================================
--- 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/resources/unit/simple-grammar-test/src/main/antlr/Simple.g
 (added)
+++ 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/resources/unit/simple-grammar-test/src/main/antlr/Simple.g
 Tue May 29 14:42:33 2007
@@ -0,0 +1,5 @@
+grammar Simple;
+
+t: T;
+
+T: 'T';

Propchange: 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/resources/unit/simple-grammar-test/src/main/antlr/Simple.g
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/sandbox/trunk/plugins/maven-antlr3-plugin/src/test/resources/unit/simple-grammar-test/src/main/antlr/Simple.g
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"


Reply via email to