Added tasks for apidocs, doc and distro archive generation to the build file.

This commit is contained in:
Luke Taylor 2010-01-20 04:14:48 +00:00
parent 10cd080090
commit 56849dc41e
6 changed files with 79 additions and 28 deletions

View File

@ -1,6 +1,8 @@
import java.util.jar.Manifest import java.util.jar.Manifest
import org.gradle.api.tasks.bundling.GradleManifest import org.gradle.api.tasks.bundling.GradleManifest
apply id: 'base'
allprojects { allprojects {
version = '3.0.2.CI-SNAPSHOT' version = '3.0.2.CI-SNAPSHOT'
releaseBuild = version.endsWith('RELEASE') releaseBuild = version.endsWith('RELEASE')
@ -13,7 +15,7 @@ allprojects {
} }
} }
subprojects { configure(javaProjects()) {
apply id: 'java' apply id: 'java'
springVersion = '3.0.0.RELEASE' springVersion = '3.0.0.RELEASE'
@ -75,12 +77,9 @@ subprojects {
} }
jar.dependsOn bundlor jar.dependsOn bundlor
compileJava.doLast {
}
} }
subprojects { configure(javaProjects()) {
apply id: 'maven' apply id: 'maven'
// Create a source jar for uploading // Create a source jar for uploading
@ -121,3 +120,44 @@ subprojects {
conf2ScopeMappings.addMapping(1, configurations.provided, "provided") conf2ScopeMappings.addMapping(1, configurations.provided, "provided")
} }
task apidocs(type: Javadoc) {
destinationDir = new File(buildDir, 'apidocs')
optionsFile = file("$buildDir/tmp/javadoc.options")
source coreModuleProjects().collect { project ->
project.sourceSets.main.allJava
}
classpath = files(coreModuleProjects().collect { project ->
project.sourceSets.main.compileClasspath })
}
task dist (type: Zip) {
def docsDir = new File(project(':manual').buildDir, 'docs')
into('docs/apidocs') {
from apidocs.destinationDir
}
into('docs/reference') {
from docsDir
}
into('dist') {
from coreModuleProjects().collect { project -> project.libsDir }
}
}
dist.dependsOn apidocs, ':manual:doc'
dist.dependsOn subprojects.collect { "$it.path:assemble" }
def javaProjects() {
subprojects.findAll { project -> project.name != 'faq' && project.name != 'manual' }
}
def sampleProjects() {
subprojects.findAll { project -> project.name.startsWith('spring-security-samples') }
}
def coreModuleProjects() {
javaProjects() - sampleProjects()
}

View File

@ -1,14 +0,0 @@
usePlugin('docbook')
defaultTasks 'docbookHtmlSingle'
docbookSrcFileName = 'faq.xml'
docbookHtmlSingle.stylesheet = new File(projectDir, 'src/xsl/html-single-custom.xsl')
docbookHtmlSingle.doLast {
resourcesDir = new File(projectDir, 'src/resources')
ant {
docsDir = new File(buildDir, 'docs')
copy(toDir: docsDir) {fileset(dir: resourcesDir)}
}
}

15
docs/faq/faq.gradle Normal file
View File

@ -0,0 +1,15 @@
apply id: 'base'
apply id: 'docbook'
defaultTasks 'docbookHtmlSingle'
docbookSrcFileName = 'faq.xml'
docbookHtmlSingle.stylesheet = new File(projectDir, 'src/xsl/html-single-custom.xsl')
docbookHtmlSingle.doLast {
resourcesDir = new File(projectDir, 'src/resources')
ant {
docsDir = new File(buildDir, 'docs')
copy(toDir: docsDir) {fileset(dir: resourcesDir)}
}
}

View File

@ -1,19 +1,17 @@
apply id: 'base'
apply id: 'docbook' apply id: 'docbook'
defaultTasks 'docbookHtml'
docbookSrcFileName = 'springsecurity.xml' docbookSrcFileName = 'springsecurity.xml'
docbookHtml.stylesheet = new File(projectDir, 'src/xsl/html-custom.xsl') docbookHtml.stylesheet = new File(projectDir, 'src/xsl/html-custom.xsl')
docbookFoPdf.stylesheet = new File(projectDir, 'src/xsl/pdf-custom.xsl') docbookFoPdf.stylesheet = new File(projectDir, 'src/xsl/pdf-custom.xsl')
docbookHtml.doLast { task doc (dependsOn: [docbookHtml, docbookFoPdf]) << {
resourcesDir = new File(projectDir, 'src/resources') resourcesDir = new File(projectDir, 'src/resources')
ant { ant {
docsDir = new File(buildDir, 'docs') docsDir = new File(buildDir, 'docs')
copy(toDir: docsDir) {fileset(dir: resourcesDir)} copy(toDir: docsDir) {fileset(dir: resourcesDir)}
copy(toDir: new File(docsDir, 'images')) {fileset(dir: new File(projectDir, 'src/docbook/images'))} copy(toDir: new File(docsDir, 'images')) {fileset(dir: new File(projectDir, 'src/docbook/images'))}
// TODO: Add this to the plugin
delete { fileset(dir: docsDir, includes: "*.fo")}
} }
} }
/*docbookSrc = new File(project.buildDir, 'docbook/src')
docbookDir = new File(project.buildDir, 'docbook/stylesheets')*/

View File

@ -10,7 +10,7 @@
</author> </author>
</authorgroup> </authorgroup>
<productname>Spring Security</productname> <productname>Spring Security</productname>
<releaseinfo>3.0.2.CI-SNAPSHOT</releaseinfo> <releaseinfo>3.0.1.RELEASE</releaseinfo>
</info> </info>
<toc/> <toc/>
<preface xml:id="preface"> <preface xml:id="preface">

View File

@ -1,4 +1,4 @@
String[] modules = [ def String[] modules = [
'core', 'core',
'web', 'web',
'ldap', 'ldap',
@ -9,12 +9,17 @@ String[] modules = [
'taglibs' 'taglibs'
] ]
String[] samples = [ def String[] samples = [
'tutorial', 'tutorial',
'contacts', 'contacts',
'openid' 'openid'
] ]
def String[] docs = [
'faq',
'manual'
]
include modules include modules
modules.each {name -> modules.each {name ->
@ -32,6 +37,13 @@ samples.each {name ->
p.projectDir = new File(settingsDir, "samples/${name}"); p.projectDir = new File(settingsDir, "samples/${name}");
} }
include docs
docs.each{ name ->
p = findProject(":${name}")
p.buildFileName = "${name}.gradle"
p.projectDir = new File(settingsDir, "docs/${name}");
}
rootProject.children.each {project -> rootProject.children.each {project ->
assert project.buildFile.isFile() assert project.buildFile.isFile()