Add collect files recursively configuration option

This commit is contained in:
Erik C. Thauvin 2025-05-31 01:44:36 -07:00
parent cebccf754c
commit 71e9ab7f98
Signed by: erik
GPG key ID: 776702A6A2DA330E

View file

@ -353,6 +353,19 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
return cache(Path.of(cache)); return cache(Path.of(cache));
} }
/**
* When specified, any directory mentioned with {@link #inputPaths()} will only be searched for files that are
* direct children. By default, subdirectories are recursively included.
*
* @param collectFilesRecursively whether to collect files recursively or not
* @return this operation
* @since 1.2.4
*/
public PmdOperation collectFilesRecursively(boolean collectFilesRecursively) {
this.collectFilesRecursively_ = collectFilesRecursively;
return this;
}
/** /**
* Sets the default language version to be used for all input files. * Sets the default language version to be used for all input files.
* *
@ -625,6 +638,11 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
// addRelativizeRoots // addRelativizeRoots
config.addRelativizeRoots(relativizeRoots_.stream().toList()); config.addRelativizeRoots(relativizeRoots_.stream().toList());
// collectFilesRecursively
if (!collectFilesRecursively_) {
config.collectFilesRecursively(false);
}
// prependAuxClasspath // prependAuxClasspath
if (prependClasspath_ != null) { if (prependClasspath_ != null) {
config.prependAuxClasspath(prependClasspath_); config.prependAuxClasspath(prependClasspath_);