Define base64url dependency only when using rebar2 and Erlang<24

base64url is not called directly in ejabberd code since e227940,
it is only required by p1_acme and erlang-jose 1.11.1

erlang-jose 1.11.1 defines base64url dependency as an hex package,
and rebar2 is not able to download it.
For that reason, when compiling ejabberd with rebar2,
we provide a rebar2-friendly base64url dependency definition.
That way when jose is downloaded, that dependency is already available.
This commit is contained in:
Badlop 2024-04-05 12:56:21 +02:00
parent e973360aa7
commit 9c8ae96f25
3 changed files with 7 additions and 5 deletions

View File

@ -193,7 +193,7 @@ jobs:
run: |
sed -i "s|^modules:|modules:\n 'ModPresenceDemo': {}|g" ejabberd.yml.example
cat ejabberd.yml.example
sed -i 's|^{deps, \(.*\)|{deps, \1\n {decimal, ".*", {git, "https://github.com/ericmj/decimal", {branch, "main"}}}, |g' rebar.config
sed -i 's|^{deps, \[\(.*\)|{deps, [{decimal, ".*", {git, "https://github.com/ericmj/decimal", {branch, "main"}}},\n \1|g' rebar.config
cat rebar.config
- name: Compile

View File

@ -44,7 +44,7 @@ defmodule Ejabberd.MixProject do
def application do
[mod: {:ejabberd_app, []},
applications: [:idna, :inets, :kernel, :sasl, :ssl, :stdlib, :mix,
:base64url, :fast_tls, :fast_xml, :fast_yaml, :jiffy, :jose,
:fast_tls, :fast_xml, :fast_yaml, :jiffy, :jose,
:p1_utils, :stringprep, :syntax_tools, :yconf]
++ cond_apps(),
included_applications: [:mnesia, :os_mon,
@ -129,8 +129,7 @@ defmodule Ejabberd.MixProject do
end
defp deps do
[{:base64url, "~> 1.0"},
{:cache_tab, "~> 1.0"},
[{:cache_tab, "~> 1.0"},
{:dialyxir, "~> 1.2", only: [:test], runtime: false},
{:eimp, "~> 1.0"},
{:ex_doc, "~> 0.31", only: [:dev, :edoc], runtime: false},

View File

@ -22,7 +22,10 @@
%%% Dependencies
%%%
{deps, [{base64url, ".*", {git, "https://github.com/dvv/base64url", {tag, "1.0.1"}}},
{deps, [{if_not_rebar3,
{if_version_below, "24",
{base64url, ".*", {git, "https://github.com/dvv/base64url", {tag, "1.0.1"}}}
}},
{cache_tab, ".*", {git, "https://github.com/processone/cache_tab", {tag, "1.0.30"}}},
{eimp, ".*", {git, "https://github.com/processone/eimp", {tag, "1.0.22"}}},
{if_var_true, pam,