dsmiley commented on code in PR #4569:
URL: https://github.com/apache/solr/pull/4569#discussion_r3493172448
##########
gradle/validation/rat-sources.gradle:
##########
@@ -104,84 +108,99 @@ allprojects {
description = 'Runs Apache Rat checks.'
ratClasspath.from(rootProject.configurations.ratDeps)
+
ratConfig.set(rootProject.layout.projectDirectory.file("gradle/validation/rat-config.xml"))
def defaultScanFileTree = project.fileTree(projectDir, {
- // Only check files tracked by git — skip untracked/gitignored files
- // (IDE artifacts, AI assistant configs, etc.)
def trackedFiles = gitTrackedFiles(projectDir)
if (trackedFiles != null) {
- exclude { element ->
- // Allow directories through (they are just containers), exclude
untracked files
- !element.isDirectory() &&
!trackedFiles.contains(element.relativePath.pathString)
- }
+ // Git checkout: only scan files in the git index — naturally excludes
build
+ // output, gitignored files, and untracked files without explicit
patterns.
+ include { f -> f.isDirectory() ||
trackedFiles.contains(f.relativePath.pathString) }
+
+ // The following are excluded from the source release, thus no header
needed
+ exclude "dev-docs"
+ exclude "**/AGENTS.md"
+ exclude "**/.*" // e.g. .gradle, .github, .junie, .gitignore, etc.
+ } else {
+ // Source release (no git): scan everything, exclude generated/ignored
paths manually.
+ include "**"
Review Comment:
key change here, esp. for the source release validation (smoketester).
Include all by default.
##########
gradle/validation/validate-source-patterns.gradle:
##########
Review Comment:
Instead of tying this to RAT, the needs are too simple/basic to warrant that
coupling.
##########
gradle/validation/rat-sources.gradle:
##########
@@ -104,84 +108,99 @@ allprojects {
description = 'Runs Apache Rat checks.'
ratClasspath.from(rootProject.configurations.ratDeps)
+
ratConfig.set(rootProject.layout.projectDirectory.file("gradle/validation/rat-config.xml"))
def defaultScanFileTree = project.fileTree(projectDir, {
- // Only check files tracked by git — skip untracked/gitignored files
- // (IDE artifacts, AI assistant configs, etc.)
def trackedFiles = gitTrackedFiles(projectDir)
if (trackedFiles != null) {
- exclude { element ->
- // Allow directories through (they are just containers), exclude
untracked files
- !element.isDirectory() &&
!trackedFiles.contains(element.relativePath.pathString)
- }
+ // Git checkout: only scan files in the git index — naturally excludes
build
+ // output, gitignored files, and untracked files without explicit
patterns.
+ include { f -> f.isDirectory() ||
trackedFiles.contains(f.relativePath.pathString) }
+
+ // The following are excluded from the source release, thus no header
needed
+ exclude "dev-docs"
+ exclude "**/AGENTS.md"
+ exclude "**/.*" // e.g. .gradle, .github, .junie, .gitignore, etc.
+ } else {
+ // Source release (no git): scan everything, exclude generated/ignored
paths manually.
+ include "**"
}
- // Exclude the build directory — even though it's not git-tracked, Gradle
- // validates input/output overlaps at configuration time before the git
- // filter closure runs, so this must be excluded explicitly.
exclude project.layout.buildDirectory.get().asFile.name
- // similarly, at least one subproject writes to .gradle/ for config/setup
- exclude ".gradle/**"
// Don't check any of the subprojects - they have their own rat tasks.
- exclude subprojects.collect {it.projectDir.name}
-
- // The git index filter above excludes untracked files. These include
- // patterns select the file types that should carry license headers.
- include "**/*.xml"
- include "**/*.md"
- include "**/*.py"
- include "**/*.sh"
- include "**/*.bat"
- include "**/*.gradle"
-
- // Include selected patterns from any source folders. We could make this
- // relative to source sets but it seems to be of little value - all our
source sets
- // live under 'src' anyway.
- include "src/**"
- exclude "src/**/*.png"
- exclude "src/**/*.txt"
- exclude "src/**/*.zip"
- exclude "src/**/*.properties"
- exclude "src/**/*.utf8"
- exclude "src/**/*.svg"
- exclude "src/**/*.csv"
-
- // TODO: SOLR-15601: Some of these should carry the license, perhaps?
- exclude "**/*.html"
+ exclude subprojects.collect {
+
projectDir.toPath().relativize(it.projectDir.toPath()).toString().replace('\\',
'/')
Review Comment:
was overly simple before, thus would exclude any "core" dir anywhere for
example
--
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]