Merge pull request #1018 from lavrin/search-apps-deps-libs
Erlang: search apps/, deps/ and libs/
This commit is contained in:
commit
4fa278afe4
@ -2,10 +2,11 @@
|
|||||||
-export([main/1]).
|
-export([main/1]).
|
||||||
|
|
||||||
main([FileName]) ->
|
main([FileName]) ->
|
||||||
LibDirs = filelib:wildcard("{lib,deps}/*/ebin"),
|
LibDirs = (["ebin", "include", "src", "test"] ++
|
||||||
|
filelib:wildcard("{apps,deps,lib}/*/{ebin,include}")),
|
||||||
compile(FileName, LibDirs);
|
compile(FileName, LibDirs);
|
||||||
|
|
||||||
main([FileName | ["-rebar" | [Path | LibDirs]]]) ->
|
main([FileName, "-rebar", Path, LibDirs]) ->
|
||||||
{ok, L} = file:consult(Path),
|
{ok, L} = file:consult(Path),
|
||||||
P = dict:from_list(L),
|
P = dict:from_list(L),
|
||||||
Root = filename:dirname(Path),
|
Root = filename:dirname(Path),
|
||||||
@ -31,23 +32,20 @@ main([FileName | ["-rebar" | [Path | LibDirs]]]) ->
|
|||||||
%io:format("~p~n", [LibDirs1]),
|
%io:format("~p~n", [LibDirs1]),
|
||||||
compile(FileName, LibDirs1);
|
compile(FileName, LibDirs1);
|
||||||
|
|
||||||
main([FileName | LibDirs]) ->
|
main([FileName, LibDirs]) ->
|
||||||
compile(FileName, LibDirs).
|
compile(FileName, LibDirs).
|
||||||
|
|
||||||
compile(FileName, LibDirs) ->
|
compile(FileName, LibDirs) ->
|
||||||
Root = get_root(filename:dirname(FileName)),
|
Root = get_root(filename:dirname(FileName)),
|
||||||
ok = code:add_pathsa(LibDirs),
|
ok = code:add_pathsa(LibDirs),
|
||||||
compile:file(FileName, [warn_obsolete_guard,
|
compile:file(FileName,
|
||||||
warn_unused_import,
|
[warn_obsolete_guard,
|
||||||
warn_shadow_vars,
|
warn_unused_import,
|
||||||
warn_export_vars,
|
warn_shadow_vars,
|
||||||
strong_validation,
|
warn_export_vars,
|
||||||
report,
|
strong_validation,
|
||||||
{i, filename:join(Root, "include")},
|
report] ++
|
||||||
{i, filename:join(Root, "deps")},
|
[{i, filename:join(Root, I)} || I <- LibDirs]).
|
||||||
{i, filename:join(Root, "apps")},
|
|
||||||
{i, filename:join(Root, "lib")}
|
|
||||||
]).
|
|
||||||
|
|
||||||
get_root(Dir) ->
|
get_root(Dir) ->
|
||||||
Path = filename:split(filename:absname(Dir)),
|
Path = filename:split(filename:absname(Dir)),
|
||||||
|
Loading…
Reference in New Issue
Block a user