docs.gradle 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. // Docbook and Javadoc building and uploading tasks
  2. apply plugin: 'base'
  3. task docs {
  4. dependsOn 'manual:docbook', 'faq:docbookHtmlSingle', 'apidocs'
  5. }
  6. subprojects {
  7. apply plugin: 'base'
  8. apply plugin: 'docbook'
  9. docbookHtmlSingle.stylesheet = new File(projectDir, 'src/xsl/html-single-custom.xsl')
  10. }
  11. project('faq') {
  12. defaultTasks 'docbookHtmlSingle'
  13. [docbookHtml, docbookFoPdf, docbookHtmlSingle]*.sourceFileName = 'faq.xml'
  14. docbookHtmlSingle.suffix = ''
  15. ext.spec = copySpec {
  16. into ('faq') {
  17. from("$buildDir/docs")
  18. from("$projectDir/src/resources")
  19. }
  20. }
  21. }
  22. project('manual') {
  23. defaultTasks 'docbookHtml', 'docbookHtmlSingle', 'docbookFoPdf'
  24. [docbookHtml, docbookFoPdf, docbookHtmlSingle]*.sourceFileName = 'springsecurity.xml'
  25. docbookHtml.stylesheet = new File(projectDir, 'src/xsl/html-custom.xsl')
  26. docbookHtmlSingle.stylesheet = new File(projectDir, 'src/xsl/html-single-custom.xsl')
  27. docbookFoPdf.stylesheet = new File(projectDir, 'src/xsl/pdf-custom.xsl')
  28. def imagesDir = new File(projectDir, 'src/docbook/images');
  29. // docbookFoPdf.admonGraphicsPath = "${imagesDir}/"
  30. docbookFoPdf.imgSrcPath = "${projectDir}/src/docbook/"
  31. ext.spec = copySpec {
  32. into ('reference') {
  33. from("$buildDir/docs")
  34. from("$projectDir/src/resources")
  35. }
  36. into ('reference/images') {
  37. from (imagesDir)
  38. }
  39. }
  40. }
  41. task reference (type: Copy) {
  42. dependsOn 'manual:docbook'
  43. destinationDir = buildDir
  44. with(project('manual').spec)
  45. }
  46. task apidocs(type: Javadoc) {
  47. destinationDir = new File(buildDir, 'apidocs')
  48. title = "Spring Security $version API"
  49. source coreModuleProjects.collect { project ->
  50. project.sourceSets.main.allJava
  51. }
  52. classpath = files(coreModuleProjects.collect { project ->
  53. project.sourceSets.main.compileClasspath
  54. })
  55. }
  56. apidocs.options.outputLevel = org.gradle.external.javadoc.JavadocOutputLevel.QUIET
  57. apidocs.options.links = [
  58. "http://static.springframework.org/spring/docs/3.0.x/javadoc-api",
  59. "http://static.springsource.org/spring-ldap/docs/1.3.x/apidocs/",
  60. "http://download.oracle.com/javase/6/docs/api/"
  61. ]
  62. apidocs.options.groups = [
  63. 'Spring Security Core':[
  64. 'org.springframework.security.core*',
  65. 'org.springframework.security.authentication*',
  66. 'org.springframework.security.access*',
  67. 'org.springframework.security.remoting*',
  68. 'org.springframework.security.provisioning*',
  69. 'org.springframework.security.util*'],
  70. 'Spring Security Web':['org.springframework.security.web*'],
  71. 'Spring Security LDAP':['org.springframework.security.ldap*'],
  72. 'Spring Security Crypto':['org.springframework.security.crypto*'],
  73. 'Spring Security OpenID':['org.springframework.security.openid*'],
  74. 'Spring Security CAS':['org.springframework.security.cas*'],
  75. 'Spring Security ACL':['org.springframework.security.acls*'],
  76. 'Spring Security Config':['org.springframework.security.config*'],
  77. 'Spring Security Taglibs':['org.springframework.security.taglibs*'],
  78. ]
  79. ext.apiSpec = copySpec {
  80. into('apidocs') {
  81. from(apidocs.destinationDir)
  82. }
  83. }
  84. assemble.dependsOn = [apidocs, 'manual:docbook']
  85. task docsZip(type: Zip) {
  86. dependsOn docs
  87. group = 'Distribution'
  88. baseName = rootProject.name
  89. classifier = 'docs'
  90. description = "Builds -${classifier} archive containing api and reference " +
  91. "for deployment at static.springframework.org/spring-security/site/docs."
  92. with(project(':docs').apiSpec)
  93. with(project(':docs:manual').spec)
  94. with(project(':docs:faq').spec)
  95. }
  96. task schemaZip(type: Zip) {
  97. group = 'Distribution'
  98. baseName = rootProject.name
  99. classifier = 'schema'
  100. description = "Builds -${classifier} archive containing all " +
  101. "XSDs for deployment at static.springframework.org/schema."
  102. coreModuleProjects.each { module ->
  103. def Properties schemas = new Properties();
  104. module.sourceSets.main.resources.find {
  105. it.path.endsWith('META-INF/spring.schemas')
  106. }?.withInputStream { schemas.load(it) }
  107. for (def key : schemas.keySet()) {
  108. def shortName = key.replaceAll(/http.*schema.(.*).spring-.*/, '$1')
  109. assert shortName != key
  110. File xsdFile = module.sourceSets.main.resources.find {
  111. it.path.endsWith(schemas.get(key))
  112. }
  113. assert xsdFile != null
  114. into (shortName) {
  115. from xsdFile.path
  116. }
  117. }
  118. }
  119. }