Fix documentation publication in Gradle build
This commit moves the asciidoctor *.adoc files to the default location and removes the unnecessary asciidoctor plugin configuration as a result. This changes also reworks dependencies between tasks and adds the missing publication configuration for generated artifacts. The entire docs-specific script is moved from the main build.gradle file to a "gradle/docs.gradle" script to improve readability of the main build. Fixes gh-1797
This commit is contained in:
committed by
Rossen Stoyanchev
parent
46b03abe8f
commit
10ae7796c6
220
build.gradle
220
build.gradle
@@ -10,9 +10,6 @@ plugins {
|
||||
ext {
|
||||
moduleProjects = subprojects.findAll { it.name.startsWith("spring-") }
|
||||
javaProjects = subprojects - project("spring-js-resources")
|
||||
withoutJclOverSlf4j = {
|
||||
exclude group: "org.slf4j", name: "jcl-over-slf4j"
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
@@ -150,220 +147,5 @@ subprojects { subproject ->
|
||||
configure(rootProject) {
|
||||
description = "Spring Web Flow"
|
||||
|
||||
repositories {
|
||||
maven { url "https://repo.spring.io/plugins-release" }
|
||||
}
|
||||
|
||||
configurations {
|
||||
asciidoctorExtensions
|
||||
}
|
||||
|
||||
dependencies {
|
||||
asciidoctorExtensions "io.spring.asciidoctor.backends:spring-asciidoctor-backends:0.0.3"
|
||||
}
|
||||
|
||||
task prepareAsciidocBuild(type: Sync) {
|
||||
dependsOn configurations.asciidoctorExtensions
|
||||
// copy doc sources
|
||||
from "src/reference/"
|
||||
// to a build directory of your choice
|
||||
into "$buildDir/asciidoc/build"
|
||||
}
|
||||
|
||||
asciidoctorPdf {
|
||||
dependsOn prepareAsciidocBuild
|
||||
baseDirFollowsSourceFile()
|
||||
|
||||
asciidoctorj {
|
||||
sourceDir "$buildDir/asciidoc/build"
|
||||
inputs.dir(sourceDir)
|
||||
sources {
|
||||
include 'index.adoc'
|
||||
}
|
||||
options doctype: 'book'
|
||||
attributes 'icons': 'font',
|
||||
'sectanchors': '',
|
||||
'sectnums': '',
|
||||
'toc': '',
|
||||
'source-highlighter' : 'coderay',
|
||||
revnumber: project.version,
|
||||
'project-version': project.version
|
||||
}
|
||||
}
|
||||
|
||||
asciidoctor {
|
||||
dependsOn asciidoctorPdf
|
||||
|
||||
baseDirFollowsSourceFile()
|
||||
|
||||
configurations "asciidoctorExtensions"
|
||||
outputOptions {
|
||||
backends "spring-html"
|
||||
}
|
||||
|
||||
sourceDir "$buildDir/asciidoc/build"
|
||||
inputs.dir(sourceDir)
|
||||
resources {
|
||||
from(sourceDir) {
|
||||
include 'images/*', 'css/**', 'js/**'
|
||||
}
|
||||
}
|
||||
options doctype: 'book'
|
||||
|
||||
attributes 'docinfo': 'shared',
|
||||
stylesdir: 'css/',
|
||||
stylesheet: 'spring.css',
|
||||
'linkcss': true,
|
||||
'icons': 'font',
|
||||
'sectanchors': '',
|
||||
'source-highlighter': 'highlight.js',
|
||||
'highlightjsdir': 'js/highlight',
|
||||
'highlightjs-theme': 'github',
|
||||
'idprefix': '',
|
||||
'idseparator': '-',
|
||||
'spring-version': project.version,
|
||||
'allow-uri-read': '',
|
||||
'toc': 'left',
|
||||
'toclevels': '4',
|
||||
revnumber: project.version,
|
||||
'project-version': project.version
|
||||
}
|
||||
|
||||
|
||||
// don't publish the default jar for the root project
|
||||
configurations.archives.artifacts.clear()
|
||||
|
||||
artifacts {
|
||||
}
|
||||
|
||||
task api(type: Javadoc) {
|
||||
group = "Documentation"
|
||||
description = "Generates aggregated Javadoc API documentation."
|
||||
title = "${rootProject.description} ${version} API"
|
||||
options.memberLevel = JavadocMemberLevel.PROTECTED
|
||||
options.author = true
|
||||
options.header = rootProject.description
|
||||
options.overview = "src/api/overview.html"
|
||||
source subprojects.collect { project ->
|
||||
project.sourceSets.main.allJava
|
||||
}
|
||||
destinationDir = new File(buildDir, "api")
|
||||
classpath = files(subprojects.collect { project ->
|
||||
project.sourceSets.main.compileClasspath
|
||||
})
|
||||
maxMemory = "1024m"
|
||||
}
|
||||
|
||||
task docsZip(type: Zip) {
|
||||
group = "Distribution"
|
||||
archiveBaseName = "spring-webflow"
|
||||
archiveClassifier = "docs"
|
||||
description = "Builds -${archiveClassifier.get()} archive containing api and reference " +
|
||||
"for deployment at static.springframework.org/spring-webflow/docs."
|
||||
|
||||
from (api) {
|
||||
into "api"
|
||||
}
|
||||
|
||||
from (asciidoctor) {
|
||||
include "*.html"
|
||||
include "css/**"
|
||||
include "js/**"
|
||||
include "images/**"
|
||||
into "reference"
|
||||
}
|
||||
|
||||
from (asciidoctorPdf) {
|
||||
include "*.pdf"
|
||||
into "reference"
|
||||
}
|
||||
}
|
||||
|
||||
task schemaZip(type: Zip) {
|
||||
group = "Distribution"
|
||||
archiveBaseName = "spring-webflow"
|
||||
archiveClassifier = "schema"
|
||||
description = "Builds -${archiveClassifier.get()} archive containing all " +
|
||||
"XSDs for deployment at static.springframework.org/schema."
|
||||
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
|
||||
subprojects.each { subproject ->
|
||||
Properties schemas = new Properties()
|
||||
|
||||
subproject.sourceSets.main.resources.find {
|
||||
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
|
||||
File xsdFile = subproject.sourceSets.main.allSource.find {
|
||||
it.path.endsWith(schemas.get(key))
|
||||
} as File
|
||||
assert xsdFile != null
|
||||
into (shortName) {
|
||||
from xsdFile.path
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
project(":spring-webflow").sourceSets.main.resources.matching {
|
||||
include '**/engine/model/builder/xml/*.xsd'
|
||||
}.each { File file ->
|
||||
into ('webflow') {
|
||||
from file.path
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task distZip(type: Zip, dependsOn: [docsZip, schemaZip]) {
|
||||
group = "Distribution"
|
||||
archiveBaseName = "spring-webflow"
|
||||
archiveClassifier = "dist"
|
||||
description = "Builds -${archiveClassifier.get()} archive, containing all jars and docs, " +
|
||||
"suitable for community download page."
|
||||
|
||||
def baseDir = "${archiveBaseName.get()}-${project.version}"
|
||||
|
||||
from("src/dist") {
|
||||
include "notice.txt"
|
||||
into "${baseDir}"
|
||||
expand(copyright: new Date().format("yyyy"), version: project.version)
|
||||
}
|
||||
|
||||
from("src/dist") {
|
||||
include "readme.txt"
|
||||
include "license.txt"
|
||||
into "${baseDir}"
|
||||
expand(version: project.version)
|
||||
}
|
||||
|
||||
from(zipTree(docsZip.archiveFile)) {
|
||||
into "${baseDir}/docs"
|
||||
}
|
||||
|
||||
from(zipTree(schemaZip.archiveFile)) {
|
||||
into "${baseDir}/schema"
|
||||
}
|
||||
|
||||
|
||||
subprojects.each { subproject ->
|
||||
into ("${baseDir}/libs") {
|
||||
from subproject.jar
|
||||
if (subproject.tasks.findByPath("sourcesJar")) {
|
||||
from subproject.sourcesJar
|
||||
}
|
||||
if (subproject.tasks.findByPath("javadocJar")) {
|
||||
from subproject.javadocJar
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives docsZip
|
||||
archives schemaZip
|
||||
archives distZip
|
||||
}
|
||||
apply from: "${rootDir}/gradle/docs.gradle"
|
||||
}
|
||||
|
||||
185
gradle/docs.gradle
Normal file
185
gradle/docs.gradle
Normal file
@@ -0,0 +1,185 @@
|
||||
apply plugin: "maven-publish"
|
||||
apply plugin: "com.jfrog.artifactory"
|
||||
|
||||
configurations {
|
||||
asciidoctorExtensions
|
||||
}
|
||||
|
||||
dependencies {
|
||||
asciidoctorExtensions "io.spring.asciidoctor.backends:spring-asciidoctor-backends:0.0.7"
|
||||
}
|
||||
|
||||
asciidoctorPdf {
|
||||
baseDirFollowsSourceFile()
|
||||
asciidoctorj {
|
||||
sources {
|
||||
include 'index.adoc'
|
||||
}
|
||||
options doctype: 'book'
|
||||
attributes 'icons': 'font',
|
||||
'sectanchors': '',
|
||||
'sectnums': '',
|
||||
'toc': '',
|
||||
'source-highlighter' : 'coderay',
|
||||
revnumber: project.version,
|
||||
'project-version': project.version
|
||||
}
|
||||
}
|
||||
|
||||
asciidoctor {
|
||||
baseDirFollowsSourceFile()
|
||||
configurations "asciidoctorExtensions"
|
||||
outputOptions {
|
||||
backends "spring-html"
|
||||
}
|
||||
sources {
|
||||
include 'index.adoc'
|
||||
}
|
||||
options doctype: 'book'
|
||||
|
||||
attributes 'docinfo': 'shared',
|
||||
stylesdir: 'css/',
|
||||
stylesheet: 'spring.css',
|
||||
'linkcss': true,
|
||||
'icons': 'font',
|
||||
'sectanchors': '',
|
||||
'source-highlighter': 'highlight.js',
|
||||
'highlightjsdir': 'js/highlight',
|
||||
'highlightjs-theme': 'github',
|
||||
'idprefix': '',
|
||||
'idseparator': '-',
|
||||
'spring-version': project.version,
|
||||
'allow-uri-read': '',
|
||||
'toc': 'left',
|
||||
'toclevels': '4',
|
||||
revnumber: project.version,
|
||||
'project-version': project.version
|
||||
}
|
||||
|
||||
task api(type: Javadoc) {
|
||||
group = "Documentation"
|
||||
description = "Generates aggregated Javadoc API documentation."
|
||||
title = "${rootProject.description} ${version} API"
|
||||
options.memberLevel = JavadocMemberLevel.PROTECTED
|
||||
options.author = true
|
||||
options.header = rootProject.description
|
||||
options.overview = "src/api/overview.html"
|
||||
source subprojects.collect { project ->
|
||||
project.sourceSets.main.allJava
|
||||
}
|
||||
destinationDir = new File(buildDir, "api")
|
||||
classpath = files(subprojects.collect { project ->
|
||||
project.sourceSets.main.compileClasspath
|
||||
})
|
||||
maxMemory = "1024m"
|
||||
}
|
||||
|
||||
task docsZip(type: Zip) {
|
||||
group = "Distribution"
|
||||
archiveBaseName = "spring-webflow"
|
||||
archiveClassifier = "docs"
|
||||
description = "Builds -${archiveClassifier.get()} archive containing api and reference " +
|
||||
"for deployment at static.springframework.org/spring-webflow/docs."
|
||||
|
||||
from (api) {
|
||||
into "api"
|
||||
}
|
||||
from (asciidoctor) {
|
||||
into "reference"
|
||||
}
|
||||
from (asciidoctorPdf) {
|
||||
into "reference"
|
||||
}
|
||||
}
|
||||
|
||||
task schemaZip(type: Zip) {
|
||||
group = "Distribution"
|
||||
archiveBaseName = "spring-webflow"
|
||||
archiveClassifier = "schema"
|
||||
description = "Builds -${archiveClassifier.get()} archive containing all " +
|
||||
"XSDs for deployment at static.springframework.org/schema."
|
||||
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
|
||||
subprojects.each { subproject ->
|
||||
Properties schemas = new Properties()
|
||||
|
||||
subproject.sourceSets.main.resources.find {
|
||||
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
|
||||
File xsdFile = subproject.sourceSets.main.allSource.find {
|
||||
it.path.endsWith(schemas.get(key))
|
||||
} as File
|
||||
assert xsdFile != null
|
||||
into (shortName) {
|
||||
from xsdFile.path
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
project(":spring-webflow").sourceSets.main.resources.matching {
|
||||
include '**/engine/model/builder/xml/*.xsd'
|
||||
}.each { File file ->
|
||||
into ('webflow') {
|
||||
from file.path
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task distZip(type: Zip, dependsOn: [docsZip, schemaZip]) {
|
||||
group = "Distribution"
|
||||
archiveBaseName = "spring-webflow"
|
||||
archiveClassifier = "dist"
|
||||
description = "Builds -${archiveClassifier.get()} archive, containing all jars and docs, " +
|
||||
"suitable for community download page."
|
||||
|
||||
def baseDir = "${archiveBaseName.get()}-${project.version}"
|
||||
|
||||
from("src/dist") {
|
||||
include "notice.txt"
|
||||
into "${baseDir}"
|
||||
expand(copyright: new Date().format("yyyy"), version: project.version)
|
||||
}
|
||||
from("src/dist") {
|
||||
include "readme.txt"
|
||||
include "license.txt"
|
||||
into "${baseDir}"
|
||||
expand(version: project.version)
|
||||
}
|
||||
from(zipTree(docsZip.archiveFile)) {
|
||||
into "${baseDir}/docs"
|
||||
}
|
||||
from(zipTree(schemaZip.archiveFile)) {
|
||||
into "${baseDir}/schema"
|
||||
}
|
||||
|
||||
subprojects.each { subproject ->
|
||||
into ("${baseDir}/libs") {
|
||||
from subproject.jar
|
||||
if (subproject.tasks.findByPath("sourcesJar")) {
|
||||
from subproject.sourcesJar
|
||||
}
|
||||
if (subproject.tasks.findByPath("javadocJar")) {
|
||||
from subproject.javadocJar
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
artifact docsZip
|
||||
artifact schemaZip
|
||||
artifact distZip
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
artifactoryPublish {
|
||||
publications(publishing.publications.mavenJava)
|
||||
}
|
||||
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Reference in New Issue
Block a user