Merge pull request #14790 from rjernst/less_forbidden
Use a marker file to indicate forbidden patterns has run
This commit is contained in:
commit
e10745e2a8
|
@ -21,6 +21,7 @@ package org.elasticsearch.gradle.precommit
|
||||||
import org.gradle.api.DefaultTask
|
import org.gradle.api.DefaultTask
|
||||||
import org.gradle.api.file.FileCollection
|
import org.gradle.api.file.FileCollection
|
||||||
import org.gradle.api.tasks.InputFiles
|
import org.gradle.api.tasks.InputFiles
|
||||||
|
import org.gradle.api.tasks.OutputFile
|
||||||
import org.gradle.api.tasks.OutputFiles
|
import org.gradle.api.tasks.OutputFiles
|
||||||
import org.gradle.api.tasks.SourceSet
|
import org.gradle.api.tasks.SourceSet
|
||||||
import org.gradle.api.tasks.TaskAction
|
import org.gradle.api.tasks.TaskAction
|
||||||
|
@ -36,6 +37,9 @@ class ForbiddenPatternsTask extends DefaultTask {
|
||||||
Map<String,String> patterns = new LinkedHashMap<>()
|
Map<String,String> patterns = new LinkedHashMap<>()
|
||||||
PatternFilterable filesFilter = new PatternSet()
|
PatternFilterable filesFilter = new PatternSet()
|
||||||
|
|
||||||
|
@OutputFile
|
||||||
|
File outputMarker = new File(project.buildDir, "markers/forbiddenPatterns")
|
||||||
|
|
||||||
ForbiddenPatternsTask() {
|
ForbiddenPatternsTask() {
|
||||||
// we always include all source files, and exclude what should not be checked
|
// we always include all source files, and exclude what should not be checked
|
||||||
filesFilter.include('**')
|
filesFilter.include('**')
|
||||||
|
@ -94,6 +98,7 @@ class ForbiddenPatternsTask extends DefaultTask {
|
||||||
if (failures.isEmpty() == false) {
|
if (failures.isEmpty() == false) {
|
||||||
throw new IllegalArgumentException('Found invalid patterns:\n' + failures.join('\n'))
|
throw new IllegalArgumentException('Found invalid patterns:\n' + failures.join('\n'))
|
||||||
}
|
}
|
||||||
|
outputMarker.setText('done', 'UTF-8')
|
||||||
}
|
}
|
||||||
|
|
||||||
// iterate through patterns to find the right ones for nice error messages
|
// iterate through patterns to find the right ones for nice error messages
|
||||||
|
|
Loading…
Reference in New Issue