You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
spring-boot/spring-boot-project/spring-boot-docs/build.gradle

434 lines
18 KiB
Groovy

plugins {
id "java"
id "groovy"
id "org.asciidoctor.jvm.convert"
id "org.springframework.boot.conventions"
id "org.springframework.boot.deployed"
id 'org.jetbrains.kotlin.jvm'
}
description = "Spring Boot Docs"
configurations {
actuatorApiDocumentation
autoConfiguration
configurationProperties
gradlePluginDocumentation
mavenPluginDocumentation
testSlices
}
jar {
enabled = false
}
javadoc {
enabled = false
}
javadocJar {
enabled = false
}
sourcesJar {
enabled = false
}
plugins.withType(EclipsePlugin) {
extensions.getByType(org.gradle.plugins.ide.eclipse.model.EclipseModel).classpath { classpath ->
classpath.plusConfigurations.add(configurations.getByName(sourceSets.main.runtimeClasspathConfigurationName))
}
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
kotlinOptions.apiVersion = '1.6'
kotlinOptions.languageVersion = '1.6'
}
dependencies {
actuatorApiDocumentation(project(path: ":spring-boot-project:spring-boot-actuator-autoconfigure", configuration: "documentation"))
asciidoctorExtensions("io.spring.asciidoctor:spring-asciidoctor-extensions-spring-boot")
asciidoctorExtensions("io.spring.asciidoctor:spring-asciidoctor-extensions-section-ids")
asciidoctorExtensions(project(path: ":spring-boot-project:spring-boot-actuator-autoconfigure"))
asciidoctorExtensions(project(path: ":spring-boot-project:spring-boot-autoconfigure"))
asciidoctorExtensions(project(path: ":spring-boot-project:spring-boot-devtools"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-autoconfigure", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-actuator-autoconfigure", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-devtools", configuration: "autoConfigurationMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-actuator", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-actuator-autoconfigure", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-autoconfigure", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-devtools", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-test-autoconfigure", configuration: "configurationPropertiesMetadata"))
gradlePluginDocumentation(project(path: ":spring-boot-project:spring-boot-tools:spring-boot-gradle-plugin", configuration: "documentation"))
implementation(project(path: ":spring-boot-project:spring-boot-actuator"))
implementation(project(path: ":spring-boot-project:spring-boot-actuator-autoconfigure"))
implementation(project(path: ":spring-boot-project:spring-boot-autoconfigure"))
implementation(project(path: ":spring-boot-project:spring-boot-cli"))
implementation(project(path: ":spring-boot-project:spring-boot-tools:spring-boot-loader-tools"))
implementation(project(path: ":spring-boot-project:spring-boot-test"))
implementation(project(path: ":spring-boot-project:spring-boot-test-autoconfigure"))
implementation("ch.qos.logback:logback-classic")
implementation("com.zaxxer:HikariCP")
implementation("io.micrometer:micrometer-core")
implementation("io.micrometer:micrometer-binders")
implementation("io.micrometer:micrometer-registry-graphite")
implementation("io.micrometer:micrometer-registry-jmx")
implementation("io.projectreactor.netty:reactor-netty-http")
implementation("io.undertow:undertow-core")
implementation("jakarta.annotation:jakarta.annotation-api")
implementation("jakarta.jms:jakarta.jms-api")
implementation("jakarta.persistence:jakarta.persistence-api")
implementation("jakarta.servlet:jakarta.servlet-api")
implementation("jakarta.validation:jakarta.validation-api")
implementation("net.sourceforge.htmlunit:htmlunit") {
exclude group: "commons-logging", module: "commons-logging"
exclude group: "xml-apis", module: "xml-apis"
}
implementation("org.apache.commons:commons-dbcp2") {
exclude group: "commons-logging", module: "commons-logging"
}
implementation("org.apache.kafka:kafka-streams")
implementation("org.apache.logging.log4j:log4j-to-slf4j")
implementation("org.apache.solr:solr-solrj") {
exclude group: "commons-logging", module: "commons-logging"
exclude group: "org.slf4j", module: "jcl-over-slf4j"
}
implementation("org.apache.tomcat.embed:tomcat-embed-core")
implementation("org.assertj:assertj-core")
implementation("org.codehaus.groovy:groovy")
implementation("org.hibernate:hibernate-jcache") {
exclude group: "javax.activation", module: "javax.activation-api"
exclude group: "javax.persistence", module: "javax.persistence-api"
exclude group: "javax.xml.bind", module: "jaxb-api"
exclude group: "org.jboss.spec.javax.transaction", module: "jboss-transaction-api_1.2_spec"
}
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jooq:jooq") {
exclude group: "javax.xml.bind", module: "jaxb-api"
}
implementation("org.mockito:mockito-core")
implementation("org.mongodb:mongodb-driver-sync")
implementation("org.postgresql:r2dbc-postgresql")
implementation("org.quartz-scheduler:quartz")
implementation("org.slf4j:jul-to-slf4j")
implementation("org.springframework:spring-jdbc")
implementation("org.springframework:spring-jms")
implementation("org.springframework:spring-orm")
implementation("org.springframework:spring-test")
implementation("org.springframework:spring-web")
implementation("org.springframework:spring-webflux")
implementation("org.springframework:spring-webmvc")
implementation("org.springframework:spring-websocket")
implementation("org.springframework.amqp:spring-amqp")
implementation("org.springframework.amqp:spring-rabbit")
implementation("org.springframework.batch:spring-batch-core")
implementation("org.springframework.data:spring-data-cassandra")
implementation("org.springframework.data:spring-data-couchbase")
implementation("org.springframework.data:spring-data-elasticsearch") {
exclude group: "commons-logging", module: "commons-logging"
}
implementation("org.springframework.data:spring-data-envers") {
exclude group: "javax.activation", module: "javax.activation-api"
exclude group: "javax.persistence", module: "javax.persistence-api"
exclude group: "javax.xml.bind", module: "jaxb-api"
exclude group: "org.jboss.spec.javax.transaction", module: "jboss-transaction-api_1.2_spec"
}
implementation("org.springframework.data:spring-data-jpa")
implementation("org.springframework.data:spring-data-ldap")
implementation("org.springframework.data:spring-data-mongodb")
implementation("org.springframework.data:spring-data-neo4j")
implementation("org.springframework.data:spring-data-redis")
implementation("org.springframework.data:spring-data-r2dbc")
implementation("org.springframework.kafka:spring-kafka")
implementation("org.springframework.kafka:spring-kafka-test")
implementation("org.springframework.restdocs:spring-restdocs-mockmvc") {
exclude group: "javax.servlet", module: "javax.servlet-api"
}
implementation("org.springframework.restdocs:spring-restdocs-webtestclient")
implementation("org.springframework.security:spring-security-config")
implementation("org.springframework.security:spring-security-oauth2-client")
implementation("org.springframework.security:spring-security-test")
implementation("org.springframework.security:spring-security-web")
implementation("org.springframework.ws:spring-ws-core")
implementation("org.springframework.ws:spring-ws-test")
implementation("org.testcontainers:junit-jupiter")
implementation("org.testcontainers:neo4j")
implementation("org.junit.jupiter:junit-jupiter")
implementation("org.yaml:snakeyaml")
mavenPluginDocumentation(project(path: ":spring-boot-project:spring-boot-tools:spring-boot-maven-plugin", configuration: "documentation"))
testImplementation(project(":spring-boot-project:spring-boot-actuator-autoconfigure"))
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
testImplementation("org.assertj:assertj-core")
testImplementation("org.junit.jupiter:junit-jupiter")
4 years ago
testRuntimeOnly(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-web"))
testRuntimeOnly("com.h2database:h2")
testRuntimeOnly("org.springframework:spring-jdbc")
testSlices(project(path: ":spring-boot-project:spring-boot-test-autoconfigure", configuration: "testSliceMetadata"))
}
task dependencyVersions(type: org.springframework.boot.build.constraints.ExtractVersionConstraints) {
enforcedPlatform(":spring-boot-project:spring-boot-dependencies")
}
task aggregatedJavadoc(type: Javadoc) {
dependsOn dependencyVersions
project.rootProject.gradle.projectsEvaluated {
Set<String> excludedProjects = ['spring-boot-antlib', 'spring-boot-configuration-metadata', 'spring-boot-configuration-processor',
'spring-boot-gradle-plugin', 'spring-boot-jarmode-layertools', 'spring-boot-maven-plugin']
Set<Project> publishedProjects = rootProject.subprojects.findAll { it != project}
.findAll { it.plugins.hasPlugin(JavaPlugin) && it.plugins.hasPlugin(MavenPublishPlugin) }
.findAll { !excludedProjects.contains(it.name) }
.findAll { !it.name.startsWith('spring-boot-starter') }
dependsOn publishedProjects.javadoc
source publishedProjects.javadoc.source
classpath = project.files(publishedProjects.javadoc.classpath)
destinationDir = project.file "${buildDir}/docs/javadoc"
options {
author = true
docTitle = "Spring Boot ${project.version} API"
encoding = "UTF-8"
memberLevel = "protected"
outputLevel = "quiet"
source = "1.8"
splitIndex = true
use = true
windowTitle = "Spring Boot ${project.version} API"
}
doFirst {
def versionConstraints = dependencyVersions.versionConstraints
def tomcatVersion = "${versionConstraints["org.apache.tomcat:tomcat-annotations-api"]}"
def tomcatDocsVersion = tomcatVersion.substring(0, tomcatVersion.lastIndexOf("."));
options.links = [
"https://docs.oracle.com/en/java/javase/17/docs/api/",
"https://docs.spring.io/spring-framework/docs/${versionConstraints["org.springframework:spring-core"]}/javadoc-api/",
"https://docs.spring.io/spring-security/site/docs/${versionConstraints["org.springframework.security:spring-security-core"]}/api/",
"https://jakarta.ee/specifications/platform/9/apidocs/",
"https://tomcat.apache.org/tomcat-${tomcatDocsVersion}-doc/api/",
] as String[]
}
}
}
task documentTestSlices(type: org.springframework.boot.build.test.autoconfigure.DocumentTestSlices) {
testSlices = configurations.testSlices
outputFile = file("${buildDir}/docs/generated/test-auto-configuration/documented-slices.adoc")
}
task documentStarters(type: org.springframework.boot.build.starters.DocumentStarters) {
outputDir = file("${buildDir}/docs/generated/using/starters/")
}
task documentAutoConfigurationClasses(type: org.springframework.boot.build.autoconfigure.DocumentAutoConfigurationClasses) {
autoConfiguration = configurations.autoConfiguration
outputDir = file("${buildDir}/docs/generated/auto-configuration-classes/documented-auto-configuration-classes/")
}
task documentDependencyVersions(type: org.springframework.boot.build.constraints.DocumentConstrainedVersions) {
dependsOn dependencyVersions
constrainedVersions.set(providers.provider { dependencyVersions.constrainedVersions })
outputFile = file("${buildDir}/docs/generated/dependency-versions/documented-coordinates.adoc")
}
task documentVersionProperties(type: org.springframework.boot.build.constraints.DocumentVersionProperties) {
dependsOn dependencyVersions
versionProperties.set(providers.provider { dependencyVersions.versionProperties})
outputFile = file("${buildDir}/docs/generated/dependency-versions/documented-properties.adoc")
}
task documentConfigurationProperties(type: org.springframework.boot.build.context.properties.DocumentConfigurationProperties) {
configurationPropertyMetadata = configurations.configurationProperties
outputDir = file("${buildDir}/docs/generated/")
}
task documentDevtoolsPropertyDefaults(type: org.springframework.boot.build.devtools.DocumentDevtoolsPropertyDefaults) {}
tasks.withType(org.asciidoctor.gradle.jvm.AbstractAsciidoctorTask) {
dependsOn dependencyVersions
asciidoctorj {
fatalWarnings = ['^((?!successfully validated).)*$']
}
doFirst {
def versionConstraints = dependencyVersions.versionConstraints
def securityVersion = versionConstraints["org.springframework.security:spring-security-core"]
if (securityVersion.endsWith("-SNAPSHOT")) {
securityVersion = securityVersion.substring(0, securityVersion.length() - "-SNAPSHOT".length())
}
attributes "embedded-mongo-version": versionConstraints["de.flapdoodle.embed:de.flapdoodle.embed.mongo"],
"jetty-version": versionConstraints["org.eclipse.jetty:jetty-server"],
"jooq-version": versionConstraints["org.jooq:jooq"],
"lettuce-version": versionConstraints["io.lettuce:lettuce-core"],
"spring-amqp-version": versionConstraints["org.springframework.amqp:spring-amqp"],
"spring-batch-version": versionConstraints["org.springframework.batch:spring-batch-core"],
"spring-boot-version": project.version,
"spring-data-commons-version": versionConstraints["org.springframework.data:spring-data-commons"],
"spring-data-couchbase-version": versionConstraints["org.springframework.data:spring-data-couchbase"],
"spring-data-envers-version": versionConstraints["org.springframework.data:spring-data-envers"],
"spring-data-jdbc-version": versionConstraints["org.springframework.data:spring-data-jdbc"],
"spring-data-jpa-version": versionConstraints["org.springframework.data:spring-data-jpa"],
"spring-data-mongodb-version": versionConstraints["org.springframework.data:spring-data-mongodb"],
"spring-data-neo4j-version": versionConstraints["org.springframework.data:spring-data-neo4j"],
"spring-data-r2dbc-version": versionConstraints["org.springframework.data:spring-data-r2dbc"],
"spring-data-rest-version": versionConstraints["org.springframework.data:spring-data-rest-core"],
"spring-framework-version": versionConstraints["org.springframework:spring-core"],
"spring-kafka-version": versionConstraints["org.springframework.kafka:spring-kafka"],
"spring-integration-version": versionConstraints["org.springframework.integration:spring-integration-core"],
"spring-security-version": securityVersion,
"spring-webservices-version": versionConstraints["org.springframework.ws:spring-ws-core"]
}
}
asciidoctor {
sources {
include "*.singleadoc"
}
}
task asciidoctorPdf(type: org.asciidoctor.gradle.jvm.AsciidoctorTask) {
sources {
include "*.singleadoc"
}
}
task asciidoctorMultipage(type: org.asciidoctor.gradle.jvm.AsciidoctorTask) {
sources {
include "*.adoc"
}
}
syncDocumentationSourceForAsciidoctor {
dependsOn documentTestSlices
dependsOn documentStarters
dependsOn documentAutoConfigurationClasses
dependsOn documentDependencyVersions
dependsOn documentVersionProperties
dependsOn documentConfigurationProperties
dependsOn documentDevtoolsPropertyDefaults
from("${buildDir}/docs/generated") {
into "asciidoc"
}
from("src/main/java") {
into "main/java"
}
from("src/test/java") {
into "test/java"
}
from("src/main/kotlin") {
into "main/kotlin"
}
from("src/main/groovy") {
into "main/groovy"
}
}
syncDocumentationSourceForAsciidoctorMultipage {
dependsOn documentTestSlices
dependsOn documentStarters
dependsOn documentAutoConfigurationClasses
dependsOn documentDependencyVersions
dependsOn documentVersionProperties
dependsOn documentConfigurationProperties
dependsOn documentDevtoolsPropertyDefaults
from("${buildDir}/docs/generated") {
into "asciidoc"
}
from("src/main/java") {
into "main/java"
}
from("src/test/java") {
into "test/java"
}
from("src/main/kotlin") {
into "main/kotlin"
}
from("src/main/groovy") {
into "main/groovy"
}
}
syncDocumentationSourceForAsciidoctorPdf {
dependsOn documentTestSlices
dependsOn documentStarters
dependsOn documentAutoConfigurationClasses
dependsOn documentDependencyVersions
dependsOn documentVersionProperties
dependsOn documentConfigurationProperties
dependsOn documentDevtoolsPropertyDefaults
from("${buildDir}/docs/generated") {
into "asciidoc"
}
from("src/main/java") {
into "main/java"
}
from("src/test/java") {
into "test/java"
}
from("src/main/kotlin") {
into "main/kotlin"
}
from("src/main/groovy") {
into "main/groovy"
}
}
task zip(type: Zip) {
dependsOn asciidoctor,
asciidoctorMultipage,
asciidoctorPdf,
configurations.gradlePluginDocumentation,
configurations.actuatorApiDocumentation,
configurations.mavenPluginDocumentation
duplicatesStrategy "fail"
from(asciidoctor.outputDir) {
into "reference/htmlsingle"
}
from(asciidoctorPdf.outputDir) {
into "reference/pdf"
include "index.pdf"
rename { "spring-boot-reference.pdf" }
}
from(asciidoctorMultipage.outputDir) {
into "reference/html"
}
from(aggregatedJavadoc) {
into "api"
}
into("gradle-plugin") {
from {
zipTree(configurations.gradlePluginDocumentation.singleFile)
}
}
into("actuator-api") {
from {
zipTree(configurations.actuatorApiDocumentation.singleFile)
}
}
into("maven-plugin") {
from {
zipTree(configurations.mavenPluginDocumentation.singleFile)
}
}
}
artifacts {
archives zip
}
publishing {
publications {
maven(MavenPublication) {
artifact zip
}
}
}