24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-07-19 00:11:01 +02:00

ext_mod: Support to compile nested *.erl, and include other deps *.hrl

This is useful to compile as a dependency
https://github.com/deadtrickster/prometheus.erl
This commit is contained in:
Badlop 2024-06-26 17:59:04 +02:00
parent cafe28fdea
commit 394ba26d1d

View File

@ -594,15 +594,15 @@ compile_deps(LibDir) ->
compile(LibDir) ->
Bin = filename:join(LibDir, "ebin"),
Inc = filename:join(LibDir, "include"),
Lib = filename:join(LibDir, "lib"),
Src = filename:join(LibDir, "src"),
Options = [{outdir, Bin}, {i, Inc} | compile_options()],
Includes = [{i, Inc} || Inc <- filelib:wildcard(LibDir++"/../../**/include")],
Options = [{outdir, Bin}, {i, LibDir++"/.."} | Includes ++ compile_options()],
filelib:ensure_dir(filename:join(Bin, ".")),
[copy(App, Bin) || App <- filelib:wildcard(Src++"/*.app")],
compile_c_files(LibDir),
Er = [compile_erlang_file(Bin, File, Options)
|| File <- filelib:wildcard(Src++"/*.erl")],
|| File <- filelib:wildcard(Src++"/**/*.erl")],
Ex = [compile_elixir_file(Bin, File)
|| File <- filelib:wildcard(Lib ++ "/**/*.ex")],
compile_result(lists:flatten([Er, Ex])).