-
-
Notifications
You must be signed in to change notification settings - Fork 86
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
ensure exclusions win over inclusions for scanning #172
ensure exclusions win over inclusions for scanning #172
Conversation
@rmannibucau shouldn't this be suggested as default implementation of |
@McFoggy I don't know, can clearly discuss it but I fear some plugins will use that as a feature (binary scanners out of my head which scan target more than src) so it will likely end up with a flag which is more or less the exact same impact for this plugin (+ it is way faster to include and release like that). |
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.
@rmannibucau : I completely agree with the change, and it would be nice to see if we can have it for 4.0.rc1, but this PR cannot be merged as-is because:
- there is no unit test
- there is a behavioral change compared to before, so to activate this feature, we would need another boolean flag in the plug-in such as
exclusionPriority
set to false by default - the README should be updated to warn users about this new feature
- we need to keep consistency with how scanning works across maven plugins. Have you check what other maven modules are doing ? So they prioritize exclusion too ? How to they wire the directory scanner ?
Thanks 😊
@mathieucarbou the PR from Romain should not change the behavior, ie the final result, unless DirectoryScanner itself is wrong or broken. It will "just" allow to exclude some files faster than before.
@rmannibucau I was not saying that we should not integrate it here as a workaround of the bad performance behavior the standard DirectoryScanner. Let's be pragmatic by opening an issue/PR at maven-shared-utils and integrate this PR as a performance workaround until the issue is resolved in the right place. |
@mathieucarbou @McFoggy updated the PR, migrated to maven-shared-utils (plugin was using plexus) and added a flag to be able to implement this behavior, MSU scanner has an API for that but it is not the default (guess for compatibility too). Side note: I'm not sure the meaning of the defaults of the plugin without this flag on though since it will visit the ignored folders but ignore the found files but while we can deactivate this very slow behavior I'm happy. |
@McFoggy : how sure you are ? We are safe in your opinion to have that as a default behavior and safely remove the boolean flag ? @rmannibucau : thank you for the PR update. Could you plese rebase with the latest changes ? There has been a big PR merged. |
65877c4
to
33a3046
Compare
@mathieucarbou rebased (but it broke config no?). BTW the change is safe cause today excluded files end up in getExcludedFiles and this is not used by the plugin so this collection is useless in this context. In other words, getExcludedFiles will no more be populated with my change but since it is not queried anyway it does not change anything functionally for the plugin. |
Ok i see. Understand more. I thought your changes could potentially change the outcome of the scanner. But it only makes it faster. I was confused. So yes, let's make that the default behavior and remove this Boolean flag that I proposed to add since the current behavior (current outcome of the scanner) is preserved. This is just an optimization that you are adding and I thought that the scanner outcome could potentially change. |
done |
@rmannibucau : build is failing:
|
@mathieucarbou windows I assumed? pushed a commit about it but didn't test it |
no, it's building on Ubuntu... |
@mathieucarbou hmm, i can't reproduce either in intellij nor in CLI. Any possibility the temp folder matches the exclusion and is not /tmp as the default? |
I ran into some issues one day about the tmp folder in docker... You could try by creating the tmp directories in the target folder, by passing the "target" folder as a root of the junit rule perhaps. |
@mathieucarbou can you give a try setting this exclude array in the test please:
? |
Would be far easier for you to continue handling your PR. |
@mathieucarbou agree but since I can't reproduce it is mainly random guess tries. Any way to reproduce it, you mentionned docker, is the setup documented anywhere? |
the travis build is using openjdk7
|
@rmannibucau : reason I am asking you to handle the PR until it is complete is because on my side I do not have time to help now (2y old kid at home + newborn). I can only review / merge / release with the time I have. @McFoggy and @adamretter are on the MLP team and can also help you and review / merge once the problem is found, but they also have limited time. This is the only last PR before I trigger a 4.0.rc1 release. It would be nice to have this improvement. But if you think that solving this issue will take time, I can still trigger the 4.0.rc1 release without this PR and trigger an rc2 after 😄 Thanks everybody for your help 👍 |
b060a2c
to
e5ba473
Compare
Think I spotted the issue, will fix it now |
using maven shared utils and adding a flag to have a fast scan
0f1b162
to
20faa4d
Compare
Should be good now, perf improvement is not that impressive but it /2 and impl is correct now ;) |
You're welcome! Let's get a release now :-) |
If any inclusion is "**anything" then DirectoryScanner will browse excluded folders. It completely defeats most of exclusions and typically let the plugin go through target and node_modules which can be very time consuming.
With this patch, my license check (only) went from 25s to 2.5s.