On 10/05/2011, at 12:28 PM, mraccola wrote:

> Hope it's OK for me to chime in on this.
> 
> I would strongly vote for generating files into separate directories. 
> Following are some thoughts:
> 
> * Combining static files with generated files is going to lead to
> hacks...like including the same class files twice on the IDE classpath and
> becoming dependent on classpath order.  IMHO that is asking for trouble.
> 
> * I'm not so sure generating files into the "build" directory is a good idea
> either.  Why not treat these things like 1st class source folders and put
> them under "src".  If not, why not put them under another top level
> folder...say "genSrc".

Why do you think this is a good place for them? That is, what's special about 
generated resources, so that they should end up in a separate directory to all 
the other generated stuff (eg classes, jars, test reports, zips, etc)?


> 
> * For the Java plugin at least it would be great it there could be full
> support for all of the following: "main" source files, "main" resource
> files, "test" source files, and "test" resource files.  I have a project
> which has a use case for all of these.

The Java plugin does support this stuff already - you just need to configure it 
appropriately. We do want to add the concept of generated source at some point, 
to reduce the amount of configuration you need to do. And maybe the concept of 
generated resources, too. But, for now, all we've really done is to allow you 
to configure a source set to have multiple output directories, which need to be 
aggregated into a classpath. You can use these directories for whatever purpose 
you like, and by convention, there's one for the compiled classes ad one for 
the processed static resources.


> 
> Here's a concrete proposal for what the Java plugin could support:
> 
> src/codeGenMain/java -- Generated production Java source
> src/codeGenMain/resources -- Generated production resources
> src/codeGenTest/java -- Generated test java source
> src/codeGenTest/resources -- Generated test resources
> 
> Another alternative is:
> 
> genSrc/main/java -- Generated production Java source
> genSrc/main/resources -- Generated production resources
> genSrc/test/java -- Generated test java source
> genSrc/test/resources -- Generated test resources
> 
> In either case:
> 
> * Gradle would wipe out the contents of these directories when the "clean"
> task was run.
> * Gradle would generate the files for the java directories BEFORE the
> appropriate "compile***" or "process***Resources" task was run.  Gradle
> would compile or process these files just as it does the static files.

Why do you want this to happen?


> * Gradle would add these folders to the IDE classpath.

Should we add the generated source, or the classes compiled from the generated 
source?


--
Adam Murdoch
Gradle Co-founder
http://www.gradle.org
VP of Engineering, Gradleware Inc. - Gradle Training, Support, Consulting
http://www.gradleware.com

Reply via email to