Files
spring-data-redis/docs/build.gradle
2011-04-21 20:44:47 +03:00

116 lines
4.0 KiB
Groovy

// -----------------------------------------------------------------------------
// Configuration for the docs subproject
// -----------------------------------------------------------------------------
apply plugin: 'base'
apply plugin: 'docbook'
assemble.dependsOn = ['api', 'docbook']
[docbookHtml, docbookFoPdf, docbookHtmlSingle]*.sourceFileName = 'index.xml'
[docbookHtml, docbookFoPdf, docbookHtmlSingle]*.sourceDirectory = new File(projectDir, 'src/reference/docbook')
docbookHtml.stylesheet = new File(projectDir, 'src/reference/resources/xsl/html-custom.xsl')
docbookHtmlSingle.stylesheet = new File(projectDir, 'src/reference/resources/xsl/html-single-custom.xsl')
docbookFoPdf.stylesheet = new File(projectDir, 'src/reference/resources/xsl/pdf-custom.xsl')
def imagesDir = new File(projectDir, 'src/reference/resources/images');
docbookFoPdf.admonGraphicsPath = "${imagesDir}/admon"
docbookFoPdf.imgSrcPath = "${imagesDir}"
refSpec = copySpec {
into ('reference') {
from("$buildDir/docs")
from("$projectDir/src/reference/resources")
}
into ('reference/images') {
from (imagesDir)
}
}
task reference (type: Copy) {
dependsOn 'docbook'
group = 'Documentation'
description = "Builds aggregated DocBook"
destinationDir = buildDir
with(refSpec)
}
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')
username = project.property('sshUsername')
key = project.property('sshPrivateKey')
}
}
// upload task
task uploadApi(type: org.springframework.gradle.tasks.ScpUpload) {
dependsOn api, docbook
description = "Upload API Distribution"
remoteDir = "./static.spring/spring-data/data-keyvalue/docs/${project.version}"
login = docSiteLogin
with(apiSpec)
with(refSpec)
}