8000 Marked plugin as thread safe by dheid · Pull Request #213 · jflex-de/jflex · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Marked plugin as thread safe #213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
8000 Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 20 additions & 11 deletions jflex-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<url>https://github.com/jflex-de/jflex/issues</url>
</issueManagement>
<prerequisites>
<maven>3.0.1</maven>
<maven>${maven.version}</maven>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a very recent version of Maven to compile JFlex due to a bug in maven-shade-plugin.

Are you sure we actually need the same to execute the plugin? It sounds to me that 3.0 should be enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maven version 3 should really be enough. The annotation were introduced back then.

</prerequisites>
<inceptionYear>2007</inceptionYear>
<developers>
Expand Down Expand Up @@ -90,6 +90,7 @@
</licenses>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.version>3.0.5</maven.version>
</properties>
<build>
<plugins>
Expand All @@ -102,10 +103,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${jflex.jdk.version}</source>
<target>${jflex.jdk.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -226,12 +223,12 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.2.1</version>
<version>${maven.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<groupId>org.apache.maven.plugin-testing</groupId>
<artifactId>maven-plugin-testing-harness</artifactId>
<version>1.1</version>
<version>2.1</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -242,12 +239,24 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.4</version>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>${maven.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>2.2.1</version>
<artifactId>maven-compat</artifactId>
<version>${maven.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<reporting>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
package de.jflex.plugin.maven;

import jflex.Main;
import jflex.Options;
import org.apache.commons.io.FileUtils;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
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.project.MavenProject;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
Expand All @@ -16,35 +27,21 @@
import java.util.Iterator;
import java.util.List;

import org.apache.commons.io.FileUtils;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;

import jflex.Main;
import jflex.Options;

/**
* Generates lexical scanners from one or more <a href="http://jflex.de/">JFlex</a>
* grammar files.
*
* @goal generate
* @phase generate-sources
*
* @author Régis Décamps (decamps@users.sf.net)
*
*/
@Mojo(name="generate", defaultPhase = LifecyclePhase.GENERATE_SOURCES, threadSafe = true)
public class JFlexMojo extends AbstractMojo {
/**
* Name of the directory where to look for jflex files by default.
*/
public static final String SRC_MAIN_JFLEX = "src/main/jflex";

/**
* @parameter expression="${project}"
* @required
* @readonly
*/
@Parameter(property="project", required = true, readonly = true)
private MavenProject project;

// cannot use {@value SRC_MAIN_JFLEX} because Maven site goals.html
Expand All @@ -58,107 +55,98 @@ public class JFlexMojo extends AbstractMojo {
* processed.
*
* @see #SRC_MAIN_JFLEX
* @parameter
*/
@Parameter
private File[] lexDefinitions;

/**
* Name of the directory into which JFlex should generate the parser.
*
* @parameter expression="${project.build.directory}/generated-sources/jflex"
*
*/
@Parameter(defaultValue = "${project.build.directory}/generated-sources/jflex")
private File outputDirectory;

/**
* The granularity in milliseconds of the last modification date for
* testing whether a source needs regeneration.
*
* @parameter expression="${lastModGranularityMs}" default-value="0"
*
*/
@Parameter(property = "lastModGranularityMs", defaultValue = "0")
private int staleMillis;

/**
* Whether source code generation should be verbose.
*
* @parameter default-value="false"
*/
@Parameter(defaultValue = "false")
private boolean verbose;

/**
* Whether a warning will be logged when there are unused macros.
*
* @parameter default-value="true"
*
*/
@Parameter(defaultValue = "true")
private boolean unusedWarning;

/**
* Whether to dump full debug information.
*
* @parameter default-value="false"
*/
@Parameter(defaultValue = "false")
private boolean dump;

/**
* Whether to produce graphviz .dot files for the generated automata. This
* feature is EXPERIMENTAL.
*
* @parameter default-value="false"
*/
@Parameter(defaultValue = "false")
private boolean dot;

/**
* Use external skeleton file.
*
* @parameter
*/
@Parameter
private File skeleton;

/**
* Strict JLex compatibility.
*
* @parameter default-value="false"
*/
@Parameter(defaultValue = "false")
private boolean jlex;

/**
* The generation method to use for the scanner. The only valid value is
* <code>pack</code>.
*
* @parameter default-value="pack"
*/
@Parameter(defaultValue = "pack")
private String generationMethod = "pack"; // NOPMD

/**
* A flag whether to perform the DFA minimization step during scanner
* generation.
*
* @parameter default-value="true"
*/
@Parameter(defaultValue = "true")
private boolean minimize = true; // NOPMD

/**
* A flag whether to enable the generation of a backup copy if the generated
* source file already exists.
*
* @parameter default-value="true"
*/
@Parameter(defaultValue = "true")
private boolean backup = true; // NOPMD

/**
* If true, the dot (.) metachar matches [^\n]
* instead of [^\n\r\u000B\u000C\u0085\u2028\u2029].
*
* @parameter default-value="false"
*/
@Parameter(defaultValue = "false")
private boolean legacyDot = false; // NOPMD

// TODO: In the JFlex version after 1.6, this parameter will cease to exist.
/**
* If true, the generated scanner will include a constructor taking
* an InputStream.
*
* @parameter default-value="false"
*/
@Parameter(defaultValue = "false")
private boolean inputStreamCtor = false; // NOPMD

/**
Expand Down Expand Up @@ -208,7 +196,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
* Lexer definiton file or directory to process.
* @throws MojoFailureException
* if the file is not found.
* @throws MojoExecutionException
* @throws MojoExecutionException if file could not be parsed
*/
@SuppressWarnings("unchecked")
private void parseLexDefinition(File lexDefinition)
Expand Down Expand Up @@ -278,9 +266,7 @@ private void parseLexFile(File lexFile) throws MojoFailureException,

Options.no_minimize = !minimize; // NOPMD
Options.no_backup = !backup; // NOPMD
if ("pack".equals(generationMethod)) {
/* no-op - there is only one generation method */
} else {
if (!"pack".equals(generationMethod)) {
throw new MojoExecutionException("Illegal generation method: "
+ generationMethod);
}
Expand Down
9 changes: 0 additions & 9 deletions jflex-unicode-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,6 @@
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-testing</groupId>
<artifactId>maven-plugin-testing-harness</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
18 changes: 3 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@

<properties>
<jflex.jdk.version>1.7</jflex.jdk.version>
<maven.compiler.source>${jflex.jdk.version}</maven.compiler.source>
<maven.compiler.target>${jflex.jdk.version}</maven.compiler.target>
</properties>

<issueManagement>
Expand All @@ -102,7 +104,7 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.2</version>
<version>2.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand All @@ -119,16 +121,6 @@
<artifactId>maven-plugin-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-testing</groupId>
<artifactId>maven-plugin-testing-harness</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>2.0.11</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down Expand Up @@ -169,10 +161,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${jflex.jdk.version}</source>
<target>${jflex.jdk.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
4 changes: 0 additions & 4 deletions testsuite/jflex-testsuite-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,6 @@
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
</dependency>
<dependency>
<groupId>de.jflex</groupId>
<artifactId>jflex</artifactId>
Expand Down
0