You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Alexey Demakov <de...@ispras.ru> on 2003/04/15 13:07:12 UTC

the concept of java-preprocessor plugins (ANTLR for example)

There are some plugins that deals with non-java files translating into java
files.
For example, maven-antlr-plugin translate grammar file <grammar>.g to *.java
files.
We've implemented JavaCC plugin for team usage and now want to share it with
maven community.
But there is one conceptual question about such plugins.

---> How to specify a set of input files and where generated java files
should be placed? <---

maven-antlr-plugin requires maven.antlr.src.dir and maven.antlr.grammars
properties to be specified.

It restricts grammars' location to single derictory.

maven-antlr-plugin have fixed output root directory ${maven.build.dir}/antlr
and places
generated java files to subdirectory corresponding to their package.
Package name is extracted from *.g files in very primitive way
(To be exact, it searches for the line containing "<generated file name>
extends "
and "package <package_name>;")

It's very easy to fool this plugin. Moreover, ANTLR now has C# generator
that use other
way to pass namespace name. I think there are cases when package and file
name can't be
easily extracted from input file.

Is there general convention for all plugins how to find input files and
where to place generated ones?

If no, I propose the following way:

1. Input files for plugin <plugin> are placed somewhere in the
${maven.<plugin>.src.dir} subdirectories.
(By default it can be ${maven.src.dir})
2. Plugin have mask for input file names ${maven.<plugin>.src.set}.
For maven-antlr-plugin mask default value can be "**/*.g".
To specify order of translation (Sometimes it's required)
user can redefine maven.<plugin>.src.set mask as
"**/grammar1.g,**/grammar2.g,**/*.g".
Plugin should process all "**/grammar1.g" files then all "**/grammar2.g" and
then the rest "**/*.g".
3. Generated files should be placed into the same relative subdirectory
under
${maven.<plugin>.output.dir} (For example "${maven.build.dir}/<plugin>" by
default).
This directory will be added to maven.compile.src.set if needed.

Such approach restricts locations of plugin input files but I don't see
other disadvantages.

After confirmation I'm ready to upload JavaCC plugin and updated version of
ANTLR plugin.

Best regards,
Alexey

P.S. I'm 'allex' on IRC channel

---
Alexey Demakov, ISP RAS
e-mail: demakov@ispras.ru
ICQ: 740187




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: the concept of java-preprocessor plugins (ANTLR for example)

Posted by Alexey Demakov <de...@ispras.ru>.
I've discussed it with Bob McWhirter on IRC yesterday.
He agrees with me. So I start to develop updated maven-antlr-plugin
and maven-javacc-plugin

---
Alexey Demakov, ISP RAS
e-mail: demakov@ispras.ru
ICQ: 740187



----- Original Message -----
From: "Rafal Krzewski" <Ra...@caltha.pl>
To: "Maven Developers List" <de...@maven.apache.org>
Sent: Wednesday, April 16, 2003 12:03 PM
Subject: Re: the concept of java-preprocessor plugins (ANTLR for example)


> Alexey Demakov wrote:
>
> > 1. Input files for plugin <plugin> are placed somewhere in the
> > ${maven.<plugin>.src.dir} subdirectories.
> > (By default it can be ${maven.src.dir})
> > 2. Plugin have mask for input file names ${maven.<plugin>.src.set}.
> > For maven-antlr-plugin mask default value can be "**/*.g".
> > To specify order of translation (Sometimes it's required)
> > user can redefine maven.<plugin>.src.set mask as
> > "**/grammar1.g,**/grammar2.g,**/*.g".
> > Plugin should process all "**/grammar1.g" files then all "**/grammar2.g"
and
> > then the rest "**/*.g".
> > 3. Generated files should be placed into the same relative subdirectory
> > under
> > ${maven.<plugin>.output.dir} (For example "${maven.build.dir}/<plugin>"
by
> > default).
> > This directory will be added to maven.compile.src.set if needed.
>
> Looks very good. You have my non-commiter +.
>
> R.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: the concept of java-preprocessor plugins (ANTLR for example)

Posted by Rafal Krzewski <Ra...@caltha.pl>.
Alexey Demakov wrote:

> 1. Input files for plugin <plugin> are placed somewhere in the
> ${maven.<plugin>.src.dir} subdirectories.
> (By default it can be ${maven.src.dir})
> 2. Plugin have mask for input file names ${maven.<plugin>.src.set}.
> For maven-antlr-plugin mask default value can be "**/*.g".
> To specify order of translation (Sometimes it's required)
> user can redefine maven.<plugin>.src.set mask as
> "**/grammar1.g,**/grammar2.g,**/*.g".
> Plugin should process all "**/grammar1.g" files then all "**/grammar2.g" and
> then the rest "**/*.g".
> 3. Generated files should be placed into the same relative subdirectory
> under
> ${maven.<plugin>.output.dir} (For example "${maven.build.dir}/<plugin>" by
> default).
> This directory will be added to maven.compile.src.set if needed.

Looks very good. You have my non-commiter +.

R.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org