Files
spring-pulsar/build.gradle
Chris Bono 749f2dbb5e Add spring boot starter module (#56)
Also:
* Clean up dependencies (remove unused)
* Add README in samples how to run w/ new tools/pulsar

Fixes #49
2022-08-07 23:42:43 -05:00

78 lines
1.8 KiB
Groovy

plugins {
id 'io.spring.nohttp'
id 'org.springframework.pulsar.root-project'
id 'org.ajoberstar.grgit' version '4.0.1' apply false
}
description = 'Spring for Apache Pulsar'
def gitPresent = new File('.git').exists()
if (gitPresent) {
apply plugin: 'org.ajoberstar.grgit'
}
ext {
if (gitPresent) {
modifiedFiles = files(grgit.status().unstaged.modified).filter{ f -> f.name.endsWith('.java') }
}
}
allprojects {
group = 'org.springframework.pulsar'
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, "minutes"
}
}
if (hasProperty('buildScan')) {
buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
}
}
nohttp {
allowlistFile = project.file('src/nohttp/allowlist.lines')
source.exclude "**/bin/**"
source.exclude "**/build/**"
source.exclude "**/out/**"
source.exclude "**/target/**"
}
check {
dependsOn checkstyleNohttp
}
subprojects { subproject ->
task updateCopyrights {
onlyIf { gitPresent && !System.getenv('GITHUB_ACTION') }
if (gitPresent) {
inputs.files(modifiedFiles.filter { f -> f.path.contains(subproject.name) })
}
outputs.dir('build')
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.write(sourceCode)
println "Copyright updated for file: $file"
}
break
}
}
}
}
}
}
}