Compile contributed module with lager if enabled in ejabberd

This commit is contained in:
Christophe Romain 2015-03-11 14:35:01 +01:00
parent f77622067b
commit c9b82ff1e5
1 changed files with 6 additions and 1 deletions

View File

@ -443,9 +443,14 @@ compile(_Module, _Spec, DestDir) ->
filelib:ensure_dir(filename:join(Ebin, ".")),
EjabBin = filename:dirname(code:which(ejabberd)),
EjabInc = filename:join(filename:dirname(EjabBin), "include"),
Logger = case code:is_loaded(lager) of
{file, _} -> [{d, 'LAGER'}];
_ -> []
end,
Options = [{outdir, Ebin}, {i, "include"}, {i, EjabInc},
{d, 'NO_EXT_LIB'}, %% use include instead of include_lib
verbose, report_errors, report_warnings],
verbose, report_errors, report_warnings]
++ Logger,
Result = [case compile:file(File, Options) of
{ok, _} -> ok;
{ok, _, _} -> ok;