barrel-db / rebar3_elixir_compile

Elixir rebar3 compiler plugin
Other
90 stars 29 forks source link

bug testing a simple example: discover elixir if possible #4

Closed benoitc closed 8 years ago

benoitc commented 8 years ago

I was unable to compile a simple test:

Steps to reproduce:

1) Create an app: rebar3 new app testapp 2) edit the file rebar.config in the testapp folder:

{erl_opts, [debug_info]}.

{plugins, [{rebar3_elixir, {git, "git@github.com:barrel-db/rebar3_elixir.git", {branch, "master"}}}]}.

{deps, [{httpoison, {elixir, httpoison, "0.9.0"}}]}.

3) run rebar3 compile

You get the following trace when runn

===> Fetching httpoison ({elixir,httpoison,"0.9.0"})
===> Adding Dir "/tmp/.tmp_dir710327170900"
Dependency httpoison already exists

===> rebar_fetch exception error {badmatch,false} [{rebar3_elixir_util,
                                                           get_details,1,
                                                           [{file,
                                                             "/private/tmp/testapp/_build/default/plugins/rebar3_elixir/src/rebar3_elixir_util.erl"},
                                                            {line,14}]},
                                                          {rebar3_elixir_util,
                                                           add_elixir,1,
                                                           [{file,
                                                             "/private/tmp/testapp/_build/default/plugins/rebar3_elixir/src/rebar3_elixir_util.erl"},
                                                            {line,6}]},
                                                          {rebar3_elixir_resource,
                                                           fetch_and_compile,
                                                           3,
                                                           [{file,
                                                             "/private/tmp/testapp/_build/default/plugins/rebar3_elixir/src/rebar3_elixir_resource.erl"},
                                                            {line,34}]},
                                                          {rebar3_elixir_resource,
                                                           download,3,
                                                           [{file,
                                                             "/private/tmp/testapp/_build/default/plugins/rebar3_elixir/src/rebar3_elixir_resource.erl"},
                                                            {line,16}]},
                                                          {rebar_fetch,
                                                           download_source_,3,
                                                           [{file,
                                                             "/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_fetch.erl"},
                                                            {line,45}]},
                                                          {rebar_fetch,
                                                           download_source,3,
                                                           [{file,
                                                             "/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_fetch.erl"},
                                                            {line,29}]},
                                                          {rebar_prv_install_deps,
                                                           fetch_app,3,
                                                           [{file,
                                                             "/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_prv_install_deps.erl"},
                                                            {line,357}]},
                                                          {rebar_prv_install_deps,
                                                           maybe_fetch,5,
                                                           [{file,
                                                             "/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_prv_install_deps.erl"},
                                                            {line,295}]}]
===> Failed to fetch and copy dep: {elixir,httpoison,"0.9.0"}
benoitc commented 8 years ago

reading the code here:

https://github.com/barrel-db/rebar3_elixir/blob/master/src/rebar3_elixir_util.erl#L5-L18

It seems you're trying to get the configuration by rereading rebar.config. Why don't you use the rebar api to read the configuration?

also we should have a default configuration if possible. You can look at the elixir path from the env. This snippet allows you to get the path of the elixir or mix binaries. From there you should be able to retrieve the path.

sivsushruth commented 8 years ago

@benoitc Auto discovery enabled with fallback to elixir_opts, view https://github.com/barrel-db/rebar3_elixir/commit/9051bbcff7be0946ef128c36b8aeb090bb173476#diff-bdb0c478c1116e1795bc2871d77b6df6R30