Files
spring-restdocs/docs/build.gradle
2021-11-18 14:47:35 +00:00

88 lines
2.4 KiB
Groovy

plugins {
id "org.asciidoctor.jvm.convert" version "3.2.0"
id "java-library"
}
repositories {
maven { url "https://repo.spring.io/release" }
maven { url "https://repo.spring.io/snapshot" }
}
configurations {
asciidoctorExt
}
dependencies {
asciidoctorExt("io.spring.asciidoctor:spring-asciidoctor-extensions-block-switch:0.5.0")
internal(platform(project(":spring-restdocs-platform")))
internal(enforcedPlatform("org.springframework:spring-framework-bom:5.3.8"))
testImplementation(project(":spring-restdocs-mockmvc"))
testImplementation(project(":spring-restdocs-restassured"))
testImplementation(project(":spring-restdocs-webtestclient"))
testImplementation("javax.validation:validation-api")
testImplementation("junit:junit")
testImplementation("org.testng:testng:6.9.10")
testImplementation("org.junit.jupiter:junit-jupiter-api")
}
tasks.findByPath("artifactoryPublish")?.enabled = false
tasks.withType(org.asciidoctor.gradle.jvm.AbstractAsciidoctorTask) {
baseDirFollowsSourceDir()
}
jar {
enabled = false
}
javadoc {
enabled = false
}
asciidoctor {
configurations 'asciidoctorExt'
sources {
include "index.adoc"
}
attributes "revnumber": project.version,
"branch-or-tag": project.version.endsWith("SNAPSHOT") ? "main": "v${project.version}"
inputs.files(sourceSets.test.java)
}
task api (type: Javadoc) {
group = "Documentation"
description = "Generates aggregated Javadoc API documentation."
dependsOn {
subprojects.collect {
it.tasks.getByName("jar")
}
}
project.rootProject.gradle.projectsEvaluated {
Set<String> excludedProjects = ['spring-restdocs-asciidoctor']
Set<Project> publishedProjects = rootProject.subprojects.findAll { it != project}
.findAll { it.plugins.hasPlugin(JavaPlugin) && it.plugins.hasPlugin(MavenPublishPlugin) }
.findAll { !excludedProjects.contains(it.name) }
dependsOn publishedProjects.javadoc
source publishedProjects.javadoc.source
classpath = project.files(publishedProjects.javadoc.classpath)
destinationDir = project.file "${buildDir}/docs/javadoc"
options {
author = true
docTitle = "Spring REST Docs ${project.version} API"
encoding = "UTF-8"
memberLevel = "protected"
outputLevel = "quiet"
source = "1.8"
splitIndex = true
stylesheetFile = file("src/main/javadoc/spring-javadoc.css")
use = true
windowTitle = "Spring REST Docs ${project.version} API"
}
}
destinationDir = new File(buildDir, "api")
}