docs.gradle 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. // Docbook and Javadoc building and uploading tasks
  2. apply plugin: 'base'
  3. task docs {
  4. dependsOn 'manual:reference', 'apidocs', 'guides:asciidoctor'
  5. }
  6. project('manual') {
  7. apply plugin: 'base'
  8. apply plugin: 'org.asciidoctor.gradle.asciidoctor'
  9. apply plugin: 'docbook-reference'
  10. ext.expandPlaceholders = ""
  11. asciidoctorj {
  12. version = '1.5.2'
  13. }
  14. asciidoctor {
  15. backends = ['docbook5']
  16. options = [
  17. eruby: 'erubis',
  18. attributes: [
  19. copycss : '',
  20. icons : 'font',
  21. 'source-highlighter': 'prettify',
  22. sectanchors : '',
  23. toc2: '',
  24. idprefix: '',
  25. idseparator: '-',
  26. doctype: 'book',
  27. numbered: '',
  28. 'spring-security-version' : project.version,
  29. 'spring-version' : springVersion,
  30. revnumber : project.version
  31. ]
  32. ]
  33. }
  34. reference {
  35. sourceDir = new File(asciidoctor.outputDir , 'docbook5')
  36. pdfFilename = "spring-security-reference.pdf"
  37. epubFilename = "spring-security-reference.epub"
  38. expandPlaceholders = ""
  39. }
  40. afterEvaluate {
  41. tasks.findAll { it.name.startsWith("reference") }.each{ it.dependsOn.add("asciidoctor") }
  42. }
  43. ext.spec = copySpec {
  44. from (reference) {
  45. into 'reference'
  46. }
  47. }
  48. }
  49. task apidocs(type: Javadoc) {
  50. destinationDir = new File(buildDir, 'apidocs')
  51. title = "Spring Security $version API"
  52. source coreModuleProjects.collect { project ->
  53. project.sourceSets.main.allJava
  54. }
  55. classpath = files(coreModuleProjects.collect { project ->
  56. project.sourceSets.main.compileClasspath
  57. })
  58. }
  59. apidocs.options.outputLevel = org.gradle.external.javadoc.JavadocOutputLevel.QUIET
  60. apidocs.options.links = [
  61. "http://static.springframework.org/spring/docs/3.2.x/javadoc-api",
  62. "http://static.springsource.org/spring-ldap/docs/1.3.x/apidocs/",
  63. "http://download.oracle.com/javase/6/docs/api/"
  64. ]
  65. apidocs.options.groups = [
  66. 'Spring Security Core':[
  67. 'org.springframework.security.core*',
  68. 'org.springframework.security.authentication*',
  69. 'org.springframework.security.access*',
  70. 'org.springframework.security.remoting*',
  71. 'org.springframework.security.provisioning*',
  72. 'org.springframework.security.util*'],
  73. 'Spring Security Web':['org.springframework.security.web*'],
  74. 'Spring Security LDAP':['org.springframework.security.ldap*'],
  75. 'Spring Security Crypto':['org.springframework.security.crypto*'],
  76. 'Spring Security OpenID':['org.springframework.security.openid*'],
  77. 'Spring Security CAS':['org.springframework.security.cas*'],
  78. 'Spring Security ACL':['org.springframework.security.acls*'],
  79. 'Spring Security Config':['org.springframework.security.config*'],
  80. 'Spring Security Taglibs':['org.springframework.security.taglibs*'],
  81. ]
  82. ext.apiSpec = copySpec {
  83. into('apidocs') {
  84. from(apidocs.destinationDir)
  85. }
  86. }
  87. assemble.dependsOn = [apidocs, 'manual:asciidoctor']
  88. task docsZip(type: Zip) {
  89. dependsOn docs
  90. evaluationDependsOn('guides')
  91. group = 'Distribution'
  92. baseName = rootProject.name
  93. classifier = 'docs'
  94. description = "Builds -${classifier} archive containing api and reference " +
  95. "for deployment at static.springframework.org/spring-security/site/docs."
  96. with(project(':docs').apiSpec)
  97. with(project(':docs:manual').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. }