Browse Source

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

Luke Taylor 15 years ago
parent
commit
56849dc41e
6 changed files with 79 additions and 28 deletions
  1. 45 5
      build.gradle
  2. 0 14
      docs/faq/build.gradle
  3. 15 0
      docs/faq/faq.gradle
  4. 4 6
      docs/manual/manual.gradle
  5. 1 1
      docs/manual/src/docbook/springsecurity.xml
  6. 14 2
      settings.gradle

+ 45 - 5
build.gradle

@@ -1,6 +1,8 @@
 import java.util.jar.Manifest
 import org.gradle.api.tasks.bundling.GradleManifest
 
+apply id: 'base'
+
 allprojects {
     version = '3.0.2.CI-SNAPSHOT'
     releaseBuild = version.endsWith('RELEASE')
@@ -13,7 +15,7 @@ allprojects {
     }
 }
 
-subprojects {
+configure(javaProjects()) {
     apply id: 'java'
 
     springVersion = '3.0.0.RELEASE'
@@ -75,12 +77,9 @@ subprojects {
     }
 
     jar.dependsOn bundlor
-
-    compileJava.doLast {
-    }
 }
 
-subprojects {
+configure(javaProjects()) {
     apply id: 'maven'
 
     // Create a source jar for uploading
@@ -121,3 +120,44 @@ subprojects {
 
     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()
+}

+ 0 - 14
docs/faq/build.gradle

@@ -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 - 0
docs/faq/faq.gradle

@@ -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)}
+    }
+}

+ 4 - 6
docs/manual/build.gradle → docs/manual/manual.gradle

@@ -1,19 +1,17 @@
+apply id: 'base'
 apply id: 'docbook'
 
-defaultTasks 'docbookHtml'
-
 docbookSrcFileName = 'springsecurity.xml'
 docbookHtml.stylesheet = new File(projectDir, 'src/xsl/html-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')
     ant {
         docsDir = new File(buildDir, 'docs')
         copy(toDir: docsDir) {fileset(dir: resourcesDir)}
         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')*/

+ 1 - 1
docs/manual/src/docbook/springsecurity.xml

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

+ 14 - 2
settings.gradle

@@ -1,4 +1,4 @@
-String[] modules = [
+def String[] modules = [
     'core',
     'web',
     'ldap',
@@ -9,12 +9,17 @@ String[] modules = [
     'taglibs'
 ]
 
-String[] samples = [
+def String[] samples = [
     'tutorial',
     'contacts',
     'openid'
 ]
 
+def String[] docs = [
+    'faq',
+    'manual'
+]
+
 include modules
 
 modules.each {name ->
@@ -32,6 +37,13 @@ samples.each {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 ->
     assert project.buildFile.isFile()