Run RAT check only on files tracked by git#4499
Conversation
dsmiley
left a comment
There was a problem hiding this comment.
Thanks for addressing this problem -- it annoys me too.
I forgot if Lucene has moved onto a newer RAT release that addresses this natively... 50/50 chance I checked and saw but Lucene's build has move don a way from us.
- use JGit to find tracked files
Lucene moved away from RAT to a custom build-src java class, see apache/lucene#15195. If anyone feels there is a reason for us to so similar, let that be a separate effort. Also, RAT has as a newer version which includes tracked file handling as a native feature, but the way we hold it (we use the Ant task programatically) we'd not benefit from that automatically. If RAT only would publish a gradle plugin, not just a maven one. Update There is a 3rd party RAT gradle plugin we could also consider, but it does not natively support excluding non-tracked files either. This PR now
|
- XmlParser - project.buildDir - task() - @name[0]
|
will this work then in tne cherrypick script? that is where i get bit by this a lot! |
Yes, we explicitly enabled RAT in cherry-pick script and it requires a completely clean working area which is stupid, for the task it does. We have other checks that confirm that a git checkout is clean. This should fix it.. |
| // Don't check under the project's build folder. | ||
| exclude project.buildDir.name | ||
| exclude project.layout.buildDirectory.get().asFile.name | ||
|
|
There was a problem hiding this comment.
this should be a redundant check now
There was a problem hiding this comment.
We should no longer have to exclude .idea .muse .git
There was a problem hiding this comment.
I assume we can now omit eclipse config files (not git tracked)
| // At the module scope we only check selected file patterns as folks have various .gitignore-d resources | ||
| // generated by IDEs, etc. | ||
| // The git index filter above excludes untracked files. These patterns | ||
| // further narrow the scan to file types that should carry license headers. |
There was a problem hiding this comment.
how does "include" accomplish narrow-ing? ;-)
Now, if you have a file that in your repo that is not tracked by git, and is even in .gitignore, the RAT source scan will still complain about license header. This is annoying if you have e.g. AI tool that stores some content in the repo folder but which is ignored.
This PR filters so that RAT only cares about tracked files.