barrel-db / rebar3_elixir_compile

Elixir rebar3 compiler plugin
Other
90 stars 29 forks source link

All dependencies have to be explicitly stated #30

Open CrowdHailer opened 6 years ago

CrowdHailer commented 6 years ago

This plug in appears to pull all the dependencies of a hex project. however unless the are all added to the list of deps then they are not compiled/included.

I have a small rebar3 project using Ace, an elixir dependency which has further dependencies. This is the section of my rebar.config file which should only need to have ace declared https://github.com/CrowdHailer/greetings-ace-raxx-erlang-example/blob/master/rebar.config#L3-L6

benoitc commented 6 years ago

This plug in appears to pull all the dependencies of a hex project. however unless the are all added to the list of deps then they are not compiled/included.

what do you mean exactly? That it doesn't take the deps from your mix file or smth else?

CrowdHailer commented 6 years ago

Yes the deps of an included project are not pulled from the projects mix.exs when using rebar3 eunit or rebar shell

For example if I update my rebar.config to the following.

{erl_opts, [debug_info]}.
{deps, [
  {ace, {elixir, "ace", "0.16.4"}}
  % {raxx, {elixir, "raxx", "0.15.4"}},
  % {hpack, "0.2.3", {pkg, hpack_erl}},
  % {cookie, {elixir, "cookie", "0.1.0"}}
]}.

{plugins, [
    { rebar3_elixir_compile, ".*", {git, "https://github.com/barrel-db/rebar3_elixir_compile.git", {branch, "master"}}}
]}.

{provider_hooks, [
  {pre, [{compile, {ex, compile}}]}
]}.

{elixir_opts,
  [
    {env, dev}
  ]
}.

{shell, [{apps, [greetings]}]}.

When I run rebar3 shell I see:

==> raxx
Compiling 13 files (.ex)
Generated raxx app
==> ace
Compiling 27 files (.ex)
Generated ace app
===> Compiling ace
===> Compiling greetings
===> Adding Elixir Libs
src/greetings_www.erl:3: Warning: behaviour 'Elixir.Raxx.Server' undefined

There is that line that says the dependencies of my dependency where compile. But only the explicitly declared dependency is available in the shell. concretely my project depends on ace, and ace depends on raxx.

2> 'Elixir.Ace.HTTP.Service':module_info(). 
[{module,'Elixir.Ace.HTTP.Service'}, ...
3> 'Elixir.Raxx':module_info().
** exception error: undefined function 'Elixir.Raxx':module_info/0
aherranz commented 6 years ago

I think I am suffering the same problem.

At least with rebar shell, I cannot start my erlang app because dependency app files cannot be found:

1> application:ensure_all_started(pet).

=INFO REPORT==== 6-Sep-2018::08:42:58 ===
    application: logger
    exited: stopped
    type: temporary

=INFO REPORT==== 6-Sep-2018::08:42:58 ===
    application: elixir
    exited: stopped
    type: temporary

{error,{postgrex,{"no such file or directory",
                  "postgrex.app"}}}
2> 

I can try to build a PR the reproduce the problem in the plugin repo (demo).