elixir icon indicating copy to clipboard operation
elixir copied to clipboard

Override and In Umbrella Configuration Improvement

Open yordis opened this issue 3 years ago • 3 comments

Elixir and Erlang/OTP versions

Elixir 1.14.0 (compiled with Erlang/OTP 24)

Operating system

MacOS

Current behavior

  1. Clone any repo into an umbrella project
    gh repo clone yordis/eventstore
    
  2. Swap the dependency to be the local version in your app
    {:eventstore, in_umbrella: true, override: true},
    
  3. Notice the issue regardless the override: true
Dependencies have diverged:
* eventstore (apps/eventstore)
  the dependency eventstore in mix.exs is overriding a child dependency:

  > In mix.exs:
    {:eventstore, [path: "apps/eventstore", from_umbrella: true, env: :dev]}

  > In deps/commanded_eventstore_adapter/mix.exs:
    {:eventstore, "~> 1.3", [env: :prod, hex: "eventstore", repo: "hexpm", optional: false]}

  Please remove the conflicting options from your definition
** (Mix) Can't continue due to errors on dependencies

Expected behavior

@ericmj asked me to create the ticket

"I think override: true doesn’t work umbrella apps, but I am not sure; I need to investigate more. Can you open an issue so we can look into this? It may be that we just need to add a warning if override and in_umbrella are used together."

yordis avatar Oct 15 '22 17:10 yordis

Thank you for the report!

This is by design. An umbrella child can run in isolation from the umbrella root. If they have conflicting dependencies, then it means that, when run from root, you will use one dependency, when run from the child, another one, which will lead to surprising behaviours. You need to keep them consistent at all times. :)

josevalim avatar Oct 15 '22 20:10 josevalim

@ericmj asked me to open it to try to warn about that usage. That is why I opened the issue.

yordis avatar Oct 15 '22 23:10 yordis

Oh, I got it. We want to warn that override can be discarded.

josevalim avatar Oct 16 '22 07:10 josevalim