docs.gradle 4.5 KB

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