Refactor into 'check-copyright.gradle'

This commit is contained in:
Lanchon 2019-11-17 19:38:09 -03:00
parent 027404b80a
commit f3ffaafe0f
2 changed files with 29 additions and 18 deletions

View File

@ -118,24 +118,7 @@ signing {
} }
} }
task checkCopyrightNotice { apply from: 'check-copyright.gradle'
dependsOn { subprojects*.tasks.build }
def notice = "Copyright 2015-${new java.text.SimpleDateFormat('yyyy').format(new Date())}"
def checkNotice = { noticeFile ->
if (!file(noticeFile).text.contains(notice)) {
System.err.println "******************************** WARNING ********************************"
System.err.println "Expired copyright notice: ${noticeFile}"
System.err.println "***************************************************************************"
}
}
doLast {
checkNotice 'NOTICE.txt'
}
}
build {
dependsOn checkCopyrightNotice
}
wrapper { wrapper {
distributionType = Wrapper.DistributionType.ALL distributionType = Wrapper.DistributionType.ALL

28
check-copyright.gradle Normal file
View File

@ -0,0 +1,28 @@
/*
* multidexlib2 - Copyright 2015-2019 Rodrigo Balerdi
* (GNU General Public License version 3 or later)
*
* multidexlib2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*/
task checkCopyrightNotice {
dependsOn { subprojects*.tasks.build }
def notice = "Copyright 2015-${new java.text.SimpleDateFormat('yyyy').format(new Date())}"
def checkNotice = { noticeFile ->
if (!file(noticeFile).text.contains(notice)) {
System.err.println "******************************** WARNING ********************************"
System.err.println "Expired copyright notice: ${noticeFile}"
System.err.println "***************************************************************************"
}
}
doLast {
checkNotice 'NOTICE.txt'
}
}
build {
dependsOn checkCopyrightNotice
}