mpizenberg / elm-pubgrub

PubGrub version solving algorithm in elm
https://mpizenberg.github.io/elm-pubgrub/
BSD 3-Clause "New" or "Revised" License
6 stars 2 forks source link

Guidance for adding graph location aware exclusions and overrides #20

Closed baron1405 closed 1 year ago

baron1405 commented 1 year ago

I have reached out to the pub folks but thought I'd try you as well since you are very, very familiar with PubGrub.

I have ported the PubGrub solver from pub/Dart to Java with Maven and NPM artifacts in order to explore version solving in a personal project. I have the solver working and passing all relevant unit tests including functional tests that go out to Maven Central and the NPM registry. What is missing is support for Maven's exclusions and NPM overrides. I plan on using these on the artifacts as filters before supplying the artifacts to the solver (i.e. incompatiblitiesFor). The problem is that these constructs depend on the an artifacts path in the dependency graph. For example, an exclusion specified in the dependency A applies to any transitive dependency of A no matter how deep in the graph it occurs. So in order to know if an exclusion applies to a transitive dependency, I need to know the location in the dependency graph that is causing that dependency to be considered. After much investigation into the source code, I still cannot figure out how to obtain that graph and path during solving. Obviously the graph and thus the path will change as new assignments are made and when backtracking. The PubGrub implementation in pub supports overrides but they are global and independent of an artifact's location in the dependency graph. Any guidance on how to proceed would be greatly appreciated. I plan to make my repository public once I get this functionality implemented, so any help will likely help others as they consider using PubGrub in their projects.

Thanks in advance for any help!

mpizenberg commented 1 year ago

Hi @baron1405 I’d have answered something similar to what Jacob said in Rust’s pubgrub. Let’s keep the discussion there https://github.com/pubgrub-rs/pubgrub/issues/131.