I’m suggesting that this is built into the mix dependency resolver. Right now the following happens all the time:
- I want to add
foo to my app. I already have bar and baz.
foo depends on a newer version of bar.
- I can’t update
bar because baz depends on it.
- I check how
baz and foo use bar, and confirm that its fine to just override.
- So I add
{:bar, "~> ...", override: true}
- Someone else adds
buzz to the app, which also depends on an old version of bar.
- Problem 1: We never find out that we just overrode
bar for the sake of buzz as well.
- Next,
foo releases an update that depends on more stuff from the old version of bar.
- Problem 2: mix tells us we can update
foo, so we update it and have bugs.
If instead of override: true, I could say:
{:bar, "~> x.x", override: [foo: "x.x.x"]}
which would say “this override only overrides the dependency that foo at exactly version x.x.x has on bar”, then we are protected from any of those accidental changes.
Adding buzz would produce an appropriate dependency conflict warning, solving Problem 1. We can then go look at the code/docs and decide if we want to override the bar dependency for that version of buzz as well.
foo won’t appear to be automatically upgradeable, solving Problem 2.
Originally posted by @zachdaniel in #14080 (comment)
I’m suggesting that this is built into the mix dependency resolver. Right now the following happens all the time:
footo my app. I already havebarandbaz.foodepends on a newer version ofbar.barbecausebazdepends on it.bazandfoousebar, and confirm that its fine to just override.{:bar, "~> ...", override: true}buzzto the app, which also depends on an old version ofbar.barfor the sake ofbuzzas well.fooreleases an update that depends on more stuff from the old version ofbar.foo, so we update it and have bugs.If instead of
override: true, I could say:which would say “this override only overrides the dependency that
fooat exactly versionx.x.xhas onbar”, then we are protected from any of those accidental changes.Adding
buzzwould produce an appropriate dependency conflict warning, solving Problem 1. We can then go look at the code/docs and decide if we want to override thebardependency for that version ofbuzzas well.foowon’t appear to be automatically upgradeable, solving Problem 2.Originally posted by @zachdaniel in #14080 (comment)