2022-11-02 17:48:38 +08:00
|
|
|
description = "Spring Framework Docs"
|
|
|
|
|
|
|
|
apply plugin: 'kotlin'
|
|
|
|
apply plugin: 'org.asciidoctor.jvm.convert'
|
|
|
|
apply plugin: 'org.asciidoctor.jvm.pdf'
|
|
|
|
apply from: "${rootDir}/gradle/publications.gradle"
|
|
|
|
|
|
|
|
|
2019-12-16 17:03:40 +08:00
|
|
|
configurations {
|
2022-09-16 05:12:41 +08:00
|
|
|
asciidoctorExtensions
|
2019-12-16 17:03:40 +08:00
|
|
|
}
|
|
|
|
|
2022-11-02 17:48:38 +08:00
|
|
|
jar {
|
|
|
|
enabled = false
|
|
|
|
}
|
|
|
|
|
|
|
|
javadoc {
|
|
|
|
enabled = false
|
|
|
|
}
|
|
|
|
|
2019-12-16 17:03:40 +08:00
|
|
|
dependencies {
|
2022-09-16 05:12:41 +08:00
|
|
|
asciidoctorExtensions "io.spring.asciidoctor.backends:spring-asciidoctor-backends:0.0.3"
|
2020-02-07 19:16:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
maven {
|
|
|
|
url "https://repo.spring.io/release"
|
|
|
|
}
|
2019-12-16 17:03:40 +08:00
|
|
|
}
|
|
|
|
|
2019-08-21 02:26:43 +08:00
|
|
|
/**
|
|
|
|
* Produce Javadoc for all Spring Framework modules in "build/docs/javadoc"
|
2017-01-05 00:51:58 +08:00
|
|
|
*/
|
|
|
|
task api(type: Javadoc) {
|
|
|
|
group = "Documentation"
|
|
|
|
description = "Generates aggregated Javadoc API documentation."
|
|
|
|
title = "${rootProject.description} ${version} API"
|
|
|
|
|
|
|
|
dependsOn {
|
2022-07-28 16:43:26 +08:00
|
|
|
moduleProjects.collect {
|
2017-01-05 00:51:58 +08:00
|
|
|
it.tasks.getByName("jar")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
doFirst {
|
|
|
|
classpath = files(
|
|
|
|
// ensure the javadoc process can resolve types compiled from .aj sources
|
|
|
|
project(":spring-aspects").sourceSets.main.output
|
|
|
|
)
|
2022-07-28 16:43:26 +08:00
|
|
|
classpath += files(moduleProjects.collect { it.sourceSets.main.compileClasspath })
|
2019-08-21 02:26:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
options {
|
|
|
|
encoding = "UTF-8"
|
|
|
|
memberLevel = JavadocMemberLevel.PROTECTED
|
|
|
|
author = true
|
|
|
|
header = rootProject.description
|
|
|
|
use = true
|
2022-11-02 17:48:38 +08:00
|
|
|
overview = "framework-docs/src/docs/api/overview.html"
|
2019-08-21 02:26:43 +08:00
|
|
|
splitIndex = true
|
|
|
|
links(project.ext.javadocLinks)
|
2021-09-29 20:02:37 +08:00
|
|
|
addBooleanOption('Xdoclint:syntax', true) // only check syntax with doclint
|
2021-09-29 22:56:33 +08:00
|
|
|
addBooleanOption('Werror', true) // fail build on Javadoc warnings
|
2017-01-05 00:51:58 +08:00
|
|
|
}
|
2022-07-28 16:43:26 +08:00
|
|
|
source moduleProjects.collect { project ->
|
2019-08-21 02:26:43 +08:00
|
|
|
project.sourceSets.main.allJava
|
|
|
|
}
|
|
|
|
maxMemory = "1024m"
|
|
|
|
destinationDir = file("$buildDir/docs/javadoc")
|
2017-01-05 00:51:58 +08:00
|
|
|
}
|
|
|
|
|
2019-08-21 02:26:43 +08:00
|
|
|
/**
|
|
|
|
* Produce KDoc for all Spring Framework modules in "build/docs/kdoc"
|
|
|
|
*/
|
2022-11-02 17:48:38 +08:00
|
|
|
rootProject.tasks.dokkaHtmlMultiModule.configure {
|
|
|
|
dependsOn {
|
|
|
|
tasks.getByName("api")
|
2017-08-29 06:57:07 +08:00
|
|
|
}
|
2022-11-02 17:48:38 +08:00
|
|
|
moduleName.set("spring-framework")
|
|
|
|
outputDirectory.set(project.file("$buildDir/docs/kdoc"))
|
2021-05-22 03:16:30 +08:00
|
|
|
}
|
2017-08-29 06:57:07 +08:00
|
|
|
|
2019-12-16 17:03:40 +08:00
|
|
|
asciidoctorj {
|
2022-09-19 19:00:42 +08:00
|
|
|
version = '2.4.3'
|
2020-01-25 05:48:56 +08:00
|
|
|
fatalWarnings ".*"
|
2020-09-18 23:58:25 +08:00
|
|
|
options doctype: 'book', eruby: 'erubis'
|
|
|
|
attributes([
|
|
|
|
icons: 'font',
|
|
|
|
idprefix: '',
|
|
|
|
idseparator: '-',
|
|
|
|
revnumber: project.version,
|
|
|
|
sectanchors: '',
|
|
|
|
sectnums: '',
|
2022-11-17 22:35:28 +08:00
|
|
|
'spring-version': project.version
|
2020-09-18 23:58:25 +08:00
|
|
|
])
|
2019-12-16 17:03:40 +08:00
|
|
|
}
|
|
|
|
|
2019-08-21 02:26:43 +08:00
|
|
|
/**
|
2022-11-02 17:48:38 +08:00
|
|
|
* Generate the Spring Framework Reference documentation from
|
|
|
|
* "src/docs/asciidoc" in "build/docs/ref-docs/html5".
|
2019-08-21 02:26:43 +08:00
|
|
|
*/
|
2017-08-21 20:41:38 +08:00
|
|
|
asciidoctor {
|
2019-12-16 17:03:40 +08:00
|
|
|
baseDirFollowsSourceDir()
|
2022-09-16 05:12:41 +08:00
|
|
|
configurations "asciidoctorExtensions"
|
2017-08-21 20:41:38 +08:00
|
|
|
sources {
|
|
|
|
include '*.adoc'
|
|
|
|
}
|
2020-09-18 23:58:25 +08:00
|
|
|
outputDir "$buildDir/docs/ref-docs/html5"
|
2022-09-16 05:12:41 +08:00
|
|
|
outputOptions {
|
|
|
|
backends "spring-html"
|
|
|
|
}
|
2020-09-18 23:58:25 +08:00
|
|
|
logDocuments = true
|
2017-10-06 10:23:38 +08:00
|
|
|
resources {
|
|
|
|
from(sourceDir) {
|
2022-09-19 19:00:42 +08:00
|
|
|
include 'images/*.png'
|
2017-10-06 10:23:38 +08:00
|
|
|
}
|
|
|
|
}
|
2020-09-18 23:58:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Generate the Spring Framework Reference documentation from "src/docs/asciidoc"
|
|
|
|
* in "build/docs/ref-docs/pdf".
|
|
|
|
*/
|
|
|
|
asciidoctorPdf {
|
|
|
|
baseDirFollowsSourceDir()
|
2022-09-16 05:12:41 +08:00
|
|
|
configurations 'asciidoctorExtensions'
|
2020-09-18 23:58:25 +08:00
|
|
|
sources {
|
2022-11-06 21:56:53 +08:00
|
|
|
include 'spring-framework.adocbook'
|
2017-08-21 20:42:21 +08:00
|
|
|
}
|
2020-09-18 23:58:25 +08:00
|
|
|
outputDir "$buildDir/docs/ref-docs/pdf"
|
2022-09-19 19:00:42 +08:00
|
|
|
forkOptions {
|
|
|
|
jvmArgs += ["--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED", "--add-opens", "java.base/java.io=ALL-UNNAMED"]
|
|
|
|
}
|
2020-09-18 23:58:25 +08:00
|
|
|
logDocuments = true
|
2017-08-21 20:41:38 +08:00
|
|
|
}
|
|
|
|
|
2019-08-21 02:26:43 +08:00
|
|
|
/**
|
|
|
|
* Zip all docs (API and reference) into a single archive
|
|
|
|
*/
|
2022-11-02 17:48:38 +08:00
|
|
|
task docsZip(type: Zip, dependsOn: ['api', 'asciidoctor', 'asciidoctorPdf', rootProject.tasks.dokkaHtmlMultiModule]) {
|
2017-01-05 00:51:58 +08:00
|
|
|
group = "Distribution"
|
2019-08-21 02:26:43 +08:00
|
|
|
description = "Builds -${archiveClassifier} archive containing api and reference " +
|
2022-07-26 21:45:12 +08:00
|
|
|
"for deployment at https://docs.spring.io/spring-framework/docs/."
|
2017-01-05 00:51:58 +08:00
|
|
|
|
2019-08-21 02:26:43 +08:00
|
|
|
archiveBaseName.set("spring-framework")
|
|
|
|
archiveClassifier.set("docs")
|
2017-01-05 00:51:58 +08:00
|
|
|
from("src/dist") {
|
|
|
|
include "changelog.txt"
|
|
|
|
}
|
|
|
|
from (api) {
|
|
|
|
into "javadoc-api"
|
|
|
|
}
|
2020-09-24 23:49:37 +08:00
|
|
|
from ("$asciidoctor.outputDir") {
|
2020-09-13 00:12:36 +08:00
|
|
|
into "reference/html"
|
2017-01-05 00:51:58 +08:00
|
|
|
}
|
2020-09-24 23:49:37 +08:00
|
|
|
from ("$asciidoctorPdf.outputDir") {
|
2020-09-13 00:12:36 +08:00
|
|
|
into "reference/pdf"
|
2018-05-10 05:28:10 +08:00
|
|
|
}
|
2022-11-02 17:48:38 +08:00
|
|
|
from (rootProject.tasks.dokkaHtmlMultiModule.outputDirectory) {
|
2017-08-29 06:57:07 +08:00
|
|
|
into "kdoc-api"
|
|
|
|
}
|
2017-01-05 00:51:58 +08:00
|
|
|
}
|
|
|
|
|
2019-08-21 02:26:43 +08:00
|
|
|
/**
|
|
|
|
* Zip all Spring Framework schemas into a single archive
|
|
|
|
*/
|
2017-01-05 00:51:58 +08:00
|
|
|
task schemaZip(type: Zip) {
|
|
|
|
group = "Distribution"
|
2019-08-21 02:26:43 +08:00
|
|
|
archiveBaseName.set("spring-framework")
|
|
|
|
archiveClassifier.set("schema")
|
|
|
|
description = "Builds -${archiveClassifier} archive containing all " +
|
2019-03-06 06:21:36 +08:00
|
|
|
"XSDs for deployment at https://springframework.org/schema."
|
2019-08-21 02:26:43 +08:00
|
|
|
duplicatesStrategy DuplicatesStrategy.EXCLUDE
|
2022-07-28 16:43:26 +08:00
|
|
|
moduleProjects.each { module ->
|
2017-01-05 00:51:58 +08:00
|
|
|
def Properties schemas = new Properties();
|
|
|
|
|
2019-08-21 02:26:43 +08:00
|
|
|
module.sourceSets.main.resources.find {
|
2019-11-05 16:44:23 +08:00
|
|
|
(it.path.endsWith("META-INF/spring.schemas") || it.path.endsWith("META-INF\\spring.schemas"))
|
2017-01-05 00:51:58 +08:00
|
|
|
}?.withInputStream { schemas.load(it) }
|
|
|
|
|
|
|
|
for (def key : schemas.keySet()) {
|
|
|
|
def shortName = key.replaceAll(/http.*schema.(.*).spring-.*/, '$1')
|
|
|
|
assert shortName != key
|
2019-08-21 02:26:43 +08:00
|
|
|
File xsdFile = module.sourceSets.main.resources.find {
|
2019-11-05 16:44:23 +08:00
|
|
|
(it.path.endsWith(schemas.get(key)) || it.path.endsWith(schemas.get(key).replaceAll('\\/','\\\\')))
|
2017-01-05 00:51:58 +08:00
|
|
|
}
|
|
|
|
assert xsdFile != null
|
|
|
|
into (shortName) {
|
|
|
|
from xsdFile.path
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-21 02:26:43 +08:00
|
|
|
/**
|
|
|
|
* Create a distribution zip with everything:
|
|
|
|
* docs, schemas, jars, source jars, javadoc jars
|
|
|
|
*/
|
2017-01-05 00:51:58 +08:00
|
|
|
task distZip(type: Zip, dependsOn: [docsZip, schemaZip]) {
|
|
|
|
group = "Distribution"
|
2019-08-21 02:26:43 +08:00
|
|
|
archiveBaseName.set("spring-framework")
|
|
|
|
archiveClassifier.set("dist")
|
|
|
|
description = "Builds -${archiveClassifier} archive, containing all jars and docs, " +
|
2017-01-05 00:51:58 +08:00
|
|
|
"suitable for community download page."
|
|
|
|
|
2019-10-02 16:00:33 +08:00
|
|
|
ext.baseDir = "spring-framework-${project.version}";
|
2017-01-05 00:51:58 +08:00
|
|
|
|
|
|
|
from("src/docs/dist") {
|
|
|
|
include "readme.txt"
|
|
|
|
include "license.txt"
|
|
|
|
include "notice.txt"
|
|
|
|
into "${baseDir}"
|
|
|
|
expand(copyright: new Date().format("yyyy"), version: project.version)
|
|
|
|
}
|
|
|
|
|
2021-09-13 15:36:07 +08:00
|
|
|
from(zipTree(docsZip.archiveFile)) {
|
2017-01-05 00:51:58 +08:00
|
|
|
into "${baseDir}/docs"
|
|
|
|
}
|
|
|
|
|
2021-09-13 15:36:07 +08:00
|
|
|
from(zipTree(schemaZip.archiveFile)) {
|
2017-01-05 00:51:58 +08:00
|
|
|
into "${baseDir}/schema"
|
|
|
|
}
|
|
|
|
|
2022-07-28 16:43:26 +08:00
|
|
|
moduleProjects.each { module ->
|
2017-01-05 00:51:58 +08:00
|
|
|
into ("${baseDir}/libs") {
|
2019-08-21 02:26:43 +08:00
|
|
|
from module.jar
|
|
|
|
if (module.tasks.findByPath("sourcesJar")) {
|
|
|
|
from module.sourcesJar
|
2017-01-05 00:51:58 +08:00
|
|
|
}
|
2019-08-21 02:26:43 +08:00
|
|
|
if (module.tasks.findByPath("javadocJar")) {
|
|
|
|
from module.javadocJar
|
2017-01-05 00:51:58 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-28 16:43:26 +08:00
|
|
|
distZip.mustRunAfter moduleProjects.check
|
2022-11-02 17:48:38 +08:00
|
|
|
|
|
|
|
|
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
mavenJava(MavenPublication) {
|
|
|
|
artifact docsZip
|
|
|
|
artifact schemaZip
|
|
|
|
artifact distZip
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|