ten0s/syntaxerl

syntaxerl can't build absolute paths with certain rebar configuration

wmealing opened this issue · 4 comments

I think syntaxerl bugs out when multiple rebar.config files are visible

[wmealing@work-laptop] $ find | grep rebar | grep -v deps
./sensors/sms/rebar.config
./sensors/rebar.config
./rebar.config
./apps/adj_frontend/rebar.config
./apps/adj_backend/rebar.config
./apps/rebar.config

[wmealing@work-laptop ]$ ~/bin/syntaxerl sensors/sms/src/sms_worker.erl
escript: exception error: no function clause matching
filename:join("/home/wmealing/Source/adjutant-erlang",112) (filename.erl, line 406)
in function lists:map/2 (lists.erl, line 1173)
in call from syntaxerl_utils:rebar_deps_opts/1 (src/syntaxerl_utils.erl, line 106)
in call from syntaxerl_utils:rebar_deps_opts/1 (src/syntaxerl_utils.erl, line 102)
in call from syntaxerl_utils:deps_opts/3 (src/syntaxerl_utils.erl, line 50)
in call from syntaxerl_utils:incls_deps_opts/1 (src/syntaxerl_utils.erl, line 41)
in call from syntaxerl_erl:check_syntax/2 (src/syntaxerl_erl.erl, line 10)
in call from syntaxerl:check_syntax/2 (src/syntaxerl.erl, line 42)

If i move the rebar.config's out of the way, it works correctly.

[wmealing@work-laptop ]$ mv sensors/rebar.config.old ^C
[wmealing@work-laptop ]$ mv rebar.config rebar.config.old
[wmealing@work-laptop ]$ ~/bin/syntaxerl sensors/irc/src/irc_worker.erl

More details or a simplified test case can be provided if you require.

I'm concerned with 'filename:join("/home/wmealing/Source/adjutant-erlang",112)' call.
And the 112 number in particular. Do you have in one of your rebar.configs the 112 value under deps_dir or lib_dirs?

Yep, that was it.. somewhat..

{deps_dir, "deps"}.

should have been

{deps_dir, ["deps"]}.

Thankyou !

Wade.

According to https://github.com/basho/rebar/blob/master/rebar.config.sample your config is correct. There should be
{deps_dir, "deps"}.

I corrected the code and now it supports both "deps" and ["deps"].

Thanks for you help!

No problem, awesome response. :)

This tool is very useful.