Skip to content

Commit

Permalink
KAFKA-2797: Only run rat when in the .git repository since it require…
Browse files Browse the repository at this point in the history
… s the .gitignore to generate the list of files to ignore

Author: Ewen Cheslack-Postava <[email protected]>

Reviewers: Gwen Shapira

Closes apache#485 from ewencp/kafka-2797-disable-rat-when-git-missing
  • Loading branch information
ewencp authored and gwenshap committed Nov 10, 2015
1 parent 590a461 commit fe11488
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit fe11488

Please sign in to comment.