Files
spring-restdocs/build.gradle
Andy Wilkinson ff18f8034d Add AsciidoctorJ 1.6 and 2.0 compatibility
AsciidoctorJ 1.6 is not backwards compatible with AsciidoctorJ 1.5
and AsciidoctorJ 2.0 is not backwards compatible with AsciidoctorJ 1.6
or 1.5. The backwards incompatibilities are such that they cannot be
worked around using reflection so code needs to be compiled against
each of the three versions. To this end, this commit splits
spring-restdocs-asciidoctor into several separate modules:

1. spring-restdocs-asciidoctor-support
2. spring-restdocs-asciidoctor-1.5
3. spring-restdocs-asciidoctor-1.6
4. spring-restdocs-asciidoctor-2.0

spring-restdocs-asciidoctor-support contains support code that is not
tied to a specific version of AsciidoctorJ and can be used with
1.5, 1.6 and 2.0. The other three modules contain code that is
specific to a particular version of AsciidoctorJ. Each
version-specific module uses class names that are unique across all
three modules and is written in such a way that they will back off
when used in an environment with a different version of AsciidoctorJ.
The existing spring-restdocs-asciidoctor module has been modified to
merge the version specific jars and the support jar together into a
single jar that supports AsciidoctorJ 1.5, 1.6, and 2.0.

The above-described changes should allow users to depend upon
spring-restdocs-asciidoctor as before and to now be able to use
AsciidoctorJ 1.5, 1.6, or 2.0.

Closes gh-581
2019-06-18 12:28:36 +01:00

272 lines
7.3 KiB
Groovy

buildscript {
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/plugins-snapshot' }
maven { url 'https://repo.spring.io/plugins-release' }
maven { url 'https://plugins.gradle.org/m2/' }
maven { url 'https://repo.spring.io/snapshot' }
}
dependencies {
classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.7'
classpath 'io.spring.gradle:spring-io-plugin:0.0.8.RELEASE'
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2'
classpath "io.spring.javaformat:spring-javaformat-gradle-plugin:$javaFormatVersion"
classpath 'io.spring.nohttp:nohttp-gradle:0.0.2.RELEASE'
}
}
allprojects {
group = 'org.springframework.restdocs'
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/libs-snapshot' }
}
}
apply plugin: 'samples'
apply plugin: 'org.sonarqube'
apply plugin: 'io.spring.nohttp'
sonarqube {
properties {
property 'sonar.jacoco.reportPath', "${buildDir.name}/jacoco.exec"
property 'sonar.java.coveragePlugin', 'jacoco'
property 'sonar.links.ci', 'https://build.spring.io/browse/SRD'
property 'sonar.links.homepage', 'https://github.com/spring-projects/spring-restdocs'
property 'sonar.links.issue', 'https://github.com/spring-projects/spring-restdocs'
property 'sonar.links.scm', 'https://github.com/spring-projects/spring-restdocs'
}
}
nohttp {
source.exclude 'samples/rest-notes-slate/slate/source/javascripts/lib/_jquery*.js'
source.exclude 'buildSrc/.gradle/**'
source.exclude '**/build/**'
source.exclude '**/target/**'
whitelistFile = project.file('config/nohttp/whitelist.lines')
}
ext {
springVersion = '5.0.5.RELEASE'
javadocLinks = [
'https://docs.oracle.com/javase/8/docs/api/',
"https://docs.spring.io/spring-framework/docs/$springVersion/javadoc-api/",
'https://docs.jboss.org/hibernate/stable/beanvalidation/api/',
'https://docs.jboss.org/hibernate/stable/validator/api/'
] as String[]
}
subprojects {
apply plugin: 'io.spring.dependency-management'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'propdeps'
apply plugin: 'propdeps-eclipse'
apply plugin: 'propdeps-maven'
apply plugin: 'maven'
apply plugin: 'matrixtest'
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencyManagement {
imports {
mavenBom "org.springframework:spring-framework-bom:$springVersion"
}
dependencies {
dependency 'com.fasterxml.jackson.core:jackson-databind:2.9.5'
dependency 'com.samskivert:jmustache:1.12'
dependency 'commons-codec:commons-codec:1.10'
dependency 'javax.servlet:javax.servlet-api:3.1.0'
dependency 'javax.validation:validation-api:2.0.0.Final'
dependency 'junit:junit:4.12'
dependency 'io.rest-assured:rest-assured:3.0.7'
dependency 'org.apache.pdfbox:pdfbox:2.0.7'
dependency 'org.assertj:assertj-core:2.9.1'
dependency 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.16'
dependency 'org.hamcrest:hamcrest-core:1.3'
dependency 'org.hamcrest:hamcrest-library:1.3'
dependency 'org.hibernate.validator:hibernate-validator:6.0.9.Final'
dependency 'org.jacoco:org.jacoco.agent:0.7.9'
dependency 'org.javamoney:moneta:1.1'
dependency 'org.jruby:jruby-complete:9.1.13.0'
dependency 'org.junit.jupiter:junit-jupiter-api:5.0.0'
dependency 'org.mockito:mockito-core:1.10.19'
dependency 'org.springframework.hateoas:spring-hateoas:0.23.0.RELEASE'
dependency 'org.synchronoss.cloud:nio-multipart-parser:1.1.0'
}
}
test {
testLogging {
exceptionFormat "full"
}
}
eclipseJdt {
inputFile = rootProject.file('config/eclipse/org.eclipse.jdt.core.prefs')
doLast {
project.file('.settings/org.eclipse.jdt.ui.prefs').withWriter { writer ->
writer << rootProject.file('config/eclipse/org.eclipse.jdt.ui.prefs').text
}
}
}
compileJava {
options.compilerArgs = [ '-Xlint:deprecation', '-Xlint:-options', '-Werror' ]
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
}
def codeProjects = subprojects - project(":docs")
configure(codeProjects) {
apply plugin: 'io.spring.javaformat'
apply plugin: 'checkstyle'
apply from: "${rootProject.projectDir}/gradle/publish-maven.gradle"
checkstyle {
configFile = rootProject.file('config/checkstyle/checkstyle.xml')
configProperties = [ 'checkstyle.config.dir' : rootProject.file('config/checkstyle') ]
toolVersion = '6.10.1'
}
configurations {
jacoco
}
dependencies {
checkstyle "io.spring.javaformat:spring-javaformat-checkstyle:$javaFormatVersion"
jacoco 'org.jacoco:org.jacoco.agent::runtime'
}
}
def publishedCodeProjects = codeProjects.findAll { codeProject -> !codeProject.name.contains('spring-restdocs-asciidoctor')}
configure(publishedCodeProjects) { subproject ->
javadoc {
description = "Generates project-level javadoc for use in -javadoc jar"
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
options.author = true
options.header = "Spring REST Docs $version"
options.docTitle = "${options.header} API"
options.links = javadocLinks
options.addStringOption '-quiet'
options.encoding = 'UTF-8'
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from project.sourceSets.main.allSource
}
task javadocJar(type: Jar) {
classifier = "javadoc"
from javadoc
}
artifacts {
archives sourcesJar
archives javadocJar
}
}
samples {
dependOn 'spring-restdocs-core:install'
dependOn 'spring-restdocs-mockmvc:install'
dependOn 'spring-restdocs-restassured:install'
dependOn 'spring-restdocs-webtestclient:install'
dependOn 'spring-restdocs-asciidoctor:install'
restNotesGrails {
workingDir "$projectDir/samples/rest-notes-grails"
}
restNotesSpringHateoas {
workingDir "$projectDir/samples/rest-notes-spring-hateoas"
}
restNotesSpringDataRest {
workingDir "$projectDir/samples/rest-notes-spring-data-rest"
}
testNg {
workingDir "$projectDir/samples/testng"
}
restAssured {
workingDir "$projectDir/samples/rest-assured"
}
webTestClient {
workingDir "$projectDir/samples/web-test-client"
}
slate {
workingDir "$projectDir/samples/rest-notes-slate"
build false
}
junit5 {
workingDir "$projectDir/samples/junit5"
}
}
task api (type: Javadoc) {
group = "Documentation"
description = "Generates aggregated Javadoc API documentation."
dependsOn {
subprojects.collect {
it.tasks.getByName("jar")
}
}
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
options.author = true
options.header = "Spring REST Docs $version"
options.splitIndex = true
options.links = javadocLinks
options.addStringOption '-quiet'
source publishedCodeProjects.collect { project -> project.sourceSets.main.allJava }
destinationDir = new File(buildDir, "api")
doFirst {
classpath = files(subprojects.collect { it.sourceSets.main.compileClasspath })
}
}
task docsZip(type: Zip, dependsOn: [':docs:asciidoctor', ':api', ':buildSamples']) {
group = 'Distribution'
baseName = 'spring-restdocs'
classifier = 'docs'
description = "Builds -${classifier} archive containing API and reference documentation"
destinationDir = file("${project.buildDir}/distributions")
from(project.tasks.findByPath(':docs:asciidoctor')) {
into 'reference'
}
from(api) {
into 'api'
}
from(file('samples/rest-notes-spring-hateoas/build/asciidoc/html5')) {
into 'samples/restful-notes'
}
from(file('samples/rest-notes-slate/build/docs')) {
into 'samples/slate'
}
}
configurations {
archives
}
artifacts {
archives docsZip
}