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 {
|
2019-08-21 02:26:43 +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
|
|
|
|
)
|
2019-08-21 02:26:43 +08:00
|
|
|
classpath += files(moduleProjects.collect { it.sourceSets.main.compileClasspath })
|
|
|
|
}
|
|
|
|
|
|
|
|
options {
|
|
|
|
encoding = "UTF-8"
|
|
|
|
memberLevel = JavadocMemberLevel.PROTECTED
|
|
|
|
author = true
|
|
|
|
header = rootProject.description
|
|
|
|
use = true
|
|
|
|
overview = "src/docs/api/overview.html"
|
|
|
|
stylesheetFile = file("src/docs/api/stylesheet.css")
|
|
|
|
splitIndex = true
|
|
|
|
links(project.ext.javadocLinks)
|
|
|
|
addStringOption('Xdoclint:none', '-quiet')
|
|
|
|
if(JavaVersion.current().isJava9Compatible()) {
|
|
|
|
addBooleanOption('html5', true)
|
|
|
|
}
|
2017-01-05 00:51:58 +08:00
|
|
|
}
|
2019-08-21 02:26:43 +08:00
|
|
|
source moduleProjects.collect { project ->
|
|
|
|
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"
|
|
|
|
*/
|
2017-08-29 06:57:07 +08:00
|
|
|
dokka {
|
|
|
|
dependsOn {
|
2018-04-04 16:54:47 +08:00
|
|
|
tasks.getByName("api")
|
2017-08-29 06:57:07 +08:00
|
|
|
}
|
|
|
|
doFirst {
|
2019-08-21 02:26:43 +08:00
|
|
|
classpath = moduleProjects.collect { project -> project.jar.outputs.files.getFiles() }.flatten()
|
|
|
|
classpath += files(moduleProjects.collect { it.sourceSets.main.compileClasspath })
|
|
|
|
sourceDirs = files(moduleProjects
|
|
|
|
.findAll {
|
|
|
|
it.pluginManager.hasPlugin("kotlin")
|
|
|
|
}
|
|
|
|
.collect { project ->
|
|
|
|
def kotlinDirs = project.sourceSets.main.kotlin.srcDirs.collect()
|
|
|
|
kotlinDirs -= project.sourceSets.main.java.srcDirs
|
|
|
|
})
|
2017-08-29 06:57:07 +08:00
|
|
|
}
|
|
|
|
moduleName = "spring-framework"
|
|
|
|
outputFormat = "html"
|
|
|
|
outputDirectory = "$buildDir/docs/kdoc"
|
|
|
|
|
2018-04-04 16:54:47 +08:00
|
|
|
externalDocumentationLink {
|
|
|
|
url = new URL("https://docs.spring.io/spring-framework/docs/$version/javadoc-api/")
|
2019-08-21 02:26:43 +08:00
|
|
|
packageListUrl = new File(buildDir, "docs/javadoc/package-list").toURI().toURL()
|
2018-04-04 16:54:47 +08:00
|
|
|
}
|
2017-08-29 06:57:07 +08:00
|
|
|
externalDocumentationLink {
|
2019-03-06 06:21:36 +08:00
|
|
|
url = new URL("https://projectreactor.io/docs/core/release/api/")
|
2017-08-29 06:57:07 +08:00
|
|
|
}
|
|
|
|
externalDocumentationLink {
|
2019-03-06 06:21:36 +08:00
|
|
|
url = new URL("https://www.reactive-streams.org/reactive-streams-1.0.1-javadoc/")
|
2017-08-29 06:57:07 +08:00
|
|
|
}
|
2019-04-09 17:55:02 +08:00
|
|
|
externalDocumentationLink {
|
|
|
|
url = new URL("https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/")
|
|
|
|
}
|
2017-08-29 06:57:07 +08:00
|
|
|
}
|
|
|
|
|
2018-11-26 23:18:48 +08:00
|
|
|
configurations {
|
|
|
|
docs
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
// for documentation resources
|
|
|
|
docs "io.spring.docresources:spring-doc-resources:0.1.0.RELEASE@zip"
|
|
|
|
}
|
|
|
|
|
|
|
|
task extractDocResources(type: Sync) {
|
|
|
|
dependsOn configurations.docs
|
|
|
|
from {
|
|
|
|
configurations.docs.collect { zipTree(it) }
|
|
|
|
}
|
2019-08-13 22:29:33 +08:00
|
|
|
from "src/docs/asciidoc/"
|
2018-11-26 23:18:48 +08:00
|
|
|
into "$buildDir/asciidoc/build"
|
|
|
|
}
|
|
|
|
|
2019-08-21 02:26:43 +08:00
|
|
|
/**
|
|
|
|
* Produce the Spring Framework Reference documentation
|
|
|
|
* from "src/docs/asciidoc" into "build/asciidoc/html5"
|
|
|
|
*/
|
2017-08-21 20:41:38 +08:00
|
|
|
asciidoctor {
|
2018-11-26 23:18:48 +08:00
|
|
|
sourceDir "$buildDir/asciidoc/build"
|
2017-08-21 20:41:38 +08:00
|
|
|
sources {
|
|
|
|
include '*.adoc'
|
|
|
|
}
|
2017-10-06 10:23:38 +08:00
|
|
|
resources {
|
|
|
|
from(sourceDir) {
|
2018-11-26 23:18:48 +08:00
|
|
|
include 'images/*', 'css/**', 'js/**'
|
2017-10-06 10:23:38 +08:00
|
|
|
}
|
|
|
|
}
|
2017-08-21 20:41:38 +08:00
|
|
|
logDocuments = true
|
2017-08-21 20:42:21 +08:00
|
|
|
backends = ["html5"]
|
|
|
|
// only ouput PDF documentation for non-SNAPSHOT builds
|
|
|
|
if(!project.getVersion().toString().contains("BUILD-SNAPSHOT")) {
|
|
|
|
backends += "pdf"
|
|
|
|
}
|
2017-08-21 20:41:38 +08:00
|
|
|
options doctype: 'book', eruby: 'erubis'
|
|
|
|
attributes 'icons': 'font',
|
|
|
|
'idprefix': '',
|
|
|
|
'idseparator': '-',
|
2018-11-26 23:18:48 +08:00
|
|
|
docinfo: 'shared',
|
2017-08-21 20:41:38 +08:00
|
|
|
revnumber: project.version,
|
|
|
|
sectanchors: '',
|
|
|
|
sectnums: '',
|
2018-11-26 23:18:48 +08:00
|
|
|
'source-highlighter=highlight.js',
|
|
|
|
'highlightjsdir=js/highlight',
|
|
|
|
'highlightjs-theme=atom-one-dark-reasonable',
|
|
|
|
stylesdir: "css/",
|
2019-08-12 21:39:49 +08:00
|
|
|
stylesheet: 'stylesheet.css',
|
2017-08-21 20:41:38 +08:00
|
|
|
'spring-version': project.version
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-11-26 23:18:48 +08:00
|
|
|
asciidoctor.dependsOn extractDocResources
|
|
|
|
|
2019-08-21 02:26:43 +08:00
|
|
|
/**
|
|
|
|
* Zip all docs (API and reference) into a single archive
|
|
|
|
*/
|
2017-08-29 06:57:07 +08:00
|
|
|
task docsZip(type: Zip, dependsOn: ['api', 'asciidoctor', 'dokka']) {
|
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 " +
|
2019-03-06 06:21:36 +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"
|
|
|
|
}
|
2018-05-10 05:28:10 +08:00
|
|
|
from ("$asciidoctor.outputDir/html5") {
|
2017-01-05 00:51:58 +08:00
|
|
|
into "spring-framework-reference"
|
|
|
|
}
|
2018-05-10 05:28:10 +08:00
|
|
|
from ("$asciidoctor.outputDir/pdf") {
|
|
|
|
into "spring-framework-reference/pdf"
|
|
|
|
}
|
2017-08-29 06:57:07 +08:00
|
|
|
from (dokka) {
|
|
|
|
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
|
|
|
|
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 {
|
2017-01-05 00:51:58 +08:00
|
|
|
it.path.endsWith("META-INF/spring.schemas")
|
|
|
|
}?.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 {
|
2017-01-05 00:51:58 +08:00
|
|
|
it.path.endsWith(schemas.get(key))
|
|
|
|
}
|
|
|
|
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]) {
|
2017-08-21 20:41:38 +08:00
|
|
|
|
2017-01-05 00:51:58 +08:00
|
|
|
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-08-21 02:26:43 +08:00
|
|
|
ext.baseDir = "${archiveBaseName}-${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)
|
|
|
|
}
|
|
|
|
|
|
|
|
from(zipTree(docsZip.archivePath)) {
|
|
|
|
into "${baseDir}/docs"
|
|
|
|
}
|
|
|
|
|
|
|
|
from(zipTree(schemaZip.archivePath)) {
|
|
|
|
into "${baseDir}/schema"
|
|
|
|
}
|
|
|
|
|
2019-08-21 02:26:43 +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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-21 02:26:43 +08:00
|
|
|
distZip.mustRunAfter moduleProjects.check
|