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.
(1) Checkers now have an _exec attribute, and an accessor getExec().
(2) CreateAndRegisterChecker() initializes _exec from an optional argument
'exec'. If this argument is missing, 'name' is used instead.
(3) Functions SyntaxCheckers_*_IsAvailable() are now dictionary functions.
(4) Functions SyntaxCheckers_*_IsAvailable() are now optional. When
they are missing, they are assumed to return executable(expand(self.getExec())).
(5) Argument 'exe' of function syntastic#makeprg#build() is now optional.
If this argument is missing, expand(self.getExec()) is used to set checker
executables.
Make SyntaxCheckers_*_GetLocList() dictionary functions.
Pass a reference to the current checker to syntastic#makeprg#build().
Add an optional 'redirect' argument to CreateAndRegisterChecker().
Change the sh checker to use the new dictionary functions.
Add a new registry method getLocListRaw() (needed for the sh checker).
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/`.