Commits

David Carr committed dd91f9e

build: start using license plugin

Comments (0)

Files changed (4)

 buildscript {
     apply from: 'gradle/Bintray.gradle'
+    apply from: 'gradle/buildscript.gradle', to: buildscript
 }
+
 repositories {
     bintray.jcenter()
 }
 apply from: 'gradle/coordinates.gradle'
 apply from: 'gradle/convention.gradle'
 apply from: 'gradle/maven.gradle'
+apply from: 'gradle/license.gradle'
 
 dependencies {
     compile gradleApi()

codequality/HEADER.txt

+Copyright ${year} ${copyrightHolder}
+
+Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
+compliance with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software distributed under the License is
+distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and limitations under the License.

gradle/buildscript.gradle

+repositories {
+    bintray.jcenter()
+}
+
+dependencies {
+    classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.6.0'
+}

gradle/license.gradle

+apply plugin: 'license'
+
+license {
+    header rootProject.file('codequality/HEADER.txt')
+    skipExistingHeaders true
+
+    ext.year = Calendar.getInstance().get(Calendar.YEAR)
+    ext.copyrightHolder = project.hasProperty('license.copyrightHolder') ? project.property('license.copyrightHolder') : System.getProperty('user.name')
+}
+
+// TODO: use withType(License) when GRADLE-2363 is fixed
+tasks.matching {it.getClass().name.contains('nl.javadude.gradle.plugins.license.License')}.all { task ->
+    task.exclude '**/*.properties'
+    task.exclude '**/*.orig'
+    task.exclude '**/*.rej'
+}