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
Added ability to include/exclude paths via real regex #536
Added ability to include/exclude paths via real regex #536
Conversation
700b4ef
to
6b97759
Compare
…mance boost on large project (5:48 -> 2:02 min total duration). - Changed signature of methods to accept String as path instead of RelocatePathContext/RelocateClassContext to prevent unnecessary allocations for builder objects - Added extra string length checks to avoid string operations where possible - Reordered checks in canRelocateClass so that expensive string replacement is the last operation - (Main Optimization) Avoided string concatenation (which led to creating StringBuilder instances and expensive array copy operations) by adding check for first character being '/': if so - perform a startsWith check with an offset. - Removed an incorrect length check - Moved context creation outside the loop
…mance boost on large project (5:48 -> 2:02 min total duration). - Changed signature of methods to accept String as path instead of RelocatePathContext/RelocateClassContext to prevent unnecessary allocations for builder objects - Added extra string length checks to avoid string operations where possible - Reordered checks in canRelocateClass so that expensive string replacement is the last operation - (Main Optimization) Avoided string concatenation (which led to creating StringBuilder instances and expensive array copy operations) by adding check for first character being '/': if so - perform a startsWith check with an offset.
Moved context creation outside the loop (cherry picked from commit 8476da7)
(cherry picked from commit 076df6211d01a1a9904a741566d645e9ab36c118)
6b97759
to
2791ec6
Compare
Resolved merge conflict |
@Armaxis - couldn’t we just document that if you want to use a real regex that you can use the existing include/exclude but wrap it with the It looks like that’s all this is doing, right? |
@johnrengelman that won't work because existing I can tweak |
…he `normalizePatterns` methods.
0c0810f
to
7a94fca
Compare
Updated implementation to filter out Regex in |
@johnrengelman Hi! Is this PR in the 6.0.0? It's not in the release notes. Congrats on the 6.0.0 release by the way! |
Yes. It is in 6.0.0 |
I’ll update the release notes later tonight. Thanks for catching that. |
@johnrengelman awesome, going to upgrade to |
SimpleRelocator
usesplexus
'sSelectorUtils
under the hood to perform string matching. This utility in fact supports "real" regex - as long as they are wrapped with%regex[]
SimpleRelocator
didn't had the need to utilize this functionality yet, and providedinclude/exclude
methods that supported "normalized patterns" - these are eventually parsed bySelectorUtils.matchAntPathPattern
. These patterns allow using*
for wildcard matches, but lack the power of regex.In our project we needed a custom regex to match certain paths, hence we added methods
includeRegex/excludeRegex
. This might be useful API for somebody else as well.See new unit test for example usage.
Note: this PR is built on top of #535 since it uses new signature of
canRelocatePath
. If both PRs are approved, #535 is to be merged first. If only this one approved - I can rework the code to not require the new signature of method. I just really didn't wanted to have two PRs that would break things if merged together.