rmuir commented on code in PR #15200:
URL: https://github.com/apache/lucene/pull/15200#discussion_r2360153454
##########
build-tools/build-infra/src/main/java/org/apache/lucene/gradle/plugins/licenses/CheckLicensesPlugin.java:
##########
@@ -48,79 +53,96 @@ public void apply(Project project) {
private void configureCheckLicenses(CheckLicensesTask task) {
Project project = task.getProject();
-
task.getReportFile().set(project.getLayout().getBuildDirectory().file("licenses-report.txt"));
- task.getFiles()
- .from(
- project.fileTree(
- ".",
- tree -> {
- // Exclude build outputs, ide files, .git.
- tree.exclude(".git");
- tree.exclude(".idea");
- tree.exclude(".muse");
- tree.exclude("**/build/**");
- tree.exclude("**/.gradle");
+ assert project.getRootProject() == project;
+ var allNonIgnoredFiles =
+
project.getExtensions().getByType(GitInfoExtension.class).getAllNonIgnoredProjectFiles();
- // Exclude generated stuff.
- tree.exclude("**/src/generated/**");
+
task.getReportFile().set(project.getLayout().getBuildDirectory().file("licenses-report.txt"));
- // Exclude github stuff (templates, workflows).
- tree.exclude(".github");
+ // Build a list of files excluded from the license check. Just reuse ant's
glob patterns.
+ var rootDir = getProjectRootPath(project);
+ var excludedPaths =
+ List.of(
+ // Ignore binary files. Previously we used apache rat, which had a
'binary guesser'
+ // but it's faster to just exclude by name (rather than scan the
file).
+ "**/*.adoc",
+ "**/*.bin",
+ "**/*.brk",
+ "**/*.bz2",
+ "**/*.dat",
+ "**/*.gif",
+ "**/*.gz",
+ "**/*.png",
+ "**/*.svg",
+ "**/*.xls",
+ "**/*.zip",
Review Comment:
as a followup any of these we have, maybe we can configure in
.gitattributes. at least `git grep` will then recognize it as binary, and
possibly github. Especially useful for .svg which isnt "really" binary but is
annoying AF in search results and diffs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]