Files
spring-integration-aws/build.gradle
2021-01-27 12:54:36 -05:00

309 lines
8.5 KiB
Groovy

plugins {
id 'java-library'
id 'eclipse'
id 'idea'
id 'jacoco'
id 'org.sonarqube' version '3.0'
id 'checkstyle'
id 'org.ajoberstar.grgit' version '4.1.0'
id "io.spring.dependency-management" version '1.0.11.RELEASE'
id 'com.jfrog.artifactory' version '4.18.2'
}
description = 'Spring Integration AWS Support'
group = 'org.springframework.integration'
repositories {
mavenCentral()
// maven { url 'https://repo.spring.io/libs-staging-local' }
if (version.endsWith('BUILD-SNAPSHOT')) {
maven { url 'https://repo.spring.io/libs-snapshot' }
}
maven { url 'https://repo.spring.io/libs-milestone' }
}
ext {
assertjVersion = '3.18.1'
awaitilityVersion = '4.0.3'
dynamodbLockClientVersion = '1.1.0'
jacksonVersion = '2.11.3'
junitVersion = '5.6.2'
servletApiVersion = '4.0.1'
localstackVersion = '0.2.5'
log4jVersion = '2.13.3'
springCloudAwsVersion = '2.2.5.RELEASE'
springIntegrationVersion = '5.3.5.RELEASE'
kinesisClientVersion = '1.14.0'
kinesisProducerVersion = '0.14.1'
idPrefix = 'aws'
linkHomepage = 'https://github.com/spring-projects/spring-integration-aws'
linkCi = 'https://build.spring.io/browse/INTEXT'
linkIssue = 'https://github.com/spring-projects/spring-integration-aws/issues'
linkScmUrl = 'https://github.com/spring-projects/spring-integration-aws'
linkScmConnection = 'https://github.com/spring-projects/spring-integration-aws.git'
linkScmDevConnection = 'git@github.com:spring-projects/spring-integration-aws.git'
modifiedFiles = files(grgit.status().unstaged.modified).filter{ f -> f.name.endsWith('.java') }
}
ext.javadocLinks = [
'https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/'
] as String[]
compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
java {
withJavadocJar()
withSourcesJar()
registerFeature('optional') {
usingSourceSet(sourceSets.main)
}
}
sourceSets {
test {
resources {
srcDirs = ['src/test/resources', 'src/test/java']
}
}
}
dependencyManagement {
resolutionStrategy {
cacheChangingModulesFor 0, 'seconds'
}
applyMavenExclusions = false
generatedPomCustomization {
enabled = false
}
imports {
mavenBom "org.springframework.cloud:spring-cloud-aws-dependencies:$springCloudAwsVersion"
mavenBom "org.springframework.integration:spring-integration-bom:$springIntegrationVersion"
mavenBom "com.fasterxml.jackson:jackson-bom:$jacksonVersion"
mavenBom "org.junit:junit-bom:$junitVersion"
}
}
jacoco {
toolVersion = '0.8.6'
}
checkstyle {
configDirectory.set(rootProject.file("src/checkstyle"))
toolVersion = '8.38'
}
dependencies {
api 'org.springframework.integration:spring-integration-core'
api 'org.springframework.cloud:spring-cloud-aws-core'
api 'com.fasterxml.jackson.core:jackson-databind'
optionalApi 'org.springframework.cloud:spring-cloud-aws-messaging'
optionalApi 'org.springframework.integration:spring-integration-file'
optionalApi 'org.springframework.integration:spring-integration-http'
optionalApi "com.amazonaws:amazon-kinesis-client:$kinesisClientVersion"
optionalApi "com.amazonaws:amazon-kinesis-producer:$kinesisProducerVersion"
optionalApi 'com.amazonaws:aws-java-sdk-kinesis'
optionalApi 'com.amazonaws:aws-java-sdk-dynamodb'
optionalApi "com.amazonaws:dynamodb-lock-client:$dynamodbLockClientVersion"
optionalApi "javax.servlet:javax.servlet-api:$servletApiVersion"
testImplementation ('org.springframework.integration:spring-integration-test') {
exclude group: 'junit'
}
testImplementation "org.assertj:assertj-core:$assertjVersion"
testImplementation "cloud.localstack:localstack-utils:$localstackVersion"
testImplementation ("org.awaitility:awaitility:$awaitilityVersion") {
exclude group: 'org.hamcrest'
}
testImplementation 'org.junit.jupiter:junit-jupiter-api'
testRuntimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:$log4jVersion"
testRuntimeOnly "org.apache.logging.log4j:log4j-jcl:$log4jVersion"
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
eclipse.project.natures += 'org.springframework.ide.eclipse.core.springnature'
javadoc {
group = 'Documentation'
description = 'Generates the Javadoc API documentation.'
title = "${rootProject.description} ${version} API"
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
options.author = true
options.header = project.description
options.overview = file('src/api/overview.html')
options.stylesheetFile = file('src/api/stylesheet.css')
options.splitIndex = true
options.links(project.ext.javadocLinks)
options.addStringOption('Xdoclint:none', '-quiet')
source = sourceSets.main.allJava
classpath = project.sourceSets.main.compileClasspath
destinationDir = file("$buildDir/api")
// suppress warnings due to cross-module @see and @link references;
// note that global 'api' task does display all warnings.
logging.captureStandardError LogLevel.INFO
logging.captureStandardOutput LogLevel.INFO // suppress "## warnings" message
}
// enable all compiler warnings; individual projects may customize further
ext.xLintArg = '-Xlint:all,-options'
[compileJava, compileTestJava]*.options*.compilerArgs = [xLintArg]
test {
maxHeapSize = '1024m'
jacoco {
destinationFile = file("$buildDir/jacoco.exec")
}
useJUnitPlatform()
// suppress all console output during testing unless running `gradle -i`
logging.captureStandardOutput(LogLevel.INFO)
}
jacocoTestReport {
reports {
xml.enabled false
csv.enabled false
html.destination file("$buildDir/reports/jacoco/html")
}
}
check.dependsOn javadoc
build.dependsOn jacocoTestReport
task updateCopyrights {
onlyIf { !System.getenv('TRAVIS') && !System.getenv('bamboo_buildKey') }
inputs.files(modifiedFiles)
outputs.dir("$buildDir/classes")
doLast {
def now = Calendar.instance.get(Calendar.YEAR) as String
inputs.files.each { file ->
def line
file.withReader { reader ->
while (line = reader.readLine()) {
def matcher = line =~ /Copyright (20\d\d)-?(20\d\d)?/
if (matcher.count) {
def beginningYear = matcher[0][1]
if (now != beginningYear && now != matcher[0][2]) {
def years = "$beginningYear-$now"
def sourceCode = file.text
sourceCode = sourceCode.replaceFirst(/20\d\d(-20\d\d)?/, years)
file.text = sourceCode
println "Copyright updated for file: $file"
}
break
}
}
}
}
}
}
compileJava.dependsOn updateCopyrights
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 schemaZip(type: Zip) {
group = 'Distribution'
archiveClassifier = 'schema'
description = "Builds -${archiveClassifier} archive containing all " +
"XSDs for deployment at static.springframework.org/schema."
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
Properties schemas = new Properties();
def shortName = idPrefix.replaceFirst("${idPrefix}-", '')
project.sourceSets.main.resources.find {
it.path.endsWith("META-INF${File.separator}spring.schemas")
}?.withInputStream { schemas.load(it) }
for (def key : schemas.keySet()) {
File xsdFile = project.sourceSets.main.resources.find {
it.path.replaceAll('\\\\', '/').endsWith(schemas.get(key))
}
assert xsdFile != null
into("integration/${shortName}") {
from xsdFile.path
}
}
}
task docsZip(type: Zip) {
group = 'Distribution'
archiveClassifier = 'docs'
description = "Builds -${archiveClassifier} archive containing the JavaDoc api " +
"for deployment at static.springframework.org/spring-integration/docs."
from('.') {
include 'README.md'
}
from(javadoc) {
into 'api'
}
}
task distZip(type: Zip, dependsOn: [docsZip, schemaZip]) {
group = 'Distribution'
archiveClassifier = 'dist'
description = "Builds -${archiveClassifier} archive, containing all jars and docs, " +
"suitable for community download page."
ext.baseDir = "${project.name}-${project.version}";
from('src/dist') {
include 'license.txt'
include 'notice.txt'
into "${baseDir}"
}
from('.') {
include 'README.md'
into "${baseDir}"
}
from(zipTree(schemaZip.archiveFile)) {
into "${baseDir}/schema"
}
into("${baseDir}/libs") {
from project.jar
from project.sourcesJar
from project.javadocJar
}
}
task dist(dependsOn: assemble) {
group = 'Distribution'
description = 'Builds -dist, -docs and -schema distribution archives.'
}
apply from: "${rootProject.projectDir}/publish-maven.gradle"