Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Commit

Permalink
Make rat excludes a lazy closure
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme committed Jun 12, 2019
1 parent 17adb5d commit f92e590
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 27 deletions.
53 changes: 28 additions & 25 deletions build.gradle
Expand Up @@ -97,31 +97,34 @@ if (file('.git').exists()) {
// 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(currentDir: project.getRootDir())
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([
'.*\\.asc',
'\\w+/out/.*',
'eth-reference-tests/**',
'build',
'.*/build/**',
'.editorconfig',
'.idea/**',
'gradlew.bat',
'gradlew',
'io/src/test/resources/org/apache/tuweni/io/file/**',
'toml/src/test/resources/**',
'.gitattributes',
'test1.txt',
'test2.txt',
'test3.yaml',
'.*\\.kotlin_module',
'example-v0.4.0.toml',
'hard_example.toml',
'toml-v0.5.0-spec-example.toml',
'test.txt',
'resourceresolver-test.jar'
])
excludes = {
def list = 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
list.addAll([
'.*\\.asc',
'\\w+/out/.*',
'eth-reference-tests/**',
'build',
'.*/build/**',
'.editorconfig',
'.idea/**',
'gradlew.bat',
'gradlew',
'io/src/test/resources/org/apache/tuweni/io/file/**',
'toml/src/test/resources/**',
'.gitattributes',
'test1.txt',
'test2.txt',
'test3.yaml',
'.*\\.kotlin_module',
'example-v0.4.0.toml',
'hard_example.toml',
'toml-v0.5.0-spec-example.toml',
'test.txt',
'resourceresolver-test.jar'
])
return list
}
}
}

Expand Down
5 changes: 3 additions & 2 deletions gradle/rat.gradle
Expand Up @@ -27,14 +27,15 @@ apply plugin: RatPlugin

class RatTask extends DefaultTask {
@Input
List<String> excludes
Closure<List<String>> excludes

def reportDir = project.file('build/rat')
def stylesheet = project.file('gradle/resources/rat-output-to-html.xsl').getAbsolutePath()
def xmlReport = new File(reportDir, 'rat-report.xml')
def htmlReport = new File(reportDir, 'rat-report.html')

def generateXmlReport(File reportDir) {
def excludeList = excludes()
def antBuilder = services.get(IsolatedAntBuilder)
def ratClasspath = project.configurations.rat
def projectPath = project.getRootDir().getAbsolutePath()
Expand All @@ -43,7 +44,7 @@ class RatTask extends DefaultTask {
ant.report(format: 'xml', reportFile: xmlReport) {
fileset(dir: projectPath) {
patternset {
excludes.each { exclude(name: it) }
excludeList.each { exclude(name: it) }
}
}
}
Expand Down

0 comments on commit f92e590

Please sign in to comment.