-
Notifications
You must be signed in to change notification settings - Fork 163
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
Change "setSource", so it also applies the configured filter #715
base: main
Are you sure you want to change the base?
Conversation
fun setSource(source: FileTree): BaseKtLintCheckTask { | ||
sourceFiles = objectFactory | ||
.fileCollection() | ||
.from({ source.matching(patternFilterable) }) |
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.
does this mean the filter is applied twice? since the provider on line 120 also applies the same filter?
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.
Actually this is my first contact with gradle internals so I don't fully understand when these methods are called.
From diffing the debug output of Windows and Linux runs I got the impression, that filesystem changes (inotify et al triggered while generating the stubs) are somehow handled differently.
Thanks for the PR! I have 1 question which I put on the change set itself. |
FYI, out github actions run the full test suite on osx, linux, and windows, so you should be able to add a failing test and see it fail on the windows action (since this seems to be a windows-specific issue). |
I feared that request a bit (and at the same time I would've suggested this, too :-D). |
7e97980
to
215bc02
Compare
which gradle version are you using? this might be an issue that was fixed in gradle itself |
215bc02
to
558bff4
Compare
I've managed to write a unit test which passes on Linux but fails on Windows. |
In the project we're using gradle 8.3 |
thanks for the failing test. the thing about your potential fix, is that it shouldnt make a difference. the way apply the patternFilterable to the FileCollection, it is "live". as files are added to the collection, the filter will be applied to those new files. I wonder if maybe the windows failure is happening b/c the file is created too close to when the ktlint task runs, and maybe windows file system is not actually showing the file yet. |
can you add that test to this branch so I can run the CI checks on it? |
558bff4
to
857992b
Compare
I've dropped the last commit (with the fix in it) from my remote branch, so the only change is the new unit test. |
Hi there, is there anything missing from my side, so the test suite can start? If not: could anyone with the necessary privileges please start the tests? |
3907530
to
390c7a2
Compare
390c7a2
to
49e1c0a
Compare
I've rebased my branch to the latest |
Approving run now. Sorry about the delay |
Ok, this is interesting. The new test fails on my Windows machine. |
In our project we're using gradle-ktlint plus we have a GraphQL API and generate stubs from a schema file.
We have team members working on Linux, MacOS and Windows.
To exclude the generated code from linting and formatting we've added this filter statement to our
build.gradle.kts
:This works fine for our team members using Linux and MacOS.
But the exclude statement is ignored on the Windows machines (which looks a bit like #579 ).
The changes in this PR fix the exclude filter for our team members developing on Windows.
(at the moment we're using version 11.5.0 of the plugin; tests have shown, that with 11.6.0 the filter is still ignored and this patch works, too)