Fix updateCopyrights Gradle task

* Do not modify files which already has an actual year in the Copyright
* Make it to be performed really before any compilation, there change
to `compileKotlin.dependsOn updateCopyrights`
This commit is contained in:
Artem Bilan
2019-02-14 13:42:48 -05:00
parent fe5d0affde
commit d38db25fb7

View File

@@ -228,7 +228,7 @@ subprojects { subproject ->
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]) {
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)
@@ -243,7 +243,7 @@ subprojects { subproject ->
}
}
processResources.dependsOn updateCopyrights
compileKotlin.dependsOn updateCopyrights
jacocoTestReport {
reports {