KAFKA-2797: Only run rat when in the .git repository since it require s the .gitignore to generate the list of files to ignore

Author: Ewen Cheslack-Postava <me@ewencp.org>

Reviewers: Gwen Shapira

Closes #485 from ewencp/kafka-2797-disable-rat-when-git-missing
This commit is contained in:
Ewen Cheslack-Postava 2015-11-10 10:17:13 -08:00 committed by Gwen Shapira
parent 590a4616a1
commit fe11488a77
1 changed files with 18 additions and 16 deletions

View File

@ -60,23 +60,25 @@ ext {
apply from: file('wrapper.gradle')
apply from: file('scala.gradle')
apply from: file('gradle/rat.gradle')
rat {
// Exclude everything under the directory that git should be ignoring via .gitignore or that isn't checked in. These
// restrict us only to files that are checked in or are staged.
def repo = Grgit.open(project.file('.'))
excludes = new ArrayList<String>(repo.clean(ignore: false, directories: true, dryRun: true))
// And some of the files that we have checked in should also be excluded from this check
excludes.addAll([
'**/.git/**',
'**/build/**',
'CONTRIBUTING.md',
'gradlew',
'gradlew.bat',
'**/README.md',
'.reviewboardrc'
])
if (new File('.git').exists()) {
apply from: file('gradle/rat.gradle')
rat {
// Exclude everything under the directory that git should be ignoring via .gitignore or that isn't checked in. These
// restrict us only to files that are checked in or are staged.
def repo = Grgit.open(project.file('.'))
excludes = new ArrayList<String>(repo.clean(ignore: false, directories: true, dryRun: true))
// And some of the files that we have checked in should also be excluded from this check
excludes.addAll([
'**/.git/**',
'**/build/**',
'CONTRIBUTING.md',
'gradlew',
'gradlew.bat',
'**/README.md',
'.reviewboardrc'
])
}
}
subprojects {