On Sun, Apr 17, 2011 at 1:30 PM, Adam Murdoch <[email protected]> wrote: > > On 16/04/2011, at 11:25 AM, Howard Lewis Ship wrote: > > I'm attempting to create aggregated JavaDoc for my multi-module > project. In the top-level build.gradle I've added the following: > > // Cribbed from > https://github.com/hibernate/hibernate-core/blob/master/release/release.gradle#L19 > > javadocBuildDir = dir( buildDirName + "/documentation/javadocs" ) > > task aggregateJavadocs(type: Javadoc) { > description = "Build the aggregated JavaDocs for all modules" > maxMemory = '512m' > destinationDir = javadocBuildDir.dir > configure(options) { > // overview = new File( projectDir, 'src/javadoc/package.html' ) > // stylesheetFile = new File( projectDir, > 'src/javadoc/stylesheet.css' ) > windowTitle = 'Tapestry API Documentation' > docTitle = "Tapestry JavaDoc ($project.version)" > bottom = "Copyright © 2003-2011 <a > href=\"http://tapestry.apache.org\">The Apache Software > Foundation</a>." > use = true > links = [ 'http://download.oracle.com/javase/6/docs/api/', > 'http://download.oracle.com/javaee/6/api/' ] > } > > subprojects.each { subProject-> > > println subProject > > subProject.sourceSets.each { set -> > if (!"test" == set.name) { > source set.java > > if (classpath) { > classpath += set.classes + set.compileClasspath > } > else { > classpath = set.classes + set.compileClasspath > } > } > } > } > } > > This looks like a timing problem. The build script for the root project > executes before the build scripts for the subprojects. This means, if you > don't have something like subprojects { apply plugin: 'java' } in the root > build script, when your javadoc configuration code executes, the subprojects > won't have the java plugin applied. > There's a few options for dealing with this. > One is to make sure the java plugin has been applied to the projects which > you want to document, so in your root build script, do something like: > subprojects { apply plugin: 'java' }
This is already present: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/build.gradle?view=markup > Another option is to specify that (some of) the root build script must > execute after the subprojects' build scripts have been executed. So, in your > root build script you can do something like: > // code that executes before the subprojects goes here > subprojects.each { evaluationDependsOn(it.name) } This looks promising; I'll be trying it out shortly. > // code that executes after the subprojects goes here > task aggregateJavadocs(...) { ... } > Timing problems are a big source of confusion in Gradle, and we want to make > this easier to deal with - even if it's just some better error reporting. > One potential change we are thinking of making is to bust the configuration > stage up into several discrete stages. For example, we might first configure > the all project objects, then the domain objects owned by the projects, and > then finally the tasks. This way, your code above would just work. What is > interesting about this approach is that we could model it using tasks. Then, > we could use all the standard task mechanisms for customising the order, and > adding or removing configuration behaviour. This would also mean we could > potentially use some other task features, such as incremental build, to > minimise the work which has to be done at configuration time. > > > This fails immediately: > > $ gr agg > project ':plastic' > > FAILURE: Build failed with an exception. > > * Where: > Build file '/Users/hlship/workspaces/tapestry/tapestry5/build.gradle' line: > 37 > > * What went wrong: > A problem occurred evaluating root project 'tapestry5'. > Cause: Could not find property 'sourceSets' on project ':plastic'. > > * Try: > Run with --stacktrace option to get the stack trace. Run with --info > or --debug option to get more log output. > > BUILD FAILED > > Total time: 1.697 secs > ~/workspaces/tapestry/p > $ > > I'm on Gradle 1.0-milestone-1 > > Full source here: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/ > > With debug, not any more helpful: > > 18:18:58.997 [INFO] [org.gradle.BuildLogger] Projects loaded. Root > project using build file > '/Users/hlship/workspaces/tapestry/tapestry5/build.gradle'. > 18:18:58.999 [INFO] [org.gradle.BuildLogger] Included projects: [root > project 'tapestry5', project ':plastic', project > ':tapestry-annotations', project ':tapestry-beanvalidator', project > ':tapestry-core', project ':tapestry-func', project > ':tapestry-hibernate', project ':tapestry-hibernate-core', project > ':tapestry-ioc', project ':tapestry-jmx', project ':tapestry-json', > project ':tapestry-spring', project ':tapestry-test', project > ':tapestry-upload', project ':tapestry-yuicompressor'] > 18:18:59.000 [INFO] [org.gradle.configuration.BuildScriptProcessor] > Evaluating root project 'tapestry5' using build file > '/Users/hlship/workspaces/tapestry/tapestry5/build.gradle'. > 18:18:59.354 [QUIET] [system.out] project ':plastic' > 18:18:59.363 [DEBUG] [org.gradle.configuration.BuildScriptProcessor] > Timing: Running the build script took 0.362 secs > 18:18:59.378 [ERROR] [org.gradle.BuildExceptionReporter] > 18:18:59.380 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: > Build failed with an exception. > 18:18:59.382 [ERROR] [org.gradle.BuildExceptionReporter] > 18:18:59.383 [ERROR] [org.gradle.BuildExceptionReporter] * Where: > 18:18:59.383 [ERROR] [org.gradle.BuildExceptionReporter] Build file > '/Users/hlship/workspaces/tapestry/tapestry5/build.gradle' line: 37 > 18:18:59.384 [ERROR] [org.gradle.BuildExceptionReporter] > 18:18:59.385 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong: > 18:18:59.386 [ERROR] [org.gradle.BuildExceptionReporter] A problem > occurred evaluating root project 'tapestry5'. > 18:18:59.389 [ERROR] [org.gradle.BuildExceptionReporter] Cause: Could > not find property 'sourceSets' on project ':plastic'. > 18:18:59.390 [ERROR] [org.gradle.BuildExceptionReporter] > > > I'm kind of at a loss here. This feels like something I should just be > able to do with a line of configuration somewhere. > > The plastic module does have no dependencies at all. What's strange > is that the error is that the sourceSets property doesn't exist ... > not that its value is null or empty. Seems like an order of > evaluation problem, but I don't get it. > > > > > -- > Howard M. Lewis Ship > > Creator of Apache Tapestry > > The source for Tapestry training, mentoring and support. Contact me to > learn how I can get you up and productive in Tapestry fast! > > (971) 678-5210 > http://howardlewisship.com > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > > > -- > Adam Murdoch > Gradle Co-founder > http://www.gradle.org > VP of Engineering, Gradleware Inc. - Gradle Training, Support, Consulting > http://www.gradleware.com > > -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
