-
Notifications
You must be signed in to change notification settings - Fork 152
Issue #980: Replace AntBuilder.copy() with Files.walkFileTree() #1006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #980: Replace AntBuilder.copy() with Files.walkFileTree() #1006
Conversation
romani
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question
checkstyle-tester/diff.groovy
Outdated
| FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) { | ||
|
|
||
| if (vcsDirectories.contains(dir.fileName?.toString())) { | ||
| return FileVisitResult.SKIP_SUBTREE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we copy all files as is ?
Copy code should be simple copy without any context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the VCS exclusions (.git, .svn, etc.) to match the original AntBuilder.copy() behavior, which applies Ant's "defaultexcludes" by default. Without these exclusions, we would copy .git/ directories and other VCS artifacts like .gitignore, .gitattributes, which is unnecessary since these files are not needed for Checkstyle analysis. However, if you prefer a simpler copy without context, I can remove these exclusions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you share link to any implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not see that need some filtering out, we just copy folders, extra hidden folders to copy should be ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Official Ant Documentation: https://ant.apache.org/manual/dirtasks.html#defaultexcludes
Ant Source Code (DirectoryScanner.java):
https://github.com/apache/ant/blob/f862774a9e2d2afe3d25d7116f0672eeb4f3e9bf/src/main/org/apache/tools/ant/DirectoryScanner.java#L170
When Copy.java needs to copy files, it calls FileSet.getDirectoryScanner() to get the list of files. Internally, FileSet creates a DirectoryScanner which automatically calls addDefaultExcludes() to add VCS patterns to its exclude list. The scanner then returns only non-excluded files to Copy, so VCS directories are never copied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not see that need some filtering out, we just copy folders, extra hidden folders to copy should be ok
Will update accordingly..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
41f387f to
3349663
Compare
|
lets try one more time .... |
|
triggered checkstyle/checkstyle#18312 (comment) |
|
triggered checkstyle/checkstyle#17575 (comment) |
|
CI is tested at checkstyle/checkstyle#18184 (review) Works well. |
|
This time all works. |
Issue #980:
What is fixed:
targetDir.startsWith(sourceDir)→dir.startsWith(destinationDir)since some of the valid directories were getting skipped which caused ci errors.Why earlier code failed:
Improvements:
.git,.svn,.hg,CVS, etc.).gitignore,.gitattributes, etc.)defaultexcludesbehavior