Skip to content

Commit

Permalink
cleanup pom and plugins
Browse files Browse the repository at this point in the history
Signed-off-by: Terence Parr <[email protected]>
  • Loading branch information
parrt committed Apr 9, 2022
1 parent fc59296 commit 62ec6b3
Show file tree
Hide file tree
Showing 6 changed files with 180 additions and 154 deletions.
3 changes: 0 additions & 3 deletions antlr3-maven-archetype/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,11 @@
</extensions>

<plugins>
<!--
<plugin>
<artifactId>maven-archetype-plugin</artifactId>
<version>2.2</version>
<extensions>true</extensions>
</plugin>
-->

</plugins>

</build>
Expand Down
113 changes: 69 additions & 44 deletions antlr3-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,53 +34,27 @@


<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">

<!-- Maven model we are inheriting from
-->
<modelVersion>4.0.0</modelVersion>

<!--
Now that the ANTLR project has adopted Maven with a vengence,
all ANTLR tools will be grouped under org.antlr and will be
controlled by a project member.
-->
<groupId>org.antlr</groupId>


<!--
This is the ANTLR plugin for ANTLR version 3.1.3 and above. It might
have been best to change the name of the plugin as the 3.1.2 plugins
behave a little differently, however for the sake of one transitional
phase to a much better plugin, it was decided that the name should
remain the same.
-->
<artifactId>antlr3-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>

<parent>
<groupId>org.antlr</groupId>
<artifactId>antlr-master</artifactId>
<version>3.5.3-SNAPSHOT</version>
</parent>

<artifactId>antlr3-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
<name>ANTLR 3 Maven plugin</name>
<prerequisites>
<maven>2.0</maven>
</prerequisites>

<properties>
<mavenVersion>3.8.4</mavenVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<!--
Where does our actual project live on the interwebs.
-->
<url>http://antlr.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<description>

This is the brand new, re-written from scratch plugin for ANTLR v3.

Previous valiant efforts all suffered from being unable to modify the ANTLR Tool
Expand All @@ -106,11 +80,9 @@ to death. Hence even this pom has more comments than funcitonal elements,
in case I get run over by a bus or fall off a cliff while skiing.

Jim Idle - March 2009

</description>

<developers>

<developer>
<name>Jim Idle</name>
<url>http://www.temporal-wave.com</url>
Expand Down Expand Up @@ -159,25 +131,78 @@ Jim Idle - March 2009
<!--
The things we need to build the target language recognizer
-->
<!-- The things we need to build the target language recognizer -->
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
<scope>compile</scope>
<version>3.8.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-api</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>org.sonatype.plexus</groupId>
<artifactId>plexus-build-api</artifactId>
<version>0.0.7</version>
</dependency>
<!-- The version of ANTLR tool that this version of the plugin controls.
We have decided that this should be in lockstep with ANTLR itself, other
than -1 -2 -3 etc patch releases. -->
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr</artifactId>
<version>3.5.3-SNAPSHOT</version>
</dependency>
<!-- Testing requirements... -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.6.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.takari.maven.plugins</groupId>
<artifactId>takari-plugin-testing</artifactId>
<version>3.0.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>2.0</version>
<artifactId>maven-core</artifactId>
<version>3.8.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-compat</artifactId>
<version>3.8.4</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-api</artifactId>
<version>2.0</version>
<artifactId>plexus-utils</artifactId>
<version>3.4.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.32</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.32</version>
</dependency>

<!--
The version of ANTLR tool that this version of the plugin controls.
We have decided that this should be in lockstep with ANTLR itself, other
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,25 @@ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
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 org.apache.maven.plugins.annotations.Component;
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;

