hierynomus / license-gradle-plugin

Manage your license(s)
http://www.javadude.nl
Other
406 stars 114 forks source link

Add support for per-document properties #118

Open dbathgate opened 8 years ago

dbathgate commented 8 years ago

The newer version of the license-maven-plugin (http://code.mycila.com/license-maven-plugin/) supports adding per-document properties. I am specifying looking to be able to add the file name to the header.

The following commit adds the file.name property to each header. https://github.com/dbathgate/license-gradle-plugin/commit/820920e4bab4296adbfbc905be9389451b383d46

I was considering opening a PR with this change, but I was thinking though that the better way to implement this is to add a Closure that would allow a per document property configuration.

Example:

license {
    header rootProject.file('codequality/HEADER')
    ext.year = Calendar.getInstance().get(Calendar.YEAR)
    include "**/*.java"

    perDocumentProperties {
        ext.fileName = document.file.name
    }
}
dbathgate commented 8 years ago

Here is my attempt to add the described closure in the previous comment: https://github.com/dbathgate/license-gradle-plugin/commit/3031c1e37dfc6bfd6db63b7c6ccb3c6104397ebe

Haven't been able to get this working yet