check-copyright.gradle 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * multidexlib2 - Copyright 2015-2020 Rodrigo Balerdi
  3. * (GNU General Public License version 3 or later)
  4. *
  5. * multidexlib2 is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published
  7. * by the Free Software Foundation, either version 3 of the License,
  8. * or (at your option) any later version.
  9. */
  10. import java.text.SimpleDateFormat
  11. task checkCopyrightNotice {
  12. dependsOn { subprojects*.tasks.build }
  13. def notice = "Copyright 2015-${new SimpleDateFormat('yyyy').format(new Date())}"
  14. def checkNotice = { noticeFile ->
  15. if (!file(noticeFile).text.contains(notice)) {
  16. System.err.println "******************************** WARNING ********************************"
  17. System.err.println "Expired copyright notice: ${noticeFile}"
  18. System.err.println "***************************************************************************"
  19. }
  20. }
  21. doLast {
  22. checkNotice 'NOTICE.txt'
  23. }
  24. }
  25. build {
  26. dependsOn checkCopyrightNotice
  27. }