Skip to content

Commit

Permalink
Enable Checkstyle for checking license headers (#1242)
Browse files Browse the repository at this point in the history
* Enable Checkstyle for checking license headers

* Enable license check for all subprojects and fix test license headers

* Apply license task to all projects
  • Loading branch information
TimvdLippe committed Nov 5, 2017
1 parent 81d90ae commit ae314e5
Show file tree
Hide file tree
Showing 40 changed files with 163 additions and 18 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -32,12 +32,12 @@ apply from: 'gradle/root/ide.gradle'
apply from: 'gradle/root/gradle-fix.gradle'
apply from: 'gradle/root/java6-compatibility.gradle'
apply from: 'gradle/java-library.gradle'
apply from: 'gradle/license.gradle'
apply from: 'gradle/root/coverage.gradle'

apply from: 'gradle/mockito-core/inline-mock.gradle'
apply from: 'gradle/mockito-core/osgi.gradle'
apply from: 'gradle/mockito-core/javadoc.gradle'
apply from: 'gradle/mockito-core/license.gradle'
apply from: 'gradle/mockito-core/testing.gradle'

apply from: 'gradle/dependencies.gradle'
Expand Down
4 changes: 4 additions & 0 deletions config/checkstyle/checkstyle.xml
Expand Up @@ -27,5 +27,9 @@
<property name="processJavadoc" value="true"/>
</module>
</module>
<module name="RegexpHeader">
<property name="headerFile" value="config/checkstyle/java.header"/>
<property name="fileExtensions" value="java"/>
</module>
</module>

4 changes: 4 additions & 0 deletions config/checkstyle/java.header
@@ -0,0 +1,4 @@
^/\*$
^ \* Copyright \(c\) \d\d\d\d Mockito contributors$
^ \* This program is made available under the terms of the MIT License.$
^ \*/$
4 changes: 2 additions & 2 deletions doc/licenses/HEADER.txt
@@ -1,2 +1,2 @@
Copyright (c) ${year} ${name}
This program is made available under the terms of the MIT License.
Copyright (c) ${year} Mockito contributors
This program is made available under the terms of the MIT License.
16 changes: 16 additions & 0 deletions gradle/license.gradle
@@ -0,0 +1,16 @@
def licenseHeaderFile = rootProject.file('doc/licenses/HEADER.txt')

allprojects {
apply plugin: 'com.github.hierynomus.license'
license {
header = licenseHeaderFile
strictCheck = true
ignoreFailures = true
skipExistingHeaders = true
mapping {
java = 'SLASHSTAR_STYLE'
groovy = 'SLASHSTAR_STYLE'
}
ext.year = Calendar.getInstance().get(Calendar.YEAR)
}
}
14 changes: 0 additions & 14 deletions gradle/mockito-core/license.gradle

This file was deleted.

4 changes: 4 additions & 0 deletions src/main/java/org/mockito/CheckReturnValue.java
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockito;

import java.lang.annotation.ElementType;
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockitousage.bugs;

import org.junit.Before;
Expand Down
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2007 Mockito contributors This program is made available under the terms of the MIT License.
* Copyright (c) 2007 Mockito contributors
* This program is made available under the terms of the MIT License.
*/

package org.mockitousage.verification;
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockito.android.internal.creation;

import org.mockito.internal.creation.bytebuddy.SubclassByteBuddyMockMaker;
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockito.android.internal.creation;

import static org.mockito.internal.util.StringUtil.join;
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockito.android.internal.creation;

import java.io.File;
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockitousage.plugins.stacktrace;

import org.mockito.exceptions.stacktrace.StackTraceCleaner;
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockitousage.plugins.switcher;

import org.mockito.internal.creation.bytebuddy.SubclassByteBuddyMockMaker;
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockitousage.plugins.switcher;

import org.mockito.plugins.PluginSwitch;
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockitoinline;

import org.junit.Test;
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockitoinline;

import org.junit.Test;
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockitoinline;

import java.util.Collections;
Expand Down
@@ -1,3 +1,7 @@
/**
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockito.kotlin

import org.junit.Test
Expand Down
@@ -1,3 +1,7 @@
/**
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockito.kotlin

import kotlinx.coroutines.experimental.runBlocking
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockito.testng;

import org.mockito.Mock;
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockito.testng;

import org.mockito.Captor;
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockito.testng;

import org.testng.IInvokedMethod;
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockitousage.testng;

import org.mockito.ArgumentCaptor;
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockitousage.testng;

import org.mockito.ArgumentCaptor;
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockitousage.testng;

import org.mockito.Mock;
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockitousage.testng;

import org.mockito.Mock;
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockitousage.testng;

import org.mockito.Mock;
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockitousage.testng;

import org.mockito.Mock;
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockitousage.testng;

import org.mockito.InjectMocks;
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockitousage.testng;

import org.mockito.Mock;
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockitousage.testng;

import org.testng.annotations.Test;
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockitousage.testng;

import java.util.List;
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockitousage.testng;

import org.mockito.ArgumentCaptor;
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockitousage.testng.failuretests;

import org.mockito.Mock;
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockitousage.testng.failuretests;

import org.mockito.exceptions.misusing.InvalidUseOfMatchersException;
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockitousage.testng.failuretests;

import org.mockito.Mock;
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockitousage.testng.failuretests;

import org.mockito.exceptions.base.MockitoException;
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright (c) 2017 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockitousage.testng.utils;

import org.testng.IConfigurationListener;
Expand Down
6 changes: 6 additions & 0 deletions subprojects/testng/src/test/resources/mockito-testng.xml
@@ -1,4 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2017 Mockito contributors
This program is made available under the terms of the MIT License.
-->
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Mockito TestNG usage" parallel="none">
<test verbose="1" name="Mockito TestNG Integration" annotations="JDK">
Expand Down

0 comments on commit ae314e5

Please sign in to comment.