2
0

docs.gradle 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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. docinfo : ""
  32. ]
  33. ]
  34. }
  35. reference {
  36. sourceDir = new File(asciidoctor.outputDir , 'docbook5')
  37. pdfFilename = "spring-security-reference.pdf"
  38. epubFilename = "spring-security-reference.epub"
  39. expandPlaceholders = ""
  40. }
  41. afterEvaluate {
  42. tasks.findAll { it.name.startsWith("reference") }.each{ it.dependsOn.add("asciidoctor") }
  43. }
  44. ext.spec = copySpec {
  45. from (reference) {
  46. into 'reference'
  47. }
  48. }
  49. }
  50. task apidocs(type: Javadoc) {
  51. destinationDir = new File(buildDir, 'apidocs')
  52. title = "Spring Security $version API"
  53. logging.captureStandardError LogLevel.INFO
  54. logging.captureStandardOutput LogLevel.INFO
  55. source coreModuleProjects.collect { project ->
  56. project.sourceSets.main.allJava
  57. }
  58. classpath = files(coreModuleProjects.collect { project ->
  59. project.sourceSets.main.compileClasspath
  60. })
  61. options {
  62. outputLevel = org.gradle.external.javadoc.JavadocOutputLevel.QUIET
  63. links = [
  64. "http://static.springframework.org/spring/docs/3.2.x/javadoc-api",
  65. "http://static.springsource.org/spring-ldap/docs/1.3.x/apidocs/",
  66. "http://download.oracle.com/javase/6/docs/api/"
  67. ]
  68. groups = [
  69. 'Spring Security Core':[
  70. 'org.springframework.security.core*',
  71. 'org.springframework.security.authentication*',
  72. 'org.springframework.security.access*',
  73. 'org.springframework.security.remoting*',
  74. 'org.springframework.security.provisioning*',
  75. 'org.springframework.security.util*'],
  76. 'Spring Security Web':['org.springframework.security.web*'],
  77. 'Spring Security LDAP':['org.springframework.security.ldap*'],
  78. 'Spring Security Crypto':['org.springframework.security.crypto*'],
  79. 'Spring Security OpenID':['org.springframework.security.openid*'],
  80. 'Spring Security CAS':['org.springframework.security.cas*'],
  81. 'Spring Security ACL':['org.springframework.security.acls*'],
  82. 'Spring Security Config':['org.springframework.security.config*'],
  83. 'Spring Security Taglibs':['org.springframework.security.taglibs*'],
  84. ]
  85. addStringOption('-quiet')
  86. }
  87. }
  88. if (JavaVersion.current().isJava8Compatible()) {
  89. // Turn off doclint in JDK 8 Javadoc (too strict on checks)
  90. apidocs.options.addStringOption('Xdoclint:none', '-quiet')
  91. }
  92. ext.apiSpec = copySpec {
  93. into('apidocs') {
  94. from(apidocs.destinationDir)
  95. }
  96. }
  97. assemble.dependsOn = [apidocs, 'manual:asciidoctor']
  98. task docsZip(type: Zip) {
  99. dependsOn docs
  100. evaluationDependsOn('guides')
  101. group = 'Distribution'
  102. baseName = rootProject.name
  103. classifier = 'docs'
  104. description = "Builds -${classifier} archive containing api and reference " +
  105. "for deployment at static.springframework.org/spring-security/site/docs."
  106. with(project(':docs').apiSpec)
  107. with(project(':docs:manual').spec)
  108. with(project(':docs:guides').spec)
  109. }
  110. task schemaZip(type: Zip) {
  111. group = 'Distribution'
  112. baseName = rootProject.name
  113. classifier = 'schema'
  114. description = "Builds -${classifier} archive containing all " +
  115. "XSDs for deployment at static.springframework.org/schema."
  116. coreModuleProjects.each { module ->
  117. def Properties schemas = new Properties();
  118. module.sourceSets.main.resources.find {
  119. it.path.endsWith('META-INF/spring.schemas')
  120. }?.withInputStream { schemas.load(it) }
  121. for (def key : schemas.keySet()) {
  122. def shortName = key.replaceAll(/http.*schema.(.*).spring-.*/, '$1')
  123. assert shortName != key
  124. File xsdFile = module.sourceSets.main.resources.find {
  125. it.path.endsWith(schemas.get(key))
  126. }
  127. assert xsdFile != null
  128. into (shortName) {
  129. from xsdFile.path
  130. }
  131. }
  132. }
  133. }