build: replace cloud release type with standard and pass it as argument
This commit is contained in:
parent
874f1f2428
commit
3386f565aa
36
mix.exs
36
mix.exs
|
@ -113,8 +113,9 @@ defmodule EMQXUmbrella.MixProject do
|
||||||
set_emqx_app_system_env(apps, profile_info, version)
|
set_emqx_app_system_env(apps, profile_info, version)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp umbrella_apps(profile_info) do
|
defp umbrella_apps(profile_info = %{release_type: release_type}) do
|
||||||
enterprise_apps = enterprise_umbrella_apps()
|
enterprise_apps = enterprise_umbrella_apps(release_type)
|
||||||
|
excluded_apps = excluded_apps(release_type)
|
||||||
|
|
||||||
"apps/*"
|
"apps/*"
|
||||||
|> Path.wildcard()
|
|> Path.wildcard()
|
||||||
|
@ -140,10 +141,11 @@ defmodule EMQXUmbrella.MixProject do
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|> Enum.reject(fn {app, _} -> app in excluded_apps end)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp enterprise_apps(_profile_info = %{edition_type: :enterprise}) do
|
defp enterprise_apps(_profile_info = %{release_type: release_type, edition_type: :enterprise}) do
|
||||||
Enum.map(enterprise_umbrella_apps(), fn app_name ->
|
Enum.map(enterprise_umbrella_apps(release_type), fn app_name ->
|
||||||
path = "apps/#{app_name}"
|
path = "apps/#{app_name}"
|
||||||
{app_name, path: path, manager: :rebar3, override: true}
|
{app_name, path: path, manager: :rebar3, override: true}
|
||||||
end)
|
end)
|
||||||
|
@ -154,7 +156,7 @@ defmodule EMQXUmbrella.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
# need to remove those when listing `/apps/`...
|
# need to remove those when listing `/apps/`...
|
||||||
defp enterprise_umbrella_apps() do
|
defp enterprise_umbrella_apps(_release_type) do
|
||||||
MapSet.new([
|
MapSet.new([
|
||||||
:emqx_bridge_kafka,
|
:emqx_bridge_kafka,
|
||||||
:emqx_bridge_confluent,
|
:emqx_bridge_confluent,
|
||||||
|
@ -304,7 +306,7 @@ defmodule EMQXUmbrella.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
[
|
[
|
||||||
applications: applications(edition_type),
|
applications: applications(release_type, edition_type),
|
||||||
skip_mode_validation_for: [
|
skip_mode_validation_for: [
|
||||||
:emqx_mix,
|
:emqx_mix,
|
||||||
:emqx_gateway,
|
:emqx_gateway,
|
||||||
|
@ -344,7 +346,7 @@ defmodule EMQXUmbrella.MixProject do
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
def applications(edition_type) do
|
def applications(release_type, edition_type) do
|
||||||
{:ok,
|
{:ok,
|
||||||
[
|
[
|
||||||
%{
|
%{
|
||||||
|
@ -365,7 +367,7 @@ defmodule EMQXUmbrella.MixProject do
|
||||||
|
|
||||||
business_apps = common_business_apps ++ edition_specific_apps
|
business_apps = common_business_apps ++ edition_specific_apps
|
||||||
|
|
||||||
excluded_apps = excluded_apps()
|
excluded_apps = excluded_apps(release_type)
|
||||||
|
|
||||||
system_apps =
|
system_apps =
|
||||||
Enum.map(system_apps, fn app ->
|
Enum.map(system_apps, fn app ->
|
||||||
|
@ -380,7 +382,7 @@ defmodule EMQXUmbrella.MixProject do
|
||||||
|> Keyword.reject(fn {app, _type} -> app in excluded_apps end)
|
|> Keyword.reject(fn {app, _type} -> app in excluded_apps end)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp excluded_apps() do
|
defp excluded_apps(_release_type) do
|
||||||
%{
|
%{
|
||||||
mnesia_rocksdb: enable_rocksdb?(),
|
mnesia_rocksdb: enable_rocksdb?(),
|
||||||
quicer: enable_quicer?(),
|
quicer: enable_quicer?(),
|
||||||
|
@ -451,19 +453,19 @@ defmodule EMQXUmbrella.MixProject do
|
||||||
} =
|
} =
|
||||||
case Mix.env() do
|
case Mix.env() do
|
||||||
:dev ->
|
:dev ->
|
||||||
{:cloud, :bin, :community}
|
{:standard, :bin, :community}
|
||||||
|
|
||||||
:emqx ->
|
:emqx ->
|
||||||
{:cloud, :bin, :community}
|
{:standard, :bin, :community}
|
||||||
|
|
||||||
:"emqx-enterprise" ->
|
:"emqx-enterprise" ->
|
||||||
{:cloud, :bin, :enterprise}
|
{:standard, :bin, :enterprise}
|
||||||
|
|
||||||
:"emqx-pkg" ->
|
:"emqx-pkg" ->
|
||||||
{:cloud, :pkg, :community}
|
{:standard, :pkg, :community}
|
||||||
|
|
||||||
:"emqx-enterprise-pkg" ->
|
:"emqx-enterprise-pkg" ->
|
||||||
{:cloud, :pkg, :enterprise}
|
{:standard, :pkg, :enterprise}
|
||||||
end
|
end
|
||||||
|
|
||||||
normalize_env!()
|
normalize_env!()
|
||||||
|
@ -566,7 +568,7 @@ defmodule EMQXUmbrella.MixProject do
|
||||||
|
|
||||||
vm_args_template_path =
|
vm_args_template_path =
|
||||||
case release_type do
|
case release_type do
|
||||||
:cloud ->
|
_ ->
|
||||||
"apps/emqx/etc/vm.args.cloud"
|
"apps/emqx/etc/vm.args.cloud"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -780,10 +782,10 @@ defmodule EMQXUmbrella.MixProject do
|
||||||
|
|
||||||
defp emqx_description(release_type, edition_type) do
|
defp emqx_description(release_type, edition_type) do
|
||||||
case {release_type, edition_type} do
|
case {release_type, edition_type} do
|
||||||
{:cloud, :enterprise} ->
|
{_, :enterprise} ->
|
||||||
"EMQX Enterprise"
|
"EMQX Enterprise"
|
||||||
|
|
||||||
{:cloud, :community} ->
|
{_, :community} ->
|
||||||
"EMQX"
|
"EMQX"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -157,17 +157,24 @@ is_rocksdb_supported(_) ->
|
||||||
not is_build_without("ROCKSDB").
|
not is_build_without("ROCKSDB").
|
||||||
|
|
||||||
project_app_dirs() ->
|
project_app_dirs() ->
|
||||||
project_app_dirs(get_edition_from_profile_env()).
|
#{edition := Edition, reltype := RelType} = get_edition_from_profile_env(),
|
||||||
|
project_app_dirs(Edition, RelType).
|
||||||
|
|
||||||
project_app_dirs(Edition) ->
|
project_app_dirs(Edition, RelType) ->
|
||||||
IsEnterprise = is_enterprise(Edition),
|
IsEnterprise = is_enterprise(Edition),
|
||||||
|
ExcludedApps = excluded_apps(RelType),
|
||||||
UmbrellaApps = [
|
UmbrellaApps = [
|
||||||
Path
|
Path
|
||||||
|| Path <- filelib:wildcard("apps/*"),
|
|| Path <- filelib:wildcard("apps/*"),
|
||||||
is_community_umbrella_app(Path) orelse IsEnterprise
|
not project_app_excluded(Path, ExcludedApps) andalso
|
||||||
|
(is_community_umbrella_app(Path) orelse IsEnterprise)
|
||||||
],
|
],
|
||||||
UmbrellaApps.
|
UmbrellaApps.
|
||||||
|
|
||||||
|
project_app_excluded("apps/" ++ AppStr, ExcludedApps) ->
|
||||||
|
App = list_to_atom(AppStr),
|
||||||
|
lists:member(App, ExcludedApps).
|
||||||
|
|
||||||
plugins() ->
|
plugins() ->
|
||||||
[
|
[
|
||||||
%{relup_helper, {git, "https://github.com/emqx/relup_helper", {tag, "2.1.0"}}},
|
%{relup_helper, {git, "https://github.com/emqx/relup_helper", {tag, "2.1.0"}}},
|
||||||
|
@ -196,9 +203,10 @@ test_deps() ->
|
||||||
].
|
].
|
||||||
|
|
||||||
common_compile_opts() ->
|
common_compile_opts() ->
|
||||||
common_compile_opts(get_edition_from_profile_env(), undefined).
|
#{edition := Edition, reltype := RelType} = get_edition_from_profile_env(),
|
||||||
|
common_compile_opts(Edition, RelType, undefined).
|
||||||
|
|
||||||
common_compile_opts(Edition, Vsn) ->
|
common_compile_opts(Edition, _RelType, Vsn) ->
|
||||||
% always include debug_info
|
% always include debug_info
|
||||||
[
|
[
|
||||||
debug_info,
|
debug_info,
|
||||||
|
@ -224,71 +232,72 @@ warn_profile_env() ->
|
||||||
get_edition_from_profile_env() ->
|
get_edition_from_profile_env() ->
|
||||||
case os:getenv("PROFILE") of
|
case os:getenv("PROFILE") of
|
||||||
"emqx-enterprise" ++ _ ->
|
"emqx-enterprise" ++ _ ->
|
||||||
ee;
|
#{edition => ee, reltype => standard};
|
||||||
"emqx" ++ _ ->
|
"emqx" ++ _ ->
|
||||||
ce;
|
#{edition => ce, reltype => standard};
|
||||||
false ->
|
false ->
|
||||||
ee;
|
#{edition => ee, reltype => standard};
|
||||||
V ->
|
V ->
|
||||||
io:format(standard_error, "ERROR: bad_PROFILE ~p~n", [V]),
|
io:format(standard_error, "ERROR: bad_PROFILE ~p~n", [V]),
|
||||||
exit(bad_PROFILE)
|
exit(bad_PROFILE)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
prod_compile_opts(Edition, Vsn) ->
|
prod_compile_opts(Edition, RelType, Vsn) ->
|
||||||
[
|
[
|
||||||
compressed,
|
compressed,
|
||||||
deterministic,
|
deterministic,
|
||||||
warnings_as_errors
|
warnings_as_errors
|
||||||
| common_compile_opts(Edition, Vsn)
|
| common_compile_opts(Edition, RelType, Vsn)
|
||||||
].
|
].
|
||||||
|
|
||||||
prod_overrides() ->
|
prod_overrides() ->
|
||||||
[{add, [{erl_opts, [deterministic]}]}].
|
[{add, [{erl_opts, [deterministic]}]}].
|
||||||
|
|
||||||
profiles() ->
|
profiles() ->
|
||||||
case get_edition_from_profile_env() of
|
#{edition := Edition, reltype := RelType} = get_edition_from_profile_env(),
|
||||||
|
case Edition of
|
||||||
ee ->
|
ee ->
|
||||||
profiles_ee();
|
profiles_ee(RelType);
|
||||||
ce ->
|
ce ->
|
||||||
profiles_ce()
|
profiles_ce(RelType)
|
||||||
end ++ profiles_dev().
|
end ++ profiles_dev(RelType).
|
||||||
|
|
||||||
profiles_ce() ->
|
profiles_ce(RelType) ->
|
||||||
Vsn = get_vsn(emqx),
|
Vsn = get_vsn(emqx),
|
||||||
[
|
[
|
||||||
{'emqx', [
|
{'emqx', [
|
||||||
{erl_opts, prod_compile_opts(ce, Vsn)},
|
{erl_opts, prod_compile_opts(ce, RelType, Vsn)},
|
||||||
{relx, relx(Vsn, cloud, bin, ce)},
|
{relx, relx(Vsn, RelType, bin, ce)},
|
||||||
{overrides, prod_overrides()},
|
{overrides, prod_overrides()},
|
||||||
{project_app_dirs, project_app_dirs(ce)}
|
{project_app_dirs, project_app_dirs(ce, RelType)}
|
||||||
]},
|
]},
|
||||||
{'emqx-pkg', [
|
{'emqx-pkg', [
|
||||||
{erl_opts, prod_compile_opts(ce, Vsn)},
|
{erl_opts, prod_compile_opts(ce, RelType, Vsn)},
|
||||||
{relx, relx(Vsn, cloud, pkg, ce)},
|
{relx, relx(Vsn, RelType, pkg, ce)},
|
||||||
{overrides, prod_overrides()},
|
{overrides, prod_overrides()},
|
||||||
{project_app_dirs, project_app_dirs(ce)}
|
{project_app_dirs, project_app_dirs(ce, RelType)}
|
||||||
]}
|
]}
|
||||||
].
|
].
|
||||||
|
|
||||||
profiles_ee() ->
|
profiles_ee(RelType) ->
|
||||||
Vsn = get_vsn('emqx-enterprise'),
|
Vsn = get_vsn('emqx-enterprise'),
|
||||||
[
|
[
|
||||||
{'emqx-enterprise', [
|
{'emqx-enterprise', [
|
||||||
{erl_opts, prod_compile_opts(ee, Vsn)},
|
{erl_opts, prod_compile_opts(ee, RelType, Vsn)},
|
||||||
{relx, relx(Vsn, cloud, bin, ee)},
|
{relx, relx(Vsn, RelType, bin, ee)},
|
||||||
{overrides, prod_overrides()},
|
{overrides, prod_overrides()},
|
||||||
{project_app_dirs, project_app_dirs(ee)}
|
{project_app_dirs, project_app_dirs(ee, RelType)}
|
||||||
]},
|
]},
|
||||||
{'emqx-enterprise-pkg', [
|
{'emqx-enterprise-pkg', [
|
||||||
{erl_opts, prod_compile_opts(ee, Vsn)},
|
{erl_opts, prod_compile_opts(ee, RelType, Vsn)},
|
||||||
{relx, relx(Vsn, cloud, pkg, ee)},
|
{relx, relx(Vsn, RelType, pkg, ee)},
|
||||||
{overrides, prod_overrides()},
|
{overrides, prod_overrides()},
|
||||||
{project_app_dirs, project_app_dirs(ee)}
|
{project_app_dirs, project_app_dirs(ee, RelType)}
|
||||||
]}
|
]}
|
||||||
].
|
].
|
||||||
|
|
||||||
%% EE has more files than CE, always test/check with EE options.
|
%% EE has more files than CE, always test/check with EE options.
|
||||||
profiles_dev() ->
|
profiles_dev(_RelType) ->
|
||||||
[
|
[
|
||||||
{check, [
|
{check, [
|
||||||
{erl_opts, common_compile_opts()},
|
{erl_opts, common_compile_opts()},
|
||||||
|
@ -302,7 +311,7 @@ profiles_dev() ->
|
||||||
]}
|
]}
|
||||||
].
|
].
|
||||||
|
|
||||||
%% RelType: cloud (full size)
|
%% RelType: standard
|
||||||
%% PkgType: bin | pkg
|
%% PkgType: bin | pkg
|
||||||
%% Edition: ce (opensource) | ee (enterprise)
|
%% Edition: ce (opensource) | ee (enterprise)
|
||||||
relx(Vsn, RelType, PkgType, Edition) ->
|
relx(Vsn, RelType, PkgType, Edition) ->
|
||||||
|
@ -341,10 +350,10 @@ relform() ->
|
||||||
Other -> Other
|
Other -> Other
|
||||||
end.
|
end.
|
||||||
|
|
||||||
emqx_description(cloud, ee) -> "EMQX Enterprise";
|
emqx_description(_, ee) -> "EMQX Enterprise";
|
||||||
emqx_description(cloud, ce) -> "EMQX".
|
emqx_description(_, ce) -> "EMQX".
|
||||||
|
|
||||||
overlay_vars(cloud, PkgType, Edition) ->
|
overlay_vars(_RelType, PkgType, Edition) ->
|
||||||
[
|
[
|
||||||
{emqx_default_erlang_cookie, "emqxsecretcookie"}
|
{emqx_default_erlang_cookie, "emqxsecretcookie"}
|
||||||
] ++
|
] ++
|
||||||
|
@ -411,15 +420,16 @@ relx_apps(ReleaseType, Edition) ->
|
||||||
ce -> CEBusinessApps
|
ce -> CEBusinessApps
|
||||||
end,
|
end,
|
||||||
BusinessApps = CommonBusinessApps ++ EditionSpecificApps,
|
BusinessApps = CommonBusinessApps ++ EditionSpecificApps,
|
||||||
|
ExcludedApps = excluded_apps(ReleaseType),
|
||||||
Apps =
|
Apps =
|
||||||
(SystemApps ++
|
([App || App <- SystemApps, not lists:member(App, ExcludedApps)] ++
|
||||||
%% EMQX starts the DB and the business applications:
|
%% EMQX starts the DB and the business applications:
|
||||||
[{App, load} || App <- DBApps] ++
|
[{App, load} || App <- DBApps, not lists:member(App, ExcludedApps)] ++
|
||||||
[emqx_machine] ++
|
[emqx_machine] ++
|
||||||
[{App, load} || App <- BusinessApps]),
|
[{App, load} || App <- BusinessApps, not lists:member(App, ExcludedApps)]),
|
||||||
lists:foldl(fun proplists:delete/2, Apps, excluded_apps(ReleaseType)).
|
Apps.
|
||||||
|
|
||||||
excluded_apps(_ReleaseType) ->
|
excluded_apps(_RelType) ->
|
||||||
OptionalApps = [
|
OptionalApps = [
|
||||||
{quicer, is_quicer_supported()},
|
{quicer, is_quicer_supported()},
|
||||||
{jq, is_jq_supported()},
|
{jq, is_jq_supported()},
|
||||||
|
@ -489,7 +499,7 @@ emqx_etc_overlay(ReleaseType) ->
|
||||||
emqx_etc_overlay_per_rel(ReleaseType) ++
|
emqx_etc_overlay_per_rel(ReleaseType) ++
|
||||||
emqx_etc_overlay().
|
emqx_etc_overlay().
|
||||||
|
|
||||||
emqx_etc_overlay_per_rel(cloud) ->
|
emqx_etc_overlay_per_rel(_RelType) ->
|
||||||
[{"{{base_dir}}/lib/emqx/etc/vm.args.cloud", "etc/vm.args"}].
|
[{"{{base_dir}}/lib/emqx/etc/vm.args.cloud", "etc/vm.args"}].
|
||||||
|
|
||||||
emqx_etc_overlay() ->
|
emqx_etc_overlay() ->
|
||||||
|
@ -543,10 +553,11 @@ dialyzer(Config) ->
|
||||||
end,
|
end,
|
||||||
|
|
||||||
AppNames = app_names(),
|
AppNames = app_names(),
|
||||||
|
ExcludedApps = excluded_apps(standard),
|
||||||
|
|
||||||
KnownApps = [Name || Name <- AppsToAnalyse, lists:member(Name, AppNames)],
|
KnownApps = [Name || Name <- AppsToAnalyse, lists:member(Name, AppNames)],
|
||||||
|
|
||||||
AppsToExclude = AppNames -- KnownApps,
|
AppsToExclude = ExcludedApps -- KnownApps ++ AppNames,
|
||||||
|
|
||||||
Extra =
|
Extra =
|
||||||
[system_monitor, tools, covertool] ++
|
[system_monitor, tools, covertool] ++
|
||||||
|
|
|
@ -22,7 +22,7 @@ defmodule CheckElixirApplications do
|
||||||
env: [{"DEBUG", "1"}]
|
env: [{"DEBUG", "1"}]
|
||||||
)
|
)
|
||||||
|
|
||||||
mix_apps = mix_applications(inputs.edition_type)
|
mix_apps = mix_applications(inputs.release_type, inputs.edition_type)
|
||||||
rebar_apps = rebar_applications(profile)
|
rebar_apps = rebar_applications(profile)
|
||||||
results = diff_apps(mix_apps, rebar_apps)
|
results = diff_apps(mix_apps, rebar_apps)
|
||||||
|
|
||||||
|
@ -70,8 +70,8 @@ defmodule CheckElixirApplications do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp mix_applications(edition_type) do
|
defp mix_applications(release_type, edition_type) do
|
||||||
EMQXUmbrella.MixProject.applications(edition_type)
|
EMQXUmbrella.MixProject.applications(release_type, edition_type)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp rebar_applications(profile) do
|
defp rebar_applications(profile) do
|
||||||
|
|
|
@ -14,7 +14,7 @@ profile = Mix.env()
|
||||||
# need to use this information because we might have compiled all
|
# need to use this information because we might have compiled all
|
||||||
# applications in the test profile, and thus filter what's in the
|
# applications in the test profile, and thus filter what's in the
|
||||||
# release lib directory.
|
# release lib directory.
|
||||||
rel_apps = MixProject.applications(inputs.edition_type)
|
rel_apps = MixProject.applications(inputs.release_type, inputs.edition_type)
|
||||||
|
|
||||||
apps =
|
apps =
|
||||||
rel_apps
|
rel_apps
|
||||||
|
|
Loading…
Reference in New Issue