You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
129 lines
3.5 KiB
129 lines
3.5 KiB
plugins { |
|
id 'java-platform' |
|
id 'io.freefair.aggregate-javadoc' version '8.13.1' |
|
id 'org.jetbrains.dokka' |
|
} |
|
|
|
description = "Spring Framework API Docs" |
|
|
|
apply from: "${rootDir}/gradle/publications.gradle" |
|
|
|
repositories { |
|
maven { |
|
url = "https://repo.spring.io/release" |
|
} |
|
} |
|
|
|
dependencies { |
|
moduleProjects.each { moduleProject -> |
|
javadoc moduleProject |
|
} |
|
} |
|
|
|
javadoc { |
|
javadocTool.set(javaToolchains.javadocToolFor({ |
|
languageVersion = JavaLanguageVersion.of(25) |
|
})) |
|
|
|
title = "${rootProject.description} ${version} API" |
|
failOnError = true |
|
options { |
|
encoding = "UTF-8" |
|
memberLevel = JavadocMemberLevel.PROTECTED |
|
author = true |
|
header = rootProject.description |
|
use = true |
|
overview = project.relativePath("$rootProject.rootDir/framework-docs/src/docs/api/overview.html") |
|
destinationDir = project.java.docsDir.dir("javadoc-api").get().asFile |
|
splitIndex = true |
|
links(rootProject.ext.javadocLinks) |
|
// Check for 'syntax' and 'reference' during linting. |
|
addBooleanOption('Xdoclint:syntax,reference', true) |
|
// Change modularity mismatch from warn to info. |
|
// See https://github.com/spring-projects/spring-framework/issues/27497 |
|
addStringOption("-link-modularity-mismatch", "info") |
|
// Fail build on Javadoc warnings. |
|
addBooleanOption('Werror', true) |
|
} |
|
maxMemory = "1024m" |
|
doFirst { |
|
classpath += files( |
|
// ensure the javadoc process can resolve types compiled from .aj sources |
|
project(":spring-aspects").sourceSets.main.output |
|
) |
|
classpath += files(moduleProjects.collect { it.sourceSets.main.compileClasspath }) |
|
} |
|
} |
|
|
|
dokka { |
|
moduleName = "spring-framework" |
|
dokkaPublications.html { |
|
outputDirectory = project.java.docsDir.dir("kdoc-api") |
|
includes.from("$rootProject.rootDir/framework-docs/src/docs/api/dokka-overview.md") |
|
} |
|
} |
|
|
|
/** |
|
* Zip all Java docs (javadoc & kdoc) into a single archive |
|
*/ |
|
tasks.register('docsZip', Zip) { |
|
dependsOn = ['javadoc', 'dokkaGenerate'] |
|
group = "distribution" |
|
description = "Builds -${archiveClassifier} archive containing api and reference " + |
|
"for deployment at https://docs.spring.io/spring-framework/docs/." |
|
|
|
archiveBaseName.set("spring-framework") |
|
archiveClassifier.set("docs") |
|
from("src/dist") { |
|
include "changelog.txt" |
|
} |
|
from(javadoc) { |
|
into "javadoc-api" |
|
} |
|
from(project.java.docsDir.dir("kdoc-api")) { |
|
into "kdoc-api" |
|
} |
|
} |
|
|
|
/** |
|
* Zip all Spring Framework schemas into a single archive |
|
*/ |
|
tasks.register('schemaZip', Zip) { |
|
group = "distribution" |
|
archiveBaseName.set("spring-framework") |
|
archiveClassifier.set("schema") |
|
description = "Builds -${archiveClassifier} archive containing all " + |
|
"XSDs for deployment at https://springframework.org/schema." |
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE |
|
moduleProjects.each { module -> |
|
def Properties schemas = new Properties(); |
|
|
|
def schemaFile = module.sourceSets.main.resources.find { |
|
(it.path.endsWith("META-INF/spring.schemas") || it.path.endsWith("META-INF\\spring.schemas")) |
|
} |
|
if (schemaFile != null) { |
|
schemaFile.withInputStream { schemas.load(it) } |
|
} |
|
|
|
for (def key : schemas.keySet()) { |
|
def shortName = key.replaceAll(/http.*schema.(.*).spring-.*/, '$1') |
|
assert shortName != key |
|
File xsdFile = module.sourceSets.main.resources.find { |
|
(it.path.endsWith(schemas.get(key)) || it.path.endsWith(schemas.get(key).replaceAll('\\/', '\\\\'))) |
|
} |
|
assert xsdFile != null |
|
into(shortName) { |
|
from xsdFile.path |
|
} |
|
} |
|
} |
|
} |
|
|
|
publishing { |
|
publications { |
|
mavenJava(MavenPublication) { |
|
artifact docsZip |
|
artifact schemaZip |
|
} |
|
} |
|
}
|
|
|