Inc = filename:join(Dep, "include"),
Lib = filename:join(Dep, "lib"),
Src = filename:join(Dep, "src"),
- Options = [{outdir, Ebin}, {i, Inc}],
+ Options = [verbose, report_errors, report_warnings,
+ {outdir, Ebin}, {i, Inc}],
[file:copy(App, Ebin) || App <- filelib:wildcard(Src++"/*.app")],
%% Compile erlang files
compile(_Module, _Spec, DestDir) ->
Ebin = filename:join(DestDir, "ebin"),
filelib:ensure_dir(filename:join(Ebin, ".")),
- EjabBin = filename:dirname(code:which(ejabberd)),
- EjabInc = filename:join(filename:dirname(EjabBin), "include"),
- Options = [{outdir, Ebin}, {i, "include"}, {i, EjabInc},
- verbose, report_errors, report_warnings],
+ Includes = [{i, filename:join(code:lib_dir(App), "include")}
+ || App <- [fast_xml, xmpp, ejabberd]],
+ Options = [verbose, report_errors, report_warnings,
+ {outdir, Ebin}, {i, "include"} | Includes],
[file:copy(App, Ebin) || App <- filelib:wildcard("src/*.app")],
%% Compile erlang files
%%%
-%%% Node
+%%% Adminsys
%%%
compile(File) ->
- compile:file(File).
+ Includes = [{i, filename:join(code:lib_dir(App), "include")}
+ || App <- [fast_xml, xmpp, ejabberd]],
+ Ebin = filename:join(code:lib_dir(ejabberd), "ebin"),
+ case compile:file(File, [{outdir, Ebin}|Includes]) of
+ error -> error;
+ {error, _, _} -> error;
+ OK ->
+ [ok, ModuleName | _] = tuple_to_list(OK),
+ code:purge(ModuleName),
+ code:load_file(ModuleName),
+ ok
+ end.
get_cookie() ->
atom_to_list(erlang:get_cookie()).