license-gradle-plugin icon indicating copy to clipboard operation
license-gradle-plugin copied to clipboard

Year based on Git

Open pavolloffay opened this issue 8 years ago • 4 comments
trafficstars

Hello,

is there a way to set a year in a header based on Git date?

e.g. File created this year: 2017 File created in 2016 and touched this year 2016-2017

pavolloffay avatar Jun 20 '17 09:06 pavolloffay

Not out of the box, you would need to load the git history and filter it per file.

2017-06-20 11:23 GMT+02:00 Pavol Loffay [email protected]:

Hello,

is there a way to set a year in a header based on Git date?

e.g. File created this year: 2017 File created in 2016 and touched this year 2016-2017

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hierynomus/license-gradle-plugin/issues/140, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHLo71WEDY_xjku8ZKHV8uiuO5ul2hDks5sF4-IgaJpZM4N_T0v .

hierynomus avatar Jun 20 '17 09:06 hierynomus

Do you have a code snippet for it? I think this is the mostly used in maven based license checks.

pavolloffay avatar Jun 20 '17 11:06 pavolloffay

You could extend the license-gradle-plugin with the license-maven-plugin-git since the gradle plugin is based on the mvn one.

https://github.com/mycila/license-maven-plugin/tree/master/license-maven-plugin-git#how-to-use-license-maven-plugin-git

RiRomain avatar Jun 23 '17 14:06 RiRomain

I come here from @aalmiray's Kordamp Licensing Plugin, which applies this plugin.

I'm also looking for "wiser" copyright year ranges, which would reflect file creation time and last modification time. Having fixed ${inceptionYear}-${currentYear} doesn't feel good.

Note that it's how OpenJDK does it:

  • 2018: file created in 2018, and not modified in 2019 (example)
  • 2014-2019: file created in 2014 and last modified in 2019 (example)
  • 2019: file created in 2019 (example)

@hierynomus, any chances you would provide such functionality? 🙂

tlinkowski avatar Mar 12 '19 14:03 tlinkowski