Files
spring-kafka/build.gradle
2016-07-01 13:02:24 -04:00

351 lines
8.6 KiB
Groovy

buildscript {
repositories {
maven { url 'https://repo.spring.io/plugins-release' }
}
dependencies {
classpath 'io.spring.gradle:spring-io-plugin:0.0.5.RELEASE'
classpath 'io.spring.gradle:docbook-reference-plugin:0.3.1'
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.0'
}
}
plugins {
id "org.sonarqube" version "1.2"
}
description = "Spring Kafka"
apply plugin: 'base'
apply plugin: 'project-report'
apply plugin: 'idea'
def docsDir = 'src/reference/asciidoc' // Will be default with newer asciidoctor plugin
ext {
linkHomepage = 'https://github.com/spring-projects/spring-kafka'
linkCi = 'https://build.spring.io/browse/SK'
linkIssue = 'https://github.com/spring-projects/spring-kafka/issues'
linkScmUrl = 'https://github.com/spring-projects/spring-kafka'
linkScmConnection = 'https://github.com/spring-projects/spring-kafka.git'
linkScmDevConnection = 'git@github.com:spring-projects/spring-kafka.git'
}
allprojects {
group = 'org.springframework.kafka'
repositories {
maven { url 'https://repo.spring.io/libs-release' }
maven { url 'https://repo.spring.io/libs-milestone' }
if (project.hasProperty('platformVersion')) {
maven { url 'https://repo.spring.io/snapshot' }
}
}
}
subprojects { subproject ->
apply plugin: 'java'
apply from: "${rootProject.projectDir}/publish-maven.gradle"
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'jacoco'
apply plugin: 'checkstyle'
if (project.hasProperty('platformVersion')) {
apply plugin: 'spring-io'
dependencyManagement {
springIoTestRuntime {
imports {
mavenBom "io.spring.platform:platform-bom:${platformVersion}"
}
}
}
}
compileJava {
sourceCompatibility = 1.7
targetCompatibility = 1.7
}
compileTestJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
ext {
assertjVersion = '3.4.1'
hamcrestVersion = '1.3'
jacksonVersion = '2.6.7'
junitVersion = '4.12'
kafkaVersion = '0.9.0.1'
log4jVersion = '1.2.17'
mockitoVersion = '1.10.19'
scalaVersion = '2.11'
slf4jVersion = '1.7.21'
springRetryVersion = '1.1.3.RELEASE'
springVersion = '4.2.6.RELEASE'
idPrefix = 'kafka'
}
eclipse.project.natures += 'org.springframework.ide.eclipse.core.springnature'
jacoco {
toolVersion = "0.7.2.201409121644"
}
// enable all compiler warnings; individual projects may customize further
[compileJava, compileTestJava]*.options*.compilerArgs = ['-Xlint:all,-options']
test {
// suppress all console output during testing unless running `gradle -i`
logging.captureStandardOutput(LogLevel.INFO)
maxHeapSize = "1024m"
jacoco {
append = false
destinationFile = file("$buildDir/jacoco.exec")
}
}
checkstyle {
configFile = new File(rootDir, "src/checkstyle/checkstyle.xml")
toolVersion = "6.19"
}
jacocoTestReport {
reports {
xml.enabled false
csv.enabled false
html.destination "${buildDir}/reports/jacoco/html"
}
}
build.dependsOn jacocoTestReport
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allJava
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
artifacts {
archives sourcesJar
archives javadocJar
}
}
project ('spring-kafka') {
description = 'Spring Kafka Support'
dependencies {
compile "org.springframework:spring-messaging:$springVersion"
compile "org.springframework.retry:spring-retry:$springRetryVersion"
compile ("org.apache.kafka:kafka-clients:$kafkaVersion") {
exclude group: 'org.slf4j', module: 'slf4j-api'
}
compile ("com.fasterxml.jackson.core:jackson-core:$jacksonVersion", optional)
compile ("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion", optional)
testCompile project (":spring-kafka-test")
testCompile "org.assertj:assertj-core:$assertjVersion"
testCompile "org.springframework:spring-tx:$springVersion"
testRuntime "org.slf4j:slf4j-log4j12:$slf4jVersion"
}
}
project ('spring-kafka-test') {
description = 'Spring Kafka Test Support'
dependencies {
compile "org.springframework:spring-beans:$springVersion"
compile "org.springframework:spring-test:$springVersion"
compile "org.springframework.retry:spring-retry:$springRetryVersion"
compile ("org.apache.kafka:kafka_$scalaVersion:$kafkaVersion") {
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
}
compile ("org.apache.kafka:kafka_$scalaVersion:$kafkaVersion:test") {
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
}
compile ("junit:junit:$junitVersion") {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
compile ("org.mockito:mockito-core:$mockitoVersion") {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
compile ("org.hamcrest:hamcrest-all:$hamcrestVersion", optional)
compile ("org.assertj:assertj-core:$assertjVersion", optional)
}
}
apply plugin: org.asciidoctor.gradle.AsciidoctorPlugin
asciidoctor {
sourceDir file("$docsDir")
sourceDocumentNames = files("$docsDir/index.adoc") // Change in >= 1.5.1
outputDir file("$buildDir/html")
backends = ['html5', 'docbook']
logDocuments = true
options = [
doctype: 'book',
attributes: [
docinfo: '',
toc2: '',
'compat-mode': '',
imagesdir: '',
stylesdir: "stylesheets/",
stylesheet: 'golo.css',
'spring-kafka-version': "$version",
'source-highlighter': 'highlightjs'
]
]
}
apply plugin: DocbookReferencePlugin
reference {
sourceFileName = 'index.xml'
sourceDir = file("$buildDir/html")
pdfFilename = 'spring-kafka-reference.pdf'
expandPlaceholders = ''
}
reference.dependsOn asciidoctor
[asciidoctor, reference, referenceEpub, referenceHtmlMulti, referenceHtmlSingle, referencePdf].each {
it.onlyIf { "$System.env.NO_REFERENCE_TASK" != 'true' || project.hasProperty('ignoreEnvToStopReference') }
}
sonarqube {
properties {
property "sonar.jacoco.reportPath", "${buildDir.name}/jacoco.exec"
property "sonar.links.homepage", linkHomepage
property "sonar.links.ci", linkCi
property "sonar.links.issue", linkIssue
property "sonar.links.scm", linkScmUrl
property "sonar.links.scm_dev", linkScmDevConnection
property "sonar.java.coveragePlugin", "jacoco"
}
}
task api(type: Javadoc) {
group = 'Documentation'
description = 'Generates aggregated Javadoc API documentation.'
title = "${rootProject.description} ${version} API"
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
options.author = true
options.header = rootProject.description
options.overview = 'src/api/overview.html'
source subprojects.collect { project ->
project.sourceSets.main.allJava
}
classpath = files(subprojects.collect { project ->
project.sourceSets.main.compileClasspath
})
destinationDir = new File(buildDir, "api")
}
task docsZip(type: Zip) {
group = 'Distribution'
classifier = 'docs'
description = "Builds -${classifier} archive containing api and reference " +
"for deployment at static.spring.io/spring-kafka/docs."
from('src/dist') {
include 'changelog.txt'
}
from(api) {
into 'api'
}
from (reference) {
into 'reference'
}
}
task distZip(type: Zip, dependsOn: [docsZip]) { //, schemaZip]) {
group = 'Distribution'
classifier = 'dist'
description = "Builds -${classifier} archive, containing all jars and docs, " +
"suitable for community download page."
ext.baseDir = "${project.name}-${project.version}";
from('src/dist') {
include 'readme.txt'
include 'license.txt'
include 'notice.txt'
into "${baseDir}"
}
from(zipTree(docsZip.archivePath)) {
into "${baseDir}/docs"
}
subprojects.each { subproject ->
into ("${baseDir}/libs") {
from subproject.jar
from subproject.sourcesJar
from subproject.javadocJar
}
}
}
/*
// Create an optional "with dependencies" distribution.
// Not published by default; only for use when building from source.
task depsZip(type: Zip, dependsOn: distZip) { zipTask ->
group = 'Distribution'
classifier = 'dist-with-deps'
description = "Builds -${classifier} archive, containing everything " +
"in the -${distZip.classifier} archive plus all dependencies."
from zipTree(distZip.archivePath)
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.hasTask(":${zipTask.name}")) {
def projectName = rootProject.name
def artifacts = new HashSet()
rootProject.configurations.runtime.resolvedConfiguration.resolvedArtifacts.each { artifact ->
def dependency = artifact.moduleVersion.id
if (!projectName.equals(dependency.name)) {
artifacts << artifact.file
}
}
zipTask.from(artifacts) {
into "${distZip.baseDir}/deps"
}
}
}
}
*/
artifacts {
archives distZip
archives docsZip
}
task dist(dependsOn: assemble) {
group = 'Distribution'
description = 'Builds -dist, -docs distribution archives.'
}