25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

When using OTP 24.0, use the new 'application' record definition (#3568)

This fixes "ejabberdctl update_list", "update", and the equivalent feature
on ejabberd's WebAdmin that got broken when using Erlang/OTP 24
This commit is contained in:
Badlop 2021-04-10 17:32:55 +02:00
parent 0a55e07326
commit b860a25c82
3 changed files with 37 additions and 0 deletions

View File

@ -71,6 +71,7 @@ defmodule Ejabberd.Mixfile do
if_version_below('23', [{:d, :USE_OLD_CRYPTO_HMAC}]) ++
if_version_below('23', [{:d, :USE_OLD_PG2}]) ++
if_version_below('24', [{:d, :COMPILER_REPORTS_ONLY_LINES}]) ++
if_version_below('24', [{:d, :SYSTOOLS_APP_DEF_WITHOUT_OPTIONAL}]) ++
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}]

View File

@ -100,6 +100,7 @@
{if_version_below, "23", {d, 'USE_OLD_CRYPTO_HMAC'}},
{if_version_below, "23", {d, 'USE_OLD_PG2'}},
{if_version_below, "24", {d, 'COMPILER_REPORTS_ONLY_LINES'}},
{if_version_below, "24", {d, 'SYSTOOLS_APP_DEF_WITHOUT_OPTIONAL'}},
{if_var_match, db_type, mssql, {d, 'mssql'}},
{if_var_false, debug, no_debug_info},
{if_var_true, debug, debug_info},

View File

@ -148,6 +148,7 @@ build_script(Dir, UpdatedBeams) ->
{Script, LowLevelScript, Check1}.
%% Copied from Erlang/OTP file: lib/sasl/src/systools.hrl
-ifdef(SYSTOOLS_APP_DEF_WITHOUT_OPTIONAL).
-record(application,
{name, %% Name of the application, atom().
type = permanent, %% Application start type, atom().
@ -177,6 +178,40 @@ build_script(Dir, UpdatedBeams) ->
dir = "" %% The directory where the .app file was
%% found (internal use).
}).
-else.
-record(application,
{name, %% Name of the application, atom().
type = permanent, %% Application start type, atom().
vsn = "", %% Version of the application, string().
id = "", %% Id of the application, string().
description = "", %% Description of application, string().
modules = [], %% [Module | {Module,Vsn}] of modules
%% incorporated in the application,
%% Module = atom(), Vsn = string().
uses = [], %% [Application] list of applications required
%% by the application, Application = atom().
optional = [], %% [Application] list of applications in uses
%% that are optional, Application = atom().
includes = [], %% [Application] list of applications included
%% by the application, Application = atom().
regs = [], %% [RegNames] a list of registered process
%% names used by the application, RegNames =
%% atom().
env = [], %% [{Key,Value}] environment variable of
%% application, Key = Value = term().
maxT = infinity, %% Max time an application may exist,
%% integer() | infinity.
maxP = infinity, %% Max number of processes in an application,
%% integer() | infinity.
mod = [], %% [] | {Mod, StartArgs}, Mod= atom(),
%% StartArgs = list().
start_phases, %% [{Phase, PhaseArgs}] | undefined,
%% Phase = atom(),
%% PhaseArgs = list().
dir = "" %% The directory where the .app file was
%% found (internal use).
}).
-endif.
make_script(UpdatedBeams) ->