refactor: no more EMQX_ENTERPRISE compile flag
The compile flag was introduced in EQM X 4.3 series where CE and EE code was diverged large enough which made non-practicle to determin edition at runtime. such approach made testing quite challenging as we'll have to build with different compile flags inorder to run per-edition test cases In this commit, we try to retrieve edition info from EMQX's description text, (put to PT for fast access) at runtime so we can test ALL editions from a super-set edition (EE).
This commit is contained in:
parent
fc7eb21083
commit
6edd862dd5
|
@ -14,9 +14,6 @@
|
||||||
%% limitations under the License.
|
%% limitations under the License.
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
-ifndef(EMQX_RELEASE_HRL).
|
|
||||||
-define(EMQX_RELEASE_HRL, true).
|
|
||||||
|
|
||||||
%% NOTE: this is the release version which is not always the same
|
%% NOTE: this is the release version which is not always the same
|
||||||
%% as the emqx app version defined in emqx.app.src
|
%% as the emqx app version defined in emqx.app.src
|
||||||
%% App (plugin) versions are bumped independently.
|
%% App (plugin) versions are bumped independently.
|
||||||
|
@ -27,13 +24,4 @@
|
||||||
|
|
||||||
%% NOTE: This version number should be manually bumped for each release
|
%% NOTE: This version number should be manually bumped for each release
|
||||||
|
|
||||||
-ifndef(EMQX_ENTERPRISE).
|
-define(EMQX_RELEASE, "5.0-beta.2").
|
||||||
|
|
||||||
-define(EMQX_RELEASE, {opensource, "5.0-beta.1"}).
|
|
||||||
|
|
||||||
-else.
|
|
||||||
|
|
||||||
|
|
||||||
-endif.
|
|
||||||
|
|
||||||
-endif.
|
|
||||||
|
|
|
@ -51,10 +51,6 @@
|
||||||
, run_fold_hook/3
|
, run_fold_hook/3
|
||||||
]).
|
]).
|
||||||
|
|
||||||
%% Troubleshooting
|
|
||||||
-export([ set_debug_secret/1
|
|
||||||
]).
|
|
||||||
|
|
||||||
%% Configs APIs
|
%% Configs APIs
|
||||||
-export([ get_config/1
|
-export([ get_config/1
|
||||||
, get_config/2
|
, get_config/2
|
||||||
|
@ -71,29 +67,6 @@
|
||||||
|
|
||||||
-define(APP, ?MODULE).
|
-define(APP, ?MODULE).
|
||||||
|
|
||||||
%% @hidden Path to the file which has debug_info encryption secret in it.
|
|
||||||
%% Evaluate this function if there is a need to access encrypted debug_info.
|
|
||||||
%% NOTE: Do not change the API to accept the secret text because it may
|
|
||||||
%% get logged everywhere.
|
|
||||||
set_debug_secret(PathToSecretFile) ->
|
|
||||||
SecretText =
|
|
||||||
case file:read_file(PathToSecretFile) of
|
|
||||||
{ok, Secret} ->
|
|
||||||
try string:trim(binary_to_list(Secret))
|
|
||||||
catch _ : _ -> error({badfile, PathToSecretFile})
|
|
||||||
end;
|
|
||||||
{error, Reason} ->
|
|
||||||
?ULOG("Failed to read debug_info encryption key file ~ts: ~p~n",
|
|
||||||
[PathToSecretFile, Reason]),
|
|
||||||
error(Reason)
|
|
||||||
end,
|
|
||||||
F = fun(init) -> ok;
|
|
||||||
(clear) -> ok;
|
|
||||||
({debug_info, _Mode, _Module, _Filename}) -> SecretText
|
|
||||||
end,
|
|
||||||
_ = beam_lib:clear_crypto_key_fun(),
|
|
||||||
ok = beam_lib:crypto_key_fun(F).
|
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Bootstrap, is_running...
|
%% Bootstrap, is_running...
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
]).
|
]).
|
||||||
|
|
||||||
-include("emqx.hrl").
|
-include("emqx.hrl").
|
||||||
-include("emqx_release.hrl").
|
|
||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
-define(APP, emqx).
|
-define(APP, emqx).
|
||||||
|
@ -40,6 +39,7 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
start(_Type, _Args) ->
|
start(_Type, _Args) ->
|
||||||
|
ok = emqx_release:put_edition(),
|
||||||
ok = maybe_load_config(),
|
ok = maybe_load_config(),
|
||||||
ok = emqx_persistent_session:init_db_backend(),
|
ok = emqx_persistent_session:init_db_backend(),
|
||||||
ok = maybe_start_quicer(),
|
ok = maybe_start_quicer(),
|
||||||
|
@ -107,30 +107,7 @@ is_quicer_app_present() ->
|
||||||
is_quic_listener_configured() ->
|
is_quic_listener_configured() ->
|
||||||
emqx_listeners:has_enabled_listener_conf_by_type(quic).
|
emqx_listeners:has_enabled_listener_conf_by_type(quic).
|
||||||
|
|
||||||
get_description() ->
|
get_description() -> emqx_release:description().
|
||||||
{ok, Descr0} = application:get_key(?APP, description),
|
|
||||||
case os:getenv("EMQX_DESCRIPTION") of
|
|
||||||
false -> Descr0;
|
|
||||||
"" -> Descr0;
|
|
||||||
Str -> string:strip(Str, both, $\n)
|
|
||||||
end.
|
|
||||||
|
|
||||||
get_release() ->
|
get_release() ->
|
||||||
case lists:keyfind(emqx_vsn, 1, ?MODULE:module_info(compile)) of
|
emqx_release:version().
|
||||||
false -> %% For TEST build or depedency build.
|
|
||||||
release_in_macro();
|
|
||||||
{_, Vsn} -> %% For emqx release build
|
|
||||||
VsnStr = release_in_macro(),
|
|
||||||
case string:str(Vsn, VsnStr) of
|
|
||||||
1 -> ok;
|
|
||||||
_ ->
|
|
||||||
erlang:error(#{ reason => version_mismatch
|
|
||||||
, source => VsnStr
|
|
||||||
, built_for => Vsn
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
Vsn
|
|
||||||
end.
|
|
||||||
|
|
||||||
release_in_macro() ->
|
|
||||||
element(2, ?EMQX_RELEASE).
|
|
||||||
|
|
|
@ -65,21 +65,13 @@ maybe_parse_ip(Host) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%% @doc Add `ipv6_probe' socket option if it's supported.
|
%% @doc Add `ipv6_probe' socket option if it's supported.
|
||||||
|
%% gen_tcp:ipv6_probe() -> true. is added to EMQ's OTP forks
|
||||||
ipv6_probe(Opts) ->
|
ipv6_probe(Opts) ->
|
||||||
case persistent_term:get({?MODULE, ipv6_probe_supported}, unknown) of
|
case erlang:function_exported(gen_tcp, ipv6_probe, 0) of
|
||||||
unknown ->
|
true -> [{ipv6_probe, true} | Opts];
|
||||||
%% e.g. 23.2.7.1-emqx-2-x86_64-unknown-linux-gnu-64
|
false -> Opts
|
||||||
OtpVsn = emqx_vm:get_otp_version(),
|
|
||||||
Bool = (match =:= re:run(OtpVsn, "emqx", [{capture, none}])),
|
|
||||||
_ = persistent_term:put({?MODULE, ipv6_probe_supported}, Bool),
|
|
||||||
ipv6_probe(Bool, Opts);
|
|
||||||
Bool ->
|
|
||||||
ipv6_probe(Bool, Opts)
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
ipv6_probe(false, Opts) -> Opts;
|
|
||||||
ipv6_probe(true, Opts) -> [{ipv6_probe, true} | Opts].
|
|
||||||
|
|
||||||
%% @doc Merge options
|
%% @doc Merge options
|
||||||
-spec(merge_opts(Opts, Opts) -> Opts when Opts :: proplists:proplist()).
|
-spec(merge_opts(Opts, Opts) -> Opts when Opts :: proplists:proplist()).
|
||||||
merge_opts(Defaults, Options) ->
|
merge_opts(Defaults, Options) ->
|
||||||
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
%%--------------------------------------------------------------------
|
||||||
|
%% Copyright (c) 2021 EMQ Technologies Co., Ltd. All Rights Reserved.
|
||||||
|
%%
|
||||||
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
%% you may not use this file except in compliance with the License.
|
||||||
|
%% You may obtain a copy of the License at
|
||||||
|
%%
|
||||||
|
%% http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
%%
|
||||||
|
%% Unless required by applicable law or agreed to in writing, software
|
||||||
|
%% distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
%% See the License for the specific language governing permissions and
|
||||||
|
%% limitations under the License.
|
||||||
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
|
-module(emqx_release).
|
||||||
|
|
||||||
|
-export([ edition/0
|
||||||
|
, put_edition/0
|
||||||
|
, put_edition/1
|
||||||
|
, description/0
|
||||||
|
, version/0
|
||||||
|
]).
|
||||||
|
|
||||||
|
-include("emqx_release.hrl").
|
||||||
|
|
||||||
|
%% @doc Return EMQ X description.
|
||||||
|
description() ->
|
||||||
|
case os:getenv("EMQX_DESCRIPTION") of
|
||||||
|
false -> "EMQ X Community Edition";
|
||||||
|
"" -> "EMQ X Community Edition";
|
||||||
|
Str -> string:strip(Str, both, $\n)
|
||||||
|
end.
|
||||||
|
|
||||||
|
%% @doc Return EMQ X edition info.
|
||||||
|
%% Read info from persistent_term at runtime.
|
||||||
|
%% Or meck this function to run tests for another eidtion.
|
||||||
|
-spec edition() -> ce | ee | edge.
|
||||||
|
edition() ->
|
||||||
|
try persistent_term:get(emqx_edition)
|
||||||
|
catch error : badarg -> get_edition() end.
|
||||||
|
|
||||||
|
%% @private initiate EMQ X edition info in persistent_term.
|
||||||
|
put_edition() ->
|
||||||
|
ok = put_edition(get_edition()).
|
||||||
|
|
||||||
|
%% @hidden This function is mostly for testing.
|
||||||
|
%% Switch to another eidtion at runtime to run edition-specific tests.
|
||||||
|
-spec put_edition(ce | ee | edge) -> ok.
|
||||||
|
put_edition(Which) ->
|
||||||
|
persistent_term:put(emqx_edition, Which),
|
||||||
|
ok.
|
||||||
|
|
||||||
|
-spec get_edition() -> ce | ee | edge.
|
||||||
|
get_edition() ->
|
||||||
|
edition(description()).
|
||||||
|
|
||||||
|
edition(Desc) ->
|
||||||
|
case re:run(Desc, "enterprise", [caseless]) of
|
||||||
|
{match, _} ->
|
||||||
|
ee;
|
||||||
|
_ ->
|
||||||
|
case re:run(Desc, "edge", [caseless]) of
|
||||||
|
{match, _} -> edge;
|
||||||
|
_ -> ce
|
||||||
|
end
|
||||||
|
end.
|
||||||
|
|
||||||
|
%% @doc Return the release version.
|
||||||
|
version() ->
|
||||||
|
case lists:keyfind(emqx_vsn, 1, ?MODULE:module_info(compile)) of
|
||||||
|
false -> %% For TEST build or depedency build.
|
||||||
|
?EMQX_RELEASE;
|
||||||
|
{_, Vsn} -> %% For emqx release build
|
||||||
|
VsnStr = ?EMQX_RELEASE,
|
||||||
|
case string:str(Vsn, VsnStr) of
|
||||||
|
1 -> ok;
|
||||||
|
_ ->
|
||||||
|
erlang:error(#{ reason => version_mismatch
|
||||||
|
, source => VsnStr
|
||||||
|
, built_for => Vsn
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
Vsn
|
||||||
|
end.
|
|
@ -270,7 +270,7 @@ t_restart(Config) when is_list(Config) ->
|
||||||
|
|
||||||
?assertEqual({ok, [test_chain]}, ?AUTHN:list_chain_names());
|
?assertEqual({ok, [test_chain]}, ?AUTHN:list_chain_names());
|
||||||
|
|
||||||
t_restart({'end', Config}) ->
|
t_restart({'end', _Config}) ->
|
||||||
?AUTHN:delete_chain(test_chain),
|
?AUTHN:delete_chain(test_chain),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
|
|
@ -16,16 +16,6 @@
|
||||||
|
|
||||||
-module(emqx_dashboard_api).
|
-module(emqx_dashboard_api).
|
||||||
|
|
||||||
-ifndef(EMQX_ENTERPRISE).
|
|
||||||
|
|
||||||
-define(RELEASE, community).
|
|
||||||
|
|
||||||
-else.
|
|
||||||
|
|
||||||
-define(VERSION, enterprise).
|
|
||||||
|
|
||||||
-endif.
|
|
||||||
|
|
||||||
-behaviour(minirest_api).
|
-behaviour(minirest_api).
|
||||||
|
|
||||||
-include("emqx_dashboard.hrl").
|
-include("emqx_dashboard.hrl").
|
||||||
|
@ -200,7 +190,10 @@ login(post, #{body := Params}) ->
|
||||||
case emqx_dashboard_admin:sign_token(Username, Password) of
|
case emqx_dashboard_admin:sign_token(Username, Password) of
|
||||||
{ok, Token} ->
|
{ok, Token} ->
|
||||||
Version = iolist_to_binary(proplists:get_value(version, emqx_sys:info())),
|
Version = iolist_to_binary(proplists:get_value(version, emqx_sys:info())),
|
||||||
{200, #{token => Token, version => Version, license => #{edition => ?RELEASE}}};
|
{200, #{token => Token,
|
||||||
|
version => Version,
|
||||||
|
license => #{edition => emqx_release:edition()}
|
||||||
|
}};
|
||||||
{error, _} ->
|
{error, _} ->
|
||||||
{401, #{code => ?ERROR_USERNAME_OR_PWD, message => <<"Auth filed">>}}
|
{401, #{code => ?ERROR_USERNAME_OR_PWD, message => <<"Auth filed">>}}
|
||||||
end.
|
end.
|
||||||
|
|
|
@ -884,29 +884,27 @@ time_unit(<<"nanosecond">>) -> nanosecond.
|
||||||
%% Here the emqx_rule_funcs module acts as a proxy, forwarding
|
%% Here the emqx_rule_funcs module acts as a proxy, forwarding
|
||||||
%% the function handling to the worker module.
|
%% the function handling to the worker module.
|
||||||
%% @end
|
%% @end
|
||||||
-ifdef(EMQX_ENTERPRISE).
|
% '$handle_undefined_function'(schema_decode, [SchemaId, Data|MoreArgs]) ->
|
||||||
'$handle_undefined_function'(schema_decode, [SchemaId, Data|MoreArgs]) ->
|
% emqx_schema_parser:decode(SchemaId, Data, MoreArgs);
|
||||||
emqx_schema_parser:decode(SchemaId, Data, MoreArgs);
|
% '$handle_undefined_function'(schema_decode, Args) ->
|
||||||
'$handle_undefined_function'(schema_decode, Args) ->
|
% error({args_count_error, {schema_decode, Args}});
|
||||||
error({args_count_error, {schema_decode, Args}});
|
|
||||||
|
|
||||||
'$handle_undefined_function'(schema_encode, [SchemaId, Term|MoreArgs]) ->
|
% '$handle_undefined_function'(schema_encode, [SchemaId, Term|MoreArgs]) ->
|
||||||
emqx_schema_parser:encode(SchemaId, Term, MoreArgs);
|
% emqx_schema_parser:encode(SchemaId, Term, MoreArgs);
|
||||||
'$handle_undefined_function'(schema_encode, Args) ->
|
% '$handle_undefined_function'(schema_encode, Args) ->
|
||||||
error({args_count_error, {schema_encode, Args}});
|
% error({args_count_error, {schema_encode, Args}});
|
||||||
|
|
||||||
|
% '$handle_undefined_function'(sprintf, [Format|Args]) ->
|
||||||
|
% erlang:apply(fun sprintf_s/2, [Format, Args]);
|
||||||
|
|
||||||
|
% '$handle_undefined_function'(Fun, Args) ->
|
||||||
|
% error({sql_function_not_supported, function_literal(Fun, Args)}).
|
||||||
|
|
||||||
'$handle_undefined_function'(sprintf, [Format|Args]) ->
|
'$handle_undefined_function'(sprintf, [Format|Args]) ->
|
||||||
erlang:apply(fun sprintf_s/2, [Format, Args]);
|
erlang:apply(fun sprintf_s/2, [Format, Args]);
|
||||||
|
|
||||||
'$handle_undefined_function'(Fun, Args) ->
|
'$handle_undefined_function'(Fun, Args) ->
|
||||||
error({sql_function_not_supported, function_literal(Fun, Args)}).
|
error({sql_function_not_supported, function_literal(Fun, Args)}).
|
||||||
-else.
|
|
||||||
'$handle_undefined_function'(sprintf, [Format|Args]) ->
|
|
||||||
erlang:apply(fun sprintf_s/2, [Format, Args]);
|
|
||||||
|
|
||||||
'$handle_undefined_function'(Fun, Args) ->
|
|
||||||
error({sql_function_not_supported, function_literal(Fun, Args)}).
|
|
||||||
-endif. % EMQX_ENTERPRISE
|
|
||||||
|
|
||||||
map_path(Key) ->
|
map_path(Key) ->
|
||||||
{path, [{key, P} || P <- string:split(Key, ".", all)]}.
|
{path, [{key, P} || P <- string:split(Key, ".", all)]}.
|
||||||
|
|
|
@ -6,14 +6,8 @@ set -euo pipefail
|
||||||
# ensure dir
|
# ensure dir
|
||||||
cd -P -- "$(dirname -- "$0")"
|
cd -P -- "$(dirname -- "$0")"
|
||||||
|
|
||||||
if [ -f EMQX_ENTERPRISE ]; then
|
|
||||||
EDITION='enterprise'
|
|
||||||
else
|
|
||||||
EDITION='opensource'
|
|
||||||
fi
|
|
||||||
|
|
||||||
## emqx_release.hrl is the single source of truth for release version
|
## emqx_release.hrl is the single source of truth for release version
|
||||||
RELEASE="$(grep -E "define.+EMQX_RELEASE.+${EDITION}" apps/emqx/include/emqx_release.hrl | cut -d '"' -f2)"
|
RELEASE="$(grep -E "define.+EMQX_RELEASE" apps/emqx/include/emqx_release.hrl | cut -d '"' -f2)"
|
||||||
|
|
||||||
git_exact_vsn() {
|
git_exact_vsn() {
|
||||||
local tag
|
local tag
|
||||||
|
|
|
@ -130,18 +130,17 @@ test_deps() ->
|
||||||
, {proper, "1.4.0"}
|
, {proper, "1.4.0"}
|
||||||
].
|
].
|
||||||
|
|
||||||
common_compile_opts(Edition) ->
|
common_compile_opts() ->
|
||||||
[ debug_info % alwyas include debug_info
|
[ debug_info % alwyas include debug_info
|
||||||
, {compile_info, [{emqx_vsn, get_vsn()}]}
|
, {compile_info, [{emqx_vsn, get_vsn()}]}
|
||||||
] ++
|
] ++
|
||||||
[{d, 'EMQX_ENTERPRISE'} || is_enterprise(Edition)] ++
|
|
||||||
[{d, 'EMQX_BENCHMARK'} || os:getenv("EMQX_BENCHMARK") =:= "1" ].
|
[{d, 'EMQX_BENCHMARK'} || os:getenv("EMQX_BENCHMARK") =:= "1" ].
|
||||||
|
|
||||||
prod_compile_opts(Edition) ->
|
prod_compile_opts() ->
|
||||||
[ compressed
|
[ compressed
|
||||||
, deterministic
|
, deterministic
|
||||||
, warnings_as_errors
|
, warnings_as_errors
|
||||||
| common_compile_opts(Edition)
|
| common_compile_opts()
|
||||||
].
|
].
|
||||||
|
|
||||||
prod_overrides() ->
|
prod_overrides() ->
|
||||||
|
@ -149,34 +148,41 @@ prod_overrides() ->
|
||||||
|
|
||||||
profiles() ->
|
profiles() ->
|
||||||
Vsn = get_vsn(),
|
Vsn = get_vsn(),
|
||||||
ce_profiles(Vsn) ++ ee_profiles(Vsn).
|
[ {'emqx', [ {erl_opts, prod_compile_opts()}
|
||||||
|
|
||||||
ce_profiles(Vsn) ->
|
|
||||||
[ {'emqx', [ {erl_opts, prod_compile_opts(ce)}
|
|
||||||
, {relx, relx(Vsn, cloud, bin, ce)}
|
, {relx, relx(Vsn, cloud, bin, ce)}
|
||||||
, {overrides, prod_overrides()}
|
, {overrides, prod_overrides()}
|
||||||
, {project_app_dirs, project_app_dirs(ce)}
|
, {project_app_dirs, project_app_dirs(ce)}
|
||||||
]}
|
]}
|
||||||
, {'emqx-pkg', [ {erl_opts, prod_compile_opts(ce)}
|
, {'emqx-pkg', [ {erl_opts, prod_compile_opts()}
|
||||||
, {relx, relx(Vsn, cloud, pkg, ce)}
|
, {relx, relx(Vsn, cloud, pkg, ce)}
|
||||||
, {overrides, prod_overrides()}
|
, {overrides, prod_overrides()}
|
||||||
, {project_app_dirs, project_app_dirs(ce)}
|
, {project_app_dirs, project_app_dirs(ce)}
|
||||||
]}
|
]}
|
||||||
, {'emqx-edge', [ {erl_opts, prod_compile_opts(ce)}
|
, {'emqx-ee', [ {erl_opts, prod_compile_opts()}
|
||||||
|
, {relx, relx(Vsn, cloud, bin, ee)}
|
||||||
|
, {overrides, prod_overrides()}
|
||||||
|
, {project_app_dirs, project_app_dirs(ee)}
|
||||||
|
]}
|
||||||
|
, {'emqx-ee-pkg', [ {erl_opts, prod_compile_opts()}
|
||||||
|
, {relx, relx(Vsn, cloud, pkg, ee)}
|
||||||
|
, {overrides, prod_overrides()}
|
||||||
|
, {project_app_dirs, project_app_dirs(ee)}
|
||||||
|
]}
|
||||||
|
, {'emqx-edge', [ {erl_opts, prod_compile_opts()}
|
||||||
, {relx, relx(Vsn, edge, bin, ce)}
|
, {relx, relx(Vsn, edge, bin, ce)}
|
||||||
, {overrides, prod_overrides()}
|
, {overrides, prod_overrides()}
|
||||||
, {project_app_dirs, project_app_dirs(ce)}
|
, {project_app_dirs, project_app_dirs(ce)}
|
||||||
]}
|
]}
|
||||||
, {'emqx-edge-pkg', [ {erl_opts, prod_compile_opts(ce)}
|
, {'emqx-edge-pkg', [ {erl_opts, prod_compile_opts()}
|
||||||
, {relx, relx(Vsn, edge, pkg, ce)}
|
, {relx, relx(Vsn, edge, pkg, ce)}
|
||||||
, {overrides, prod_overrides()}
|
, {overrides, prod_overrides()}
|
||||||
, {project_app_dirs, project_app_dirs(ce)}
|
, {project_app_dirs, project_app_dirs(ce)}
|
||||||
]}
|
]}
|
||||||
, {check, [ {erl_opts, common_compile_opts(ce)}
|
, {check, [ {erl_opts, common_compile_opts()}
|
||||||
, {project_app_dirs, project_app_dirs(ce)}
|
, {project_app_dirs, project_app_dirs(ce)}
|
||||||
]}
|
]}
|
||||||
, {test, [ {deps, test_deps()}
|
, {test, [ {deps, test_deps()}
|
||||||
, {erl_opts, common_compile_opts(ce) ++ erl_opts_i(ce) }
|
, {erl_opts, common_compile_opts() ++ erl_opts_i(ce) }
|
||||||
, {extra_src_dirs, [{"test", [{recursive, true}]}]}
|
, {extra_src_dirs, [{"test", [{recursive, true}]}]}
|
||||||
, {project_app_dirs, project_app_dirs(ce)}
|
, {project_app_dirs, project_app_dirs(ce)}
|
||||||
]}
|
]}
|
||||||
|
@ -198,13 +204,11 @@ relx(Vsn, RelType, PkgType, Edition) ->
|
||||||
| overlay_vars(RelType, PkgType, Edition)]}
|
| overlay_vars(RelType, PkgType, Edition)]}
|
||||||
].
|
].
|
||||||
|
|
||||||
emqx_description(cloud, ee) -> "EMQ X Enterprise";
|
emqx_description(cloud, ee) -> "EMQ X Enterprise Edition";
|
||||||
emqx_description(cloud, ce) -> "EMQ X Broker";
|
emqx_description(cloud, ce) -> "EMQ X Community Edition";
|
||||||
emqx_description(edge, ce) -> "EMQ X Edge".
|
emqx_description(edge, ce) -> "EMQ X Edge Edition".
|
||||||
|
|
||||||
overlay_vars(_RelType, PkgType, ee) ->
|
overlay_vars(RelType, PkgType, _Edition) ->
|
||||||
ee_overlay_vars(PkgType);
|
|
||||||
overlay_vars(RelType, PkgType, ce) ->
|
|
||||||
overlay_vars_rel(RelType) ++ overlay_vars_pkg(PkgType).
|
overlay_vars_rel(RelType) ++ overlay_vars_pkg(PkgType).
|
||||||
|
|
||||||
%% vars per release type, cloud or edge
|
%% vars per release type, cloud or edge
|
||||||
|
@ -289,7 +293,7 @@ relx_apps(ReleaseType, Edition) ->
|
||||||
, emqx_limiter
|
, emqx_limiter
|
||||||
]
|
]
|
||||||
++ [quicer || is_quicer_supported()]
|
++ [quicer || is_quicer_supported()]
|
||||||
++ [emqx_license || is_enterprise(Edition)]
|
%++ [emqx_license || is_enterprise(Edition)]
|
||||||
++ [bcrypt || provide_bcrypt_release(ReleaseType)]
|
++ [bcrypt || provide_bcrypt_release(ReleaseType)]
|
||||||
++ relx_apps_per_rel(ReleaseType)
|
++ relx_apps_per_rel(ReleaseType)
|
||||||
%% NOTE: applications below are only loaded after node start/restart
|
%% NOTE: applications below are only loaded after node start/restart
|
||||||
|
@ -472,38 +476,3 @@ list_dir(Dir) ->
|
||||||
false ->
|
false ->
|
||||||
[]
|
[]
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%% ==== Enterprise supports below ==================================================================
|
|
||||||
|
|
||||||
ee_profiles(Vsn) ->
|
|
||||||
[ {'emqx-ee', [ {erl_opts, prod_compile_opts(ee)}
|
|
||||||
, {relx, relx(Vsn, cloud, bin, ee)}
|
|
||||||
, {overrides, prod_overrides()}
|
|
||||||
, {project_app_dirs, project_app_dirs(ee)}
|
|
||||||
]}
|
|
||||||
, {'emqx-ee-pkg', [ {erl_opts, prod_compile_opts(ee)}
|
|
||||||
, {relx, relx(Vsn, cloud, pkg, ee)}
|
|
||||||
, {overrides, prod_overrides()}
|
|
||||||
, {project_app_dirs, project_app_dirs(ee)}
|
|
||||||
]}
|
|
||||||
, {'check-ee', [ {erl_opts, common_compile_opts(ee)}
|
|
||||||
, {project_app_dirs, project_app_dirs(ee)}
|
|
||||||
]}
|
|
||||||
, {'test-ee', [ {deps, test_deps()}
|
|
||||||
, {erl_opts, common_compile_opts(ee) ++ erl_opts_i(ee) }
|
|
||||||
, {extra_src_dirs, [{"test", [{recursive, true}]}]}
|
|
||||||
, {project_app_dirs, project_app_dirs(ee)}
|
|
||||||
]}
|
|
||||||
].
|
|
||||||
|
|
||||||
ee_overlay_vars(PkgType) ->
|
|
||||||
Common = [],
|
|
||||||
Common ++ ee_overlay_vars_pkg(PkgType).
|
|
||||||
|
|
||||||
%% vars per packaging type, bin(zip/tar.gz/docker) or pkg(rpm/deb)
|
|
||||||
ee_overlay_vars_pkg(bin) ->
|
|
||||||
[
|
|
||||||
];
|
|
||||||
ee_overlay_vars_pkg(pkg) ->
|
|
||||||
[
|
|
||||||
].
|
|
||||||
|
|
|
@ -7,12 +7,7 @@
|
||||||
main([]) ->
|
main([]) ->
|
||||||
Files = ["rebar.config"] ++
|
Files = ["rebar.config"] ++
|
||||||
apps_rebar_config("apps") ++
|
apps_rebar_config("apps") ++
|
||||||
case filelib:is_file("EMQX_ENTERPRISE") of
|
apps_rebar_config("lib-ee"),
|
||||||
true ->
|
|
||||||
true = filelib:is_dir("lib-ee"),
|
|
||||||
apps_rebar_config("lib-ee");
|
|
||||||
false -> []
|
|
||||||
end,
|
|
||||||
Deps = collect_deps(Files, #{}),
|
Deps = collect_deps(Files, #{}),
|
||||||
case count_bad_deps(Deps) of
|
case count_bad_deps(Deps) of
|
||||||
0 ->
|
0 ->
|
||||||
|
|
|
@ -11,9 +11,7 @@ find_app() {
|
||||||
}
|
}
|
||||||
|
|
||||||
find_app 'apps'
|
find_app 'apps'
|
||||||
if [ -f 'EMQX_ENTERPRISE' ]; then
|
find_app 'lib-ee'
|
||||||
find_app 'lib-ee'
|
|
||||||
fi
|
|
||||||
|
|
||||||
## find directories in lib-extra
|
## find directories in lib-extra
|
||||||
find_app 'lib-extra'
|
find_app 'lib-extra'
|
||||||
|
|
|
@ -4,6 +4,8 @@ set -euo pipefail
|
||||||
|
|
||||||
url="$2"
|
url="$2"
|
||||||
|
|
||||||
|
# we keep this to secure OLD private repo
|
||||||
|
# even after we have disclosed new code under EMQ BSL 1.0
|
||||||
if [ -f 'EMQX_ENTERPRISE' ]; then
|
if [ -f 'EMQX_ENTERPRISE' ]; then
|
||||||
if [[ "$url" != *emqx-enterprise* ]]; then
|
if [[ "$url" != *emqx-enterprise* ]]; then
|
||||||
echo "$(tput setaf 1)error: enterprise_code_to_non_enterprise_repo"
|
echo "$(tput setaf 1)error: enterprise_code_to_non_enterprise_repo"
|
||||||
|
|
Loading…
Reference in New Issue