docs.gradle 4.4 KB

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