+ breakdown the scripts

This commit is contained in:
Costin Leau
2011-04-21 14:51:20 +03:00
parent 5e6404bd42
commit ae2b02b5e6
7 changed files with 257 additions and 65 deletions

107
docs/build.gradle Normal file
View File

@@ -0,0 +1,107 @@
// -----------------------------------------------------------------------------
// Configuration for the docs subproject
// -----------------------------------------------------------------------------
apply plugin: 'base'
apply plugin: 'docbook'
assemble.dependsOn = ['api', 'docbook']
docbookHtmlSingle.stylesheet = new File(projectDir, 'docs/src/reference/resources/xsl/html-single-custom.xsl')
[docbookHtml, docbookFoPdf, docbookHtmlSingle]*.sourceFileName = 'index.xml'
[docbookHtml, docbookFoPdf, docbookHtmlSingle]*.sourceDirectory = new File(projectDir, 'docs/src/reference/docbook')
docbookHtml.stylesheet = new File(projectDir, 'docs/src/reference/resources/xsl/html-custom.xsl')
docbookHtmlSingle.stylesheet = new File(projectDir, 'docs/src/reference/resources/xsl/html-single-custom.xsl')
docbookFoPdf.stylesheet = new File(projectDir, 'docs/src/reference/resources/xsl/pdf-custom.xsl')
def imagesDir = new File(projectDir, 'docs/src/reference/resources/images');
// docbookFoPdf.admonGraphicsPath = "${imagesDir}/"
docbookFoPdf.imgSrcPath = "${projectDir}/docs/reference/resources/"
spec = copySpec {
into ('reference') {
from("$buildDir/docs")
from("$projectDir/src/reference/resources")
}
into ('reference/images') {
from (imagesDir)
}
}
task api(type: Javadoc) {
group = 'Documentation'
description = "Builds aggregated JavaDoc HTML for all core project classes."
// this task is a bit ugly to configure. it was a user contribution, and
// Hans tells me it's on the roadmap to redesign it.
srcDir = file("${projectDir}/src/api")
destinationDir = file("${buildDir}/api")
tmpDir = file("${buildDir}/api-work")
optionsFile = file("${tmpDir}/apidocs/javadoc.options")
options.stylesheetFile = file("${srcDir}/spring-javadoc.css")
options.links = ["http://static.springframework.org/spring/docs/3.0.x/javadoc-api"]
options.overview = "${srcDir}/overview.html"
options.docFilesSubDirs = true
title = "${rootProject.description} ${version} API"
// collect all the sources that will be included in the javadoc output
source javaprojects.collect {project ->
project.sourceSets.main.allJava
}
// collect all main classpaths to be able to resolve @see refs, etc.
// this collection also determines the set of projects that this
// task dependsOn, thus the runtimeClasspath is used to ensure all
// projects are included, not just *dependencies* of all classes.
// this is awkward and took me a while to figure out.
classpath = files(javaprojects.collect {project ->
project.sourceSets.main.runtimeClasspath
})
// copy the images from the doc-files dir over to the target
doLast { task ->
copy {
from file("${task.srcDir}/doc-files")
into file("${task.destinationDir}/doc-files")
}
}
}
// javadoc settings
api.options.outputLevel = org.gradle.external.javadoc.JavadocOutputLevel.QUIET
api.options.breakIterator = true
api.options.showFromProtected()
api.options.groups = [
'Spring Data Key Value Core': ['org.springframework.data.keyvalue*'],
'Spring Data Redis Support' : ['org.springframework.data.keyvalue.redis*'],
'Spring Data Riak Support' : ['org.springframework.data.keyvalue.riak*']]
api.options.links = [
"http://static.springframework.org/spring/docs/3.0.x/javadoc-api",
"http://download.oracle.com/javase/6/docs/api/"]
apiSpec = copySpec {
into('api') {
from(api.destinationDir)
}
}
task docSiteLogin(type: org.springframework.gradle.tasks.Login) {
if (project.hasProperty('sshHost')) {
host = project.property('sshHost')
}
}
// upload task
task uploadApidocs(type: org.springframework.gradle.tasks.ScpUpload) {
dependsOn api
baseName = "${rootProject.name}"
appendix = 'apidocs'
remoteDir = '.'
login = docSiteLogin
with(apiSpec)
}