-
Notifications
You must be signed in to change notification settings - Fork 126
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
[MRESOLVER-512] ScopeManager #445
Conversation
I'm really reluctant about this PR. This goes in the exact opposite direction than https://issues.apache.org/jira/browse/MRESOLVER-471, which aimed to make the resolver agnostic about scopes and leave these bits to be defined by Maven. It basically replaces 250 lines of deprecated code (the |
Well, IMO this PR goes exactly in direction of MRESOLVER-471, as:
With ScopeManager Resolver IS really oblivious about scopes, in a sense, they are not only "string labels with some coded meaning scattered across codebase", but they are defined by client project, the app that is integrating Resolver 2. |
@cstamas The whole |
Now, Resolver 2.x operates based on presence of ScopeManager: * if not set (null), "legacy"/maven3 mode * if set, is fully utilized Hence, "system" scope may be: * LEGACY when no scope manager set * non-null or null value (no system scope) if scope manager set
@gnodet applied changes, IMHO it looks even better now 😄 |
Fixed comment on mvn4 supplier "compat" class.
This makes all the new scopes implemented out of the box, but MNG-8041 still stands (is unsolved). Related PR apache/maven-resolver#445 --- https://issues.apache.org/jira/browse/MRESOLVER-512 https://issues.apache.org/jira/browse/MNG-8088
In Resolver 1.x times, resolver was unaware of "resolution scope", to get the wanted resolution scope caller had to tweak and set up various nits and bits, like selectors, filters, and so on. It was easy to miss. Similarly, resolver had no "first class" type for "dependency scope" either, they were just string labels (that everyone knew HOW should behave, but was never codified) and its meaning and notion was sprinkled across several classes. Introducing new scope in these conditions (or alter selector to something that would have new scopes, like Maven4 plans) was nearly impossible.
The ScopeManager aims to solve these issues: it defines "resolution scope" and "dependency scope", interprets them, and allows caller to simply make a call to "resolve me main-runtime" resolution scope. No hoops and loops. Moreover, it is FASTER than Resolver 1.x was, that used always same selector (to build dirty graph), so potentially huge graph even if you needed just a bit of it, that was later chopped down to clean up the graph. ScopeManager automates selector selection/setup, and goes directly for result, in most cases the resulting tree is done in first pass.
Finally, and most importantly, ScopeManager allows to be "configured": by supplying the recipe for dependency and resolution scopes, hence, makes Resolver 2.x versatile, in a sense, it is not "this or that" anymore, it can obey Maven3 and Maven4 dependency scopes at the same time.
https://issues.apache.org/jira/browse/MRESOLVER-512