Kenneth Kousen wrote:
> 
> This is all working, but it feels brittle because of the explicit source
> directory name. Is there a better, more general way to do this?
> 

The Java source directories can be queried with
"sourceSets.main.java.srcDirs". However, I suggest to separate generated
sources from the rest. I'd probably put them into a subdirectory of the
build output directory:

sourceSets.main.java.srcDir "$buildDir/generatedSources" // add directory
for generated sources

This avoids troubles with source control, and allows to clean the generated
sources with "gradle clean". To only regenerate sources if necessary, you
could use Gradle's incremental build capabilities and specify the inputs and
outputs of the generation task.


--
Peter Niederwieser 
Developer, Gradle
http://www.gradle.org
Trainer & Consultant, Gradleware
http://www.gradleware.com
Creator, Spock Framework
http://spockframework.org


--
View this message in context: 
http://gradle.1045684.n5.nabble.com/Referring-to-main-source-dir-tp3410389p3410432.html
Sent from the gradle-user mailing list archive at Nabble.com.

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

    http://xircles.codehaus.org/manage_email


Reply via email to