rustyio / sync

On-the-fly recompiling and reloading in Erlang. Code without friction.
MIT License
749 stars 163 forks source link

rebar3 issue - sync_utils:get_options_from_module(Module) #76

Closed vasu-dasari closed 6 years ago

vasu-dasari commented 7 years ago

Environment: rebar3 based project.

Bug: Include directories are not populated properly and hence resulting in compilation failures when the modules are recompiled.

Enabled sync on project based on cowboy. On modifying cow_http.erl in that project I see this failure.

00:20:11.480 [error] /Users/vdasari/Developer/erlang-gobgp/_build/default/lib/cowlib/src/cow_http.erl:35: Error: can't find include file "cow_inline.hrl"
/Users/vdasari/Developer/erlang-gobgp/_build/default/lib/cowlib/src/cow_http.erl:120: Error: function parse_hd_name/3 undefined
/Users/vdasari/Developer/erlang-gobgp/_build/default/lib/cowlib/src/cow_http.erl:127: Error: undefined macro 'LOWER/4'
.
.

Tracked down the cause of this problem. Found that it is because include directories are not populated properly in API sync_utils:get_options_from_module(cow_http).

1> cow_http:module_info(compile).
[{options,[debug_info,
           {i,"/Users/vdasari/Developer/erlang-gobgp/_build/default/lib/cowlib/src"},
           {i,"/Users/vdasari/Developer/erlang-gobgp/_build/default/lib/cowlib/include"},
           {i,"/Users/vdasari/Developer/erlang-gobgp/_build/default/lib/cowlib"}]},
 {version,"7.1.3"},
 {source,"/Users/vdasari/Developer/erlang-gobgp/_build/default/lib/cowlib/src/cow_http.erl"}]

As you can see here include list not populated correctly here(it is incomplete)

2> sync_utils:get_options_from_module(cow_http).
{ok,[{i,"/Users/vdasari/Developer/erlang-gobgp/_build/default/lib/cowlib/src"},
     {type,erl},
     {outdir,"/Users/vdasari/Developer/erlang-gobgp/_build/default/lib/cowlib/ebin"},
     debug_info]}
vasu-dasari commented 7 years ago

I have a pull request to fix this issue at https://github.com/rustyio/sync/pull/77

vasu-dasari commented 6 years ago

PR has been merged.