docs.gradle 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. // Docbook and Javadoc building and uploading tasks
  2. apply plugin: 'base'
  3. apply from: "$rootDir/gradle/deploy-docs.gradle"
  4. apply from: "$rootDir/gradle/deploy-schema.gradle"
  5. task docs {
  6. dependsOn 'manual:reference', 'apidocs', 'guides:asciidoctor'
  7. }
  8. project('manual') {
  9. apply plugin: 'base'
  10. apply plugin: 'org.asciidoctor.gradle.asciidoctor'
  11. apply plugin: 'docbook-reference'
  12. ext.expandPlaceholders = ""
  13. asciidoctorj {
  14. version = '1.5.2'
  15. }
  16. asciidoctor {
  17. backends = ['docbook5']
  18. def ghTag = snapshotBuild ? 'master' : project.version
  19. def ghUrl = "https://github.com/spring-projects/spring-security/tree/$ghTag"
  20. options = [
  21. eruby: 'erubis',
  22. attributes: [
  23. copycss : '',
  24. icons : 'font',
  25. 'source-highlighter': 'prettify',
  26. sectanchors : '',
  27. toc2: '',
  28. idprefix: '',
  29. idseparator: '-',
  30. doctype: 'book',
  31. numbered: '',
  32. 'spring-security-version' : project.version,
  33. 'spring-version' : springVersion,
  34. revnumber : project.version,
  35. 'gh-url': ghUrl,
  36. 'gh-samples-url': "$ghUrl/samples",
  37. docinfo : ""
  38. ]
  39. ]
  40. }
  41. reference {
  42. sourceDir = new File(asciidoctor.outputDir , 'docbook5')
  43. pdfFilename = "spring-security-reference.pdf"
  44. epubFilename = "spring-security-reference.epub"
  45. expandPlaceholders = ""
  46. }
  47. afterEvaluate {
  48. tasks.findAll { it.name.startsWith("reference") }.each{ it.dependsOn.add("asciidoctor") }
  49. }
  50. ext.spec = copySpec {
  51. from (reference) {
  52. into 'reference'
  53. }
  54. }
  55. }
  56. task apidocs(type: Javadoc) {
  57. destinationDir = new File(buildDir, 'apidocs')
  58. title = "Spring Security $version API"
  59. logging.captureStandardError LogLevel.INFO
  60. logging.captureStandardOutput LogLevel.INFO
  61. source coreModuleProjects.collect { project ->
  62. project.sourceSets.main.allJava
  63. }
  64. classpath = files(coreModuleProjects.collect { project ->
  65. project.sourceSets.main.compileClasspath
  66. })
  67. options {
  68. outputLevel = org.gradle.external.javadoc.JavadocOutputLevel.QUIET
  69. links = [
  70. "https://docs.spring.io/spring/docs/3.2.x/javadoc-api",
  71. "https://docs.spring.io/spring-ldap/docs/1.3.x/apidocs/",
  72. "https://download.oracle.com/javase/6/docs/api/"
  73. ]
  74. groups = [
  75. 'Spring Security Core':[
  76. 'org.springframework.security.core*',
  77. 'org.springframework.security.authentication*',
  78. 'org.springframework.security.access*',
  79. 'org.springframework.security.remoting*',
  80. 'org.springframework.security.provisioning*',
  81. 'org.springframework.security.util*'],
  82. 'Spring Security Web':['org.springframework.security.web*'],
  83. 'Spring Security LDAP':['org.springframework.security.ldap*'],
  84. 'Spring Security Crypto':['org.springframework.security.crypto*'],
  85. 'Spring Security OpenID':['org.springframework.security.openid*'],
  86. 'Spring Security CAS':['org.springframework.security.cas*'],
  87. 'Spring Security ACL':['org.springframework.security.acls*'],
  88. 'Spring Security Config':['org.springframework.security.config*'],
  89. 'Spring Security Taglibs':['org.springframework.security.taglibs*'],
  90. ]
  91. addStringOption('-quiet')
  92. }
  93. }
  94. if (JavaVersion.current().isJava8Compatible()) {
  95. // Turn off doclint in JDK 8 Javadoc (too strict on checks)
  96. apidocs.options.addStringOption('Xdoclint:none', '-quiet')
  97. }
  98. ext.apiSpec = copySpec {
  99. into('apidocs') {
  100. from(apidocs.destinationDir)
  101. }
  102. }
  103. assemble.dependsOn = [apidocs, 'manual:asciidoctor']
  104. task docsZip(type: Zip) {
  105. dependsOn docs
  106. evaluationDependsOn('guides')
  107. group = 'Distribution'
  108. baseName = rootProject.name
  109. classifier = 'docs'
  110. description = "Builds -${classifier} archive containing api and reference " +
  111. "for deployment at static.springframework.org/spring-security/site/docs."
  112. with(project(':docs').apiSpec)
  113. with(project(':docs:manual').spec)
  114. with(project(':docs:guides').spec)
  115. }
  116. task schemaZip(type: Zip) {
  117. group = 'Distribution'
  118. baseName = rootProject.name
  119. classifier = 'schema'
  120. description = "Builds -${classifier} archive containing all " +
  121. "XSDs for deployment at static.springframework.org/schema."
  122. coreModuleProjects.each { module ->
  123. def Properties schemas = new Properties();
  124. module.sourceSets.main.resources.find {
  125. it.path.endsWith('META-INF/spring.schemas')
  126. }?.withInputStream { schemas.load(it) }
  127. for (def key : schemas.keySet()) {
  128. def shortName = key.replaceAll(/http.*schema.(.*).spring-.*/, '$1')
  129. assert shortName != key
  130. File xsdFile = module.sourceSets.main.resources.find {
  131. it.path.endsWith(schemas.get(key))
  132. }
  133. assert xsdFile != null
  134. into (shortName) {
  135. duplicatesStrategy 'exclude'
  136. from xsdFile.path
  137. }
  138. }
  139. }
  140. }