From 9c8ae96f250698bf923f714c172ab10ff97ef8fb Mon Sep 17 00:00:00 2001 From: Badlop Date: Fri, 5 Apr 2024 12:56:21 +0200 Subject: [PATCH] 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. --- .github/workflows/runtime.yml | 2 +- mix.exs | 5 ++--- rebar.config | 5 ++++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/runtime.yml b/.github/workflows/runtime.yml index 02511156d..1255f9d63 100644 --- a/.github/workflows/runtime.yml +++ b/.github/workflows/runtime.yml @@ -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 diff --git a/mix.exs b/mix.exs index 96d74691b..1fe6528db 100644 --- a/mix.exs +++ b/mix.exs @@ -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}, diff --git a/rebar.config b/rebar.config index bdf6c6088..f9951f4f7 100644 --- a/rebar.config +++ b/rebar.config @@ -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,