ci(rocksdb): conditionally load mnesia_rocksdb in release

Otherwise, it might not be included in the release, since it's no
longer declared as a dependency on the mria app.
This commit is contained in:
Thales Macedo Garitezi 2022-07-18 17:11:37 -03:00
parent f5d63c1555
commit 1ef898d126
2 changed files with 78 additions and 55 deletions

20
mix.exs
View File

@ -170,8 +170,13 @@ defmodule EMQXUmbrella.MixProject do
hocon: :load, hocon: :load,
emqx: :load, emqx: :load,
emqx_conf: :load, emqx_conf: :load,
emqx_machine: :permanent, emqx_machine: :permanent
mria: :load, ] ++
if(enable_rocksdb?(),
do: [mnesia_rocksdb: :load],
else: []
) ++
[
mnesia: :load, mnesia: :load,
ekka: :load, ekka: :load,
emqx_plugin_libs: :load, emqx_plugin_libs: :load,
@ -616,6 +621,11 @@ defmodule EMQXUmbrella.MixProject do
]) or "1" == System.get_env("BUILD_WITH_QUIC") ]) or "1" == System.get_env("BUILD_WITH_QUIC")
end end
defp enable_rocksdb?() do
not build_without_rocksdb?() or
"1" == System.get_env("BUILD_WITH_QUIC")
end
defp pkg_vsn() do defp pkg_vsn() do
%{edition_type: edition_type} = check_profile!() %{edition_type: edition_type} = check_profile!()
basedir = Path.dirname(__ENV__.file) basedir = Path.dirname(__ENV__.file)
@ -657,6 +667,12 @@ defmodule EMQXUmbrella.MixProject do
String.downcase(opt) != "false" String.downcase(opt) != "false"
end end
defp build_without_rocksdb?() do
opt = System.get_env("BUILD_WITHOUT_ROCKSDB", "false")
String.downcase(opt) != "false"
end
defp from_rebar_to_eex_template(str) do defp from_rebar_to_eex_template(str) do
# we must not consider surrounding space in the template var name # we must not consider surrounding space in the template var name
# because some help strings contain informative variables that # because some help strings contain informative variables that

View File

@ -88,6 +88,10 @@ is_quicer_supported() ->
is_win32() orelse is_centos_6()) orelse is_win32() orelse is_centos_6()) orelse
"1" == os:getenv("BUILD_WITH_QUIC"). "1" == os:getenv("BUILD_WITH_QUIC").
is_rocksdb_supported() ->
not (false =/= os:getenv("BUILD_WITHOUT_ROCKSDB")) orelse
"1" == os:getenv("BUILD_WITH_ROCKSDB").
is_macos() -> is_macos() ->
{unix, darwin} =:= os:type(). {unix, darwin} =:= os:type().
@ -318,7 +322,10 @@ relx_apps(ReleaseType, Edition) ->
% started by emqx_machine % started by emqx_machine
{emqx, load}, {emqx, load},
{emqx_conf, load}, {emqx_conf, load},
emqx_machine, emqx_machine
] ++
[{mnesia_rocksdb, load} || is_rocksdb_supported()] ++
[
{mnesia, load}, {mnesia, load},
{ekka, load}, {ekka, load},
{emqx_plugin_libs, load}, {emqx_plugin_libs, load},