bug testing a simple example: discover elixir if possible
benoitc opened this issue · comments
I was unable to compile a simple test:
Steps to reproduce:
- Create an app:
rebar3 new app testapp
- 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"}}]}.
- 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"}
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.
@benoitc Auto discovery enabled with fallback to elixir_opts, view 9051bbc#diff-bdb0c478c1116e1795bc2871d77b6df6R30