102 lines
2.9 KiB
Groovy
102 lines
2.9 KiB
Groovy
import org.apache.tools.ant.filters.ReplaceTokens
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Configuration for the docs subproject
|
|
// -----------------------------------------------------------------------------
|
|
|
|
apply plugin: 'base'
|
|
apply plugin: 'docbook'
|
|
|
|
assemble.dependsOn = [rootProject.javadoc, 'reference']
|
|
|
|
[docbookHtml, docbookFoPdf, docbookHtmlSingle]*.group = 'Documentation'
|
|
[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');
|
|
[docbookHtml, docbookFoPdf, docbookHtmlSingle]*.admonGraphicsPath = "./images/admon/"
|
|
[docbookFoPdf]*.imgSrcPath = "${imagesDir}"
|
|
[docbookHtml, docbookHtmlSingle]*.imgSrcPath = "./images/"
|
|
|
|
// defined separately to prevent the replacement from taking place (seems to affect the images)
|
|
imgSpec = copySpec {
|
|
into ('reference') {
|
|
from("$projectDir/src/reference/resources") {
|
|
include 'css/**/*'
|
|
}
|
|
from("$buildDir/docs") {
|
|
include '*.pdf'
|
|
}
|
|
}
|
|
|
|
into ('reference/images') {
|
|
from (imagesDir)
|
|
}
|
|
}
|
|
|
|
|
|
refSpec = copySpec {
|
|
into ('reference') {
|
|
from("$buildDir/docs") {
|
|
exclude '*.fo'
|
|
exclude '*.pdf'
|
|
}
|
|
}
|
|
|
|
p = new Properties()
|
|
|
|
for (e in project.properties) {
|
|
if (e.key != null && e.value != null)
|
|
p.setProperty(e.key, e.value.toString())
|
|
}
|
|
|
|
filter(ReplaceTokens, tokens: p)
|
|
|
|
with(imgSpec)
|
|
}
|
|
|
|
task reference (type: Copy) {
|
|
dependsOn 'docbook'
|
|
description = "Builds aggregated DocBook"
|
|
group = "Documentation"
|
|
destinationDir = buildDir
|
|
with(refSpec)
|
|
}
|
|
|
|
|
|
apiSpec = copySpec {
|
|
into('api') {
|
|
from(rootProject.javadoc.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')
|
|
}
|
|
}
|
|
|
|
infoSpec = copySpec {
|
|
from("$projectDir/src/info") {
|
|
include 'changelog.txt'
|
|
}
|
|
}
|
|
|
|
// upload task
|
|
task uploadDocs(type: org.springframework.gradle.tasks.ScpUpload) {
|
|
dependsOn rootProject.javadoc, reference
|
|
description = "Upload API Distribution"
|
|
group = "Distribution"
|
|
remoteDir = "/opt/www/domains/springframework.org/www/htdocs/spring-hadoop/docs/${project.version}"
|
|
login = docSiteLogin
|
|
|
|
with(apiSpec)
|
|
with(refSpec)
|
|
with(infoSpec)
|
|
} |