/**
* Parses ANTLR grammar files {@code *.g} and transforms them into Java source
* files.
*
* @goal antlr
* @phase generate-sources
* @requiresDependencyResolution compile
* @requiresProject true
*
* @author <a href="mailto:[email protected]">Jim Idle</a>
*/
public class Antlr3Mojo
extends AbstractMojo {
@Mojo(
name = "antlr",
defaultPhase = LifecyclePhase.GENERATE_SOURCES,
requiresDependencyResolution = ResolutionScope.COMPILE,
requiresProject = true, threadSafe = true)
public class Antlr3Mojo extends AbstractMojo {

// First, let's deal with the options that the ANTLR tool itself
// can be configured by.
Expand All @@ -73,88 +78,77 @@ public class Antlr3Mojo
* If set to true, then after the tool has processed an input grammar file
* it will report various statistics about the parser, such as information
* on cyclic DFAs, which rules may use backtracking, and so on.
*
* @parameter default-value="false"
*/
@Parameter(property = "report", defaultValue = "false")
protected boolean report;
/**
* If set to true, then the ANTLR tool will print a version of the input
* grammar(s) which are stripped of any embedded actions.
*
* @parameter default-value="false"
*/
@Parameter(property = "printGrammar", defaultValue = "false")
protected boolean printGrammar;
/**
* 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
* wait for a debug connection on a TCP port (49100 by default).
*
* @parameter default-value="false"
*/
@Parameter(property = "debug", defaultValue = "false")
protected boolean debug;
/**
* If set to true, then the generated parser will compute and report profile
* information at runtime.
*
* @parameter default-value="false"
*/
@Parameter(property = "profile", defaultValue = "false")
protected boolean profile;
/**
* If set to true, then the ANTLR tool will generate a description of the
* NFA for each rule in <a href="http://www.graphviz.org">Dot format</a>
*
* @parameter default-value="false"
*/
@Parameter(property = "nfa", defaultValue = "false")
protected boolean nfa;
/**
* If set to true, then the ANTLR tool will generate a description of the
* DFA for each decision in the grammar in
* <a href="http://www.graphviz.org">Dot format</a>.
*
* @parameter default-value="false"
*/
@Parameter(property = "dfa", defaultValue = "false")
protected boolean dfa;
/**
* If set to true, the generated parser code will log rule entry and exit
* points to stdout ({@link System#out} for the Java target) as an aid to
* debugging.
*
* @parameter default-value="false"
*/
@Parameter(property = "trace", defaultValue = "false")
protected boolean trace;
/**
* If this parameter is set, it indicates that any warning or error messages
* returned by ANLTR, should be formatted in the specified way. Currently,
* ANTLR supports the built-in formats {@code antlr}, {@code gnu} and
* {@code vs2005}.
*
* @parameter default-value="antlr"
*/
@Parameter(property = "messageFormat", defaultValue = "antlr")
protected String messageFormat;
/**
* If set to true, then ANTLR will report verbose messages during the code
* generation process. This includes the names of files, the version of
* ANTLR, and more.
*
* @parameter default-value="true"
*/
@Parameter(property = "verbose", defaultValue = "true")
protected boolean verbose;

/**
* The maximum number of alternatives allowed in an inline switch statement.
* Beyond this, ANTLR will not generate a switch statement for the DFA.
*
* @parameter default-value="300"
*/
@Parameter(property = "maxSwitchCaseLabels", defaultValue = "300")
private int maxSwitchCaseLabels;

/**
* The minimum number of alternatives for ANTLR to generate a switch
* statement. For decisions with fewer alternatives, an if/else if/else
* statement will be used instead.
*
* @parameter default-value="3"
*/
@Parameter(property = "minSwitchAlts", defaultValue = "3")
private int minSwitchAlts;

/* --------------------------------------------------------------------
Expand All @@ -171,49 +165,40 @@ public class Antlr3Mojo
* A set of Ant-like inclusion patterns used to select files from the source
* directory for processing. By default, the pattern <code>**&#47;*.g</code>
* is used to select grammar files.</p>
*
* @parameter
*/
@Parameter
protected Set<String> includes = new HashSet<String>();
/**
* A set of Ant-like exclusion patterns used to prevent certain files from
* being processed. By default, this set is empty such that no files are
* excluded.
*
* @parameter
*/
@Parameter
protected Set<String> excludes = new HashSet<String>();
/**
* The current Maven project.
*
* @parameter expression="${project}"
* @required
* @readonly
*/
@Parameter(property = "project", required = true, readonly = true)
protected MavenProject project;
/**
* The directory where the ANTLR grammar files ({@code *.g}) are located.
*
* @parameter default-value="${basedir}/src/main/antlr3"
*/
@Parameter(defaultValue = "${basedir}/src/main/antlr3")
private File sourceDirectory;
/**
* The directory where the parser files generated by ANTLR will be stored.
* The directory will be registered as a compile source root of the project
* such that the generated files will participate in later build phases like
* compiling and packaging.
*
* @parameter default-value="${project.build.directory}/generated-sources/antlr3"
* @required
*/
@Parameter(defaultValue = "${project.build.directory}/generated-sources/antlr3", required = true)
private File outputDirectory;
/**
* Location for imported token files, e.g. {@code *.tokens} and imported
* grammars. Note that ANTLR will not try to process grammars that it finds
* to be imported into other grammars (in the same processing session).
*
* @parameter default-value="${basedir}/src/main/antlr3/imports"
*/
@Parameter(defaultValue = "${basedir}/src/main/antlr3/imports")
private File libDirectory;

public File getSourceDirectory() {
Expand Down
Loading

0 comments on commit 62ec6b3

Please sign in to comment.