Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 4e897eaa44
Fetching contributors…

Cannot retrieve contributors at this time

124 lines (112 sloc) 4.495 kB
/**
* Since Grails is a mixed Groovy/Java codebase the javadoc tool needs stubs in order for javadoc compilation to pass
* This target generates a set of stubs for the Groovy sources
*/
task stubs {
ext.destinationDir = "$buildDir/docs/stubs"
doFirst {
def isolatedAnt = services.get(org.gradle.api.internal.project.IsolatedAntBuilder)
isolatedAnt.execute {
mkdir(dir: destinationDir)
taskdef(name: "generatestubs", classname: "org.codehaus.groovy.grails.cli.GenerateStubsTask") {
classpath {
for(sub in subprojects) {
pathelement path: sub.sourceSets.main.compileClasspath.asPath
}
}
}
generatestubs(destdir: destinationDir) {
classpath {
for(sub in subprojects) {
pathelement path: sub.sourceSets.main.compileClasspath.asPath
}
}
src {
for (sub in subprojects) {
sub.sourceSets.main.groovy.srcDirs.each { srcDir ->
if (srcDir.exists()) {
dirset(dir: srcDir) {
exclude name: "**/*.properties"
}
}
}
}
}
}
}
}
}
task docs {
ext.destinationDir = file("${projectDir}/doc")
}
task javadoc(type:Javadoc) {
classpath = files(subprojects.configurations.compile)
dependsOn stubs
maxMemory = '256M'
destinationDir = file("$docs.destinationDir/javadoc")
source subprojects.sourceSets.main.groovy.srcDirs + stubs.destinationDir
include "org/codehaus/groovy/grails/**", "grails/**"
exclude "**/**.groovy"
project.configure(options) {
windowTitle = "Grails $grailsVersion"
docTitle = "<h1>Grails</h1>"
encoding = "UTF-8"
memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PACKAGE
author = true
version = true
use = true
breakIterator = true
links("http://java.sun.com/j2ee/1.4/docs/api", "http://java.sun.com/j2se/1.5.0/docs/api", "http://static.springframework.org/spring/docs/2.5.x/api")
// tags("todo:a:To do") todo fix the javadoc task to accept this option
}
verbose = false
}
task groovydoc(type:Groovydoc) {
classpath = files(subprojects.configurations.compile)
groovyClasspath = files(subprojects.configurations.compile)
destinationDir = file("$docs.destinationDir/api")
windowTitle = "Grails $grailsVersion"
docTitle = "Grails $grailsVersion"
source subprojects.sourceSets.main.groovy.srcDirs
use = true
// Can't make these link methods to work
// link("http://static.springsource.org/spring/docs/3.0.x/javadoc-api", "org.springframework.")
// link("http://download.oracle.com/javase/1.5.0/docs/api", "java." , "javax.")
// link("http://download.oracle.com/javaee/5/api", "javax.")
doLast {
delete("${buildDir}/tmp")
}
}
task fetchGrailsDocsSource << {
ant {
mkdir dir: buildDir
get src:"http://nodeload.github.com/grails/grails-doc/zipball/master", dest:"${buildDir}/grails-docs-src.zip", verbose:"true"
unzip(src: "${buildDir}/grails-docs-src.zip", dest: buildDir) {
mapper type: 'regexp', from:/(grails-grails-doc-[\w]*\/)(.*)/, to:/grails-docs-src\/\2/
}
}
}
task gdoc(type: GradleBuild, dependsOn: ["groovydoc", "fetchGrailsDocsSource"]) {
buildFile = "${buildDir}/grails-docs-src/build.gradle"
tasks = ["clean", "assemble"]
doFirst {
project.oldGrailsHome = System.getProperty("grails.home")
System.setProperty("grails.home", projectDir.absolutePath)
System.setProperty("disable.groovydocs", "true")
}
doLast {
if (project.oldGrailsHome) System.setProperty("grails.home", project.oldGrailsHome)
else System.clearProperty("grails.home")
System.clearProperty("disable.groovydocs")
ant.mkdir dir: "${projectDir}/dist"
copy {
from "${buildDir}/grails-docs-src/build/distributions"
into "${projectDir}/dist"
}
copy {
from file("${buildDir}/grails-docs-src/build/docs")
into docs.destinationDir
}
}
}
docs.dependsOn gdoc
Jump to Line
Something went wrong with that request. Please try again.