Add a few more include paths for erlang projects built using rebar 3.
This allows syntastic to pick up dependencies and resolve include paths
in multiple-app rebar3 projects (assuming that the default `apps`
parent directory is used).
Existing erlang projects should be unaffected.
It's possible that this could be done slightly more elegantly by
shelling out to the new `rebar3 path` command, but this is quite slow in
our setup and may not be configured correctly in editing environments.
Now, it first determines the compilation "profile" (are we building tests
or the program itself?) and the build tool. Once it found it - either
rebar when there is a `rebar.config` file, or Erlang.mk when there is a
`erlang.mk` file - it calls the appropriate function to query ERL_LIBS
paths and compiler options.
The Erlang.mk function uses the `show-ERL_LIBS`, `show-ERLC_OPTS` and
`show-TEST_ERLC_OPTS` Make targets to query those informations.
Signed-off-by: Gerhard Lazu <gerhard@lazu.uk>
The compile function expects a list of paths in the LibDirs parameter,
however when calling erlang_check_file.erl with an additional path (for
example when using the "g:syntastic_erlc_include_path" option), a
string would be passed instead. Because strings in Erlang are lists,
each character of the string would have been interpreted as a lib path.
I want to use lib_dirs and sub_dirs from rebar file and run compile with
this paths. So I search for the next rebar.config file and pass this in
g:syntastic_erlc_include_path.
see: https://github.com/scrooloose/syntastic/issues/685
When having nested directories (for instance `src/protocol/tm_protocol.erl`)
autocompilation would fail. This fix adds the abspath of all depdencies to
the codepath and sets compile option {i, _} to support both `deps/` and `lib/`.