Steve Appling wrote:
Adam Murdoch wrote:
Steve Appling wrote:
I'm trying to update the root build.gradle to handle some of my
recent changes and am running past my understanding of source sets.
The javadoc task currently has:
srcDirs = subprojects.inject([]) {list, project -> list +
project.source.main.java.srcDirs + project.source.main.groovy.srcDirs}
I have changed a sub-project to not be a groovy project and am
trying to build up the correct set of sources for javadoc, but I
can't figure out how to test what kind of sources are in a
SourceSet. If I reference project.source.main.groovy I get an
exception on non-groovy projects.
The intended solution is that tasks such as javadoc or checkstyle
which operate on Java source use the SourceSet.allJava property,
which is a FileTree containing all Java source files regardless of
the type of project, and where the source comes from. Something like:
javadoc {
subprojects.each {
source it.source.main.allJava
}
}
At the moment, Javadoc does not accept a FileCollection as source (it
will soon), so we're stuck with reverse engineering the source
directories. You could do something like:
srcDirs = subprojects.inject([]) {list, project ->
if ( project.source.main.hasProperty('groovy') {
list.addAll(project.source.main.groovy.srcDirs)
}
list.addAll(project.source.main.java.srcDirs)
}
This is actually very similar to what I was trying, but:
project.source.main.hasProperty('groovy') returns 'null' for
gradle-core. Something is wrong here - not sure what.
There's a few other ways you can check if the groovy plugin has been
applied:
project.plugins.hasPlugin('groovy')
project.source.main.convention.plugins.groovy
Adam
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email