Files
spring-data-redis/build.gradle
Christoph Strobl c6b2ba75af DATAREDIS-336 - Copy styles to output dir.
Upgraded to Asciidoctor 1.5.0. We now cheat on Gradle docbook-reference-plugin by directly copying files to reference work dir to bypass expanding files. Create an empty source folder so that the plugin does not fail.

Original pull request: #94.
2014-09-04 08:44:47 +02:00

324 lines
10 KiB
Groovy

buildscript {
repositories {
maven { url 'http://repo.spring.io/plugins-release' }
jcenter()
}
dependencies {
classpath 'org.springframework.build.gradle:bundlor-plugin:0.1.2'
classpath 'org.springframework.build.gradle:spring-io-plugin:0.0.3.RELEASE'
classpath 'me.champeau.gradle:gradle-javadoc-hotfix-plugin:0.1'
classpath 'io.spring.gradle:docbook-reference-plugin:0.3.0'
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.0'
classpath('org.asciidoctor:asciidoctor-java-integration:0.1.4.preview.1')
}
}
description = 'Spring Data Redis'
group = 'org.springframework.data'
repositories {
maven { url "http://repo.spring.io/libs-snapshot" }
maven { url "http://repo.spring.io/plugins-release" }
mavenCentral()
jcenter()
}
apply plugin: "java"
apply plugin: 'eclipse'
apply plugin: 'idea'
apply from: "$rootDir/maven.gradle"
apply plugin: 'bundlor'
apply plugin: 'javadocHotfix'
apply plugin: 'org.asciidoctor.gradle.asciidoctor'
apply plugin: 'docbook-reference'
if (project.hasProperty('platformVersion')) {
apply plugin: 'spring-io'
repositories {
maven { url "https://repo.spring.io/libs-snapshot" }
}
dependencies {
springIoVersions "io.spring.platform:platform-versions:${platformVersion}@properties"
}
}
[compileJava, compileTestJava]*.options*.compilerArgs = ["-Xlint:-serial"]
[compileJava, compileTestJava]*.options*.compilerArgs = ["-Xlint:-serial", "-Xlint:deprecation"]
configurations.all {
resolutionStrategy {
force 'org.apache.commons:commons-pool2:2.2'
}
}
// Common dependencies
dependencies {
// Logging
compile "org.slf4j:slf4j-api:$slf4jVersion"
testRuntime "log4j:log4j:$log4jVersion"
testRuntime "org.slf4j:slf4j-log4j12:$slf4jVersion"
// Spring Framework
compile("org.springframework:spring-core:$springVersion") {
exclude group: "commons-logging", module: "commons-logging"
}
compile "org.springframework:spring-context-support:$springVersion"
compile "org.springframework:spring-context:$springVersion"
compile "org.springframework:spring-tx:$springVersion"
compile("org.springframework:spring-oxm:$springVersion", optional)
compile "org.springframework:spring-aop:$springVersion"
// Redis Drivers
compile("redis.clients:jedis:$jedisVersion", optional)
compile("com.github.spullara.redis:client:$srpVersion", optional)
compile("org.jredis:jredis-core-api:$jredisVersion", optional)
compile("org.jredis:jredis-core-ri:$jredisVersion", optional)
compile("com.lambdaworks:lettuce:$lettuceVersion", optional)
// Mappers
compile("org.codehaus.jackson:jackson-mapper-asl:$jacksonVersion", optional)
compile("commons-beanutils:commons-beanutils-core:1.8.3", optional)
compile("com.fasterxml.jackson.core:jackson-core:$fasterXmlJacksonVersion", optional)
compile("com.fasterxml.jackson.core:jackson-databind:$fasterXmlJacksonDatabindVersion", optional)
// Pool
compile("org.apache.commons:commons-pool2:2.2", optional)
// Testing
testCompile "junit:junit:$junitVersion"
testCompile "org.springframework:spring-test:$springVersion"
testCompile "org.springframework:spring-jdbc:$springVersion"
testCompile "org.mockito:mockito-core:$mockitoVersion"
testCompile("javax.annotation:jsr250-api:1.0", optional)
testCompile("com.thoughtworks.xstream:xstream:1.4.4", optional)
testCompile("javax.transaction:jta:1.1")
}
sourceCompatibility = 1.6
targetCompatibility = 1.6
javadoc {
ext.srcDir = file("${projectDir}/docs/src/api")
destinationDir = file("${buildDir}/api")
ext.tmpDir = file("${buildDir}/api-work")
configure(options) {
stylesheetFile = file("${srcDir}/spring-javadoc.css")
overview = "${srcDir}/overview.html"
docFilesSubDirs = true
outputLevel = org.gradle.external.javadoc.JavadocOutputLevel.QUIET
breakIterator = true
showFromProtected()
groups = [
'Spring Data Redis Support' : ['org.springframework.data.redis*'],
]
links = [
"http://static.springframework.org/spring/docs/3.1.x/javadoc-api",
"http://download.oracle.com/javase/6/docs/api",
"http://jackson.codehaus.org/1.8.2/javadoc"
]
exclude "org/springframework/data/redis/config/**"
}
title = "${rootProject.description} ${version} API"
}
reference {
sourceDir = file("$buildDir/asciidoc/docbook")
}
referencePdf {
sourceDir = file("$buildDir/asciidoc/docbook")
}
bundlor {
manifestTemplate = file("${projectDir}/template.mf").text
}
jar {
manifest.attributes["Created-By"] = "${System.getProperty("java.version")} (${System.getProperty("java.specification.vendor")})"
manifest.attributes['Implementation-Title'] = 'spring-data-redis'
manifest.attributes['Implementation-Version'] = project.version
manifest.attributes['Implementation-URL'] = "http://projects.spring.io/spring-data-redis"
manifest.attributes['Implementation-Vendor'] = "Pivotal Software, Inc."
manifest.attributes['Implementation-Vendor-Id'] = "org.springframework"
from("$rootDir/docs/src/info") {
include "license.txt"
include "notice.txt"
include "readme.txt"
include "changelog.txt"
into "META-INF"
expand(copyright: new Date().format('2011-yyyy'), version: project.version)
}
}
task sourcesJar(type: Jar, dependsOn:classes) {
classifier = 'sources'
from sourceSets.main.allJava
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task docsZip(type: Zip, dependsOn:['docbook', 'generateHTML']) {
group = 'Distribution'
classifier = 'docs'
description = "Builds -${classifier} archive containing api and reference for deployment"
from('docs/src/info') {
include 'changelog.txt'
}
from (javadoc) {
into 'api'
}
from (asciidoctor.outputDir) {
include "index.html"
include "spring.css"
into 'reference/htmlsingle'
}
from ("$buildDir/reference/pdf") {
into 'reference/pdf'
}
}
task schemaZip(type: Zip) {
group = 'Distribution'
classifier = 'schema'
description = "Builds -${classifier} archive containing all XSDs for deployment"
def Properties schemas = new Properties();
sourceSets.main.resources.find {
it.path.endsWith('META-INF' + File.separator + 'spring.schemas')
}?.withInputStream { schemas.load(it) }
for (def key : schemas.keySet()) {
def shortName = key.replaceAll(/http.*schema.(.*).spring-.*/, '$1')
def alias = key.replaceAll(/http.*schema.(.*).(spring-.*)/, '$2')
assert shortName != key
File xsdFile = sourceSets.main.resources.find {
it.path.replace('\\', '/').endsWith(schemas.get(key))
}
assert xsdFile != null
into (shortName) {
from xsdFile.path
rename { String fileName -> alias }
}
}
}
task distZip(type: Zip, dependsOn: [jar, docsZip, schemaZip, sourcesJar, javadocJar]) {
group = 'Distribution'
classifier = 'dist'
description = "Builds -${classifier} archive, containing all jars and docs, " +
"suitable for community download page."
ext.zipRootDir = "${project.name}-${project.version}"
into (zipRootDir) {
from('docs/src/info') {
include 'readme.txt'
include 'license.txt'
include 'notice.txt'
expand(copyright: new Date().format('yyyy'), version: project.version)
}
from(zipTree(docsZip.archivePath)) {
into "docs"
}
from(zipTree(schemaZip.archivePath)) {
into "schema"
}
into ("dist") {
from rootProject.collect { project -> project.libsDir }
}
}
}
tasks.withType(Test) {
systemProperty 'runLongTests', System.getProperty('runLongTests')
testLogging {
exceptionFormat = 'full'
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
println "Test Summary: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)"
}
}
}
}
artifacts {
archives sourcesJar
archives javadocJar
archives docsZip
archives schemaZip
archives distZip
}
task wrapper(type: Wrapper) {
description = 'Generates gradlew[.bat] scripts'
gradleVersion = '1.11'
}
tasks.withType(org.asciidoctor.gradle.AsciidoctorTask) { docTask ->
options = [
logDocuments: true,
attributes: [
linkcss: 'true',
copycss : 'spring.css',
stylesheet: "spring.css",
icons : 'font',
'source-highlighter': 'prettify',
sectanchors : '',
toc: '',
toclevels: '4',
idprefix: '',
idseparator: '-',
doctype: 'book',
numbered: '',
version: project.version,
baseDir: "$sourceDir",
resourcesDir: "$rootDir/src/main/resources",
referenceDir: "$sourceDir/reference"
]
]
}
task generateHTML (type: org.asciidoctor.gradle.AsciidoctorTask, description: 'Generates single and multiple HTML documentation.', group: 'Documentation') {
backend = 'html5'
outputDir = new File("$buildDir/reference/htmlsingle")
options.attributes.doctype = 'book'
options.attributes.copycss = 'spring.css'
}
task generateDocbook (type: org.asciidoctor.gradle.AsciidoctorTask, description: 'Generates DOCBOOK documentation.', group: 'Documentation', dependsOn : ['createEmptyDocbookSourceDirToCheatThePlugin']) {
backend = 'docbook'
outputDir = new File("$buildDir/reference-work")
options.attributes.chunkedOutput = 'true'
options.attributes.stylesheet = 'chunked'
}
task createEmptyDocbookSourceDirToCheatThePlugin << {
new File("$buildDir/asciidoc/docbook").mkdirs()
}
assemble.dependsOn = ['jar', 'sourcesJar']
defaultTasks 'build'