elixir-lang / elixir

Elixir is a dynamic, functional language for building scalable and maintainable applications
https://elixir-lang.org/
Apache License 2.0
24.51k stars 3.38k forks source link

`mix compile` with dependency issues gives a confusing error message #1246

Closed devinus closed 11 years ago

devinus commented 11 years ago
~/P/zuul ❯❯❯ mix deps.get
All dependencies up to date
~/P/zuul ❯❯❯ mix compile
Unchecked dependencies for environment dev:
* eredis [git: "git@github.com:wooga/eredis.git"]
* poolboy [git: "https://github.com/devinus/poolboy.git"]
* goldrush [git: "git://github.com/DeadZen/goldrush.git"]
* lager [git: "https://github.com/basho/lager.git"]
** (Mix) Some dependencies are out of date, please run `MIX_ENV=dev mix deps.get` to proceed, or solve any diverged dependencies, run `MIX_ENV=dev mix deps` for more information

The code to see the real dependency issues exists in mix, because we can see the issue when we type mix deps:

* goldrush [git: "git://github.com/DeadZen/goldrush.git"]
  locked at "879c69874a555b2c13498aa4a3da6f6bbbb6a031"
  different specs were given for this dependency, choose one in your deps:
$ [ dest: "/Users/devin/Projects/zuul/deps/goldrush",
  git: "git://github.com/DeadZen/goldrush.git",
  tag: "879c69874a" ]
$ [ dest: "/Users/devin/Projects/zuul/deps/goldrush",
  git: "https://github.com/DeadZen/goldrush.git",
  tag: "7ff9b03" ]
josevalim commented 11 years ago

There are a couple issues here.

  1. mix deps.get is not checking if the dependencies are actually valid after fetching them. The error should come up as soon as possible
  2. Mix is treating everything as OutOfDateError. I am not sure of the solution here, but maybe we should consider getting rid of such error and just say something like "can't continue due to errors on dependencies" and print the proper report that we can reuse from mix deps
  3. When there is a conflict, we are not keeping the source of the dependency, that makes it a bit harder to find from where the conflicting definitions are coming from (this is what was described in #1247)

Anyway, the fact we are getting those errors are a consequence of good progress™ and I am happy we are ironing those details now!

ericmj commented 11 years ago

Another thing to note while we are talking about dependency conflicts, related to 1). Mix will git clone a dependency even if it finds that they are diverging, because Mix find that they are conflicting after the the clone is done. It's not a big issue, when the conflict is resolved Mix will checkout the correct commit. But I think it may cause some confusion because the user will see the clone happening and see the checked out project and find it annoying that it isn't working.

josevalim commented 11 years ago

@ericmj cloning is not a real problem, since, as you said, we fix it later. However I think that, at the end of mix deps.get, once everything is cloned, we should run the same kind of check we do for mix compile and show any kind of pending things to be solved.