diff --git a/mix.exs b/mix.exs index dba39abf1..29ca4a6a3 100644 --- a/mix.exs +++ b/mix.exs @@ -51,12 +51,25 @@ defmodule Ejabberd.Mixfile do end end + defp if_version_below(ver, okResult) do + if :erlang.system_info(:otp_release) < ver do + okResult + else + [] + end + end + defp erlc_options do # Use our own includes + includes from all dependencies includes = ["include"] ++ deps_include(["fast_xml", "xmpp", "p1_utils"]) - [:debug_info, {:d, :ELIXIR_ENABLED}] ++ cond_options() ++ Enum.map(includes, fn(path) -> {:i, path} end) ++ - if_version_above('20', [{:d, :DEPRECATED_GET_STACKTRACE}]) ++ - if_function_exported(:erl_error, :format_exception, 6, [{:d, :HAVE_ERL_ERROR}]) + result = [:debug_info, {:d, :ELIXIR_ENABLED}] ++ + cond_options() ++ + Enum.map(includes, fn (path) -> {:i, path} end) ++ + if_version_above('20', [{:d, :DEPRECATED_GET_STACKTRACE}]) ++ + if_version_below('22', [{:d, :LAGER}]) ++ + if_function_exported(:erl_error, :format_exception, 6, [{:d, :HAVE_ERL_ERROR}]) + defines = for {:d, value} <- result, do: {:d, value} + result ++ [{:d, :ALL_DEFS, defines}] end defp cond_options do diff --git a/rebar.config.script b/rebar.config.script index fee828025..c09380d75 100644 --- a/rebar.config.script +++ b/rebar.config.script @@ -304,12 +304,14 @@ fun(Hooks) -> end, ProcessErlOpt = fun(Vals) -> - lists:map( + R = lists:map( fun({i, Path}) -> {i, ResolveDepPath(Path)}; (ErlOpt) -> ErlOpt - end, Vals) + end, Vals), + M = lists:filter(fun({d, M}) -> true; (_) -> false end, R), + [{d, 'ALL_DEFS', M} | R] end, ProcssXrefExclusions = fun(Items) -> diff --git a/src/ext_mod.erl b/src/ext_mod.erl index 1b8c0eb61..e4feeaee6 100644 --- a/src/ext_mod.erl +++ b/src/ext_mod.erl @@ -570,7 +570,7 @@ compile_result(Results) -> end. compile_options() -> - [verbose, report_errors, report_warnings] + [verbose, report_errors, report_warnings, ?ALL_DEFS] ++ [{i, filename:join(app_dir(App), "include")} || App <- [fast_xml, xmpp, p1_utils, ejabberd]] ++ [{i, filename:join(mod_dir(Mod), "include")}