Consider the Antlr plugin as I think it is a good indicator. Now your project might have grammar files in 'src/main/antlr', 'src/test/antlr, or both. Obviously you need to handle these differently in terms of where the eventually compiled classes end up and *by far* the easiest solution to that is to control where the generated sources are put and specifically to segregate them. That is the whole premise.

So essentially its {buildDir}/{capability}/{originatingSourceSet}/{sourceType}. Take 'target/generated-src/antlr/main/java'. The {capability} is "antlr", the {originatingSourceSet} is "main" (they came from "src/main" source set), the {sourceType} is "java" since we are generating java sources.

From there it is simply a matter of consistency. I am a huge fan of consistency because it makes getting up to speed much faster and avoids confusions. I also like logical solutions and to me at least this was and is the most logical solution.


On 05/10/2011 02:25 PM, Philip Crotwell wrote:
Just curious, but why the double directory levels in your structure?
In the normal src directory you would have src/logging/java instead of
src/logging/main/java? I guess I can see it if you needed to have
generated-src/logging/main/java and generated-src/logging/test/java,
but that feels a bit more like a whole generated subproject than a
simple generated src directory.

That does bring up another possible way to do this, would it be better
in some cases to use a multiproject model for generated source code?
Where would you put a generated subproject?

Also, with respect to the connection between subdirectories of the
generated and regular src directories,  there might be cases where the
"main/java" would be generated, and hence inside build, but the
"test/java" would be hand coded and inside the regular src. It would
be very useful if the java plugin was smart enough to know that those
two went together.

Philip

On Tue, May 10, 2011 at 2:10 PM, Steve Ebersole<[email protected]>  wrote:
Sorry, that should have read:
target/generated-src/logging/main/java
target/generated-src/antlr/main/java
target/generated-src/jpamodelgen/test/java

to account for the possibility for other types of generated sources other
than java.  That was the convention discussed back when I originally whipped
up the Antlr plugin and I personally think it makes the most sense.

On 05/10/2011 08:57 AM, Steve Ebersole wrote:

+1 to this whole branch of discussion.  This is exactly the convention
we decided on in the Hibernate build.  We generate various types of
sources; some production (main), some test.  In fact we decided on a
single grouping directory under {buildDir} also to keep things "neat".
But we also split out the various types of things being generated.  So
we end up with directories such as (we use 'target' instead of 'build'):
target/generated-src/logging/main
target/generated-src/antlr/main
target/generated-src/jpamodelgen/test

This has worked great for us.  Except of course IDE project generation.

On May 10, 2011 8:41 AM, "mraccola"<[email protected]
<mailto:[email protected]>>  wrote:

--
Steve Ebersole<[email protected]>
http://hibernate.org

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




---------------------------------------------------------------------
To unsubscribe from this list, please visit:

     http://xircles.codehaus.org/manage_email



--
Steve Ebersole <[email protected]>
http://hibernate.org

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to