chore: move lib-ce to apps

Signed-off-by: zhanghongtong <rory-z@outlook.com>
This commit is contained in:
zhanghongtong 2021-06-15 11:50:15 +08:00 committed by Rory Z
parent 06dd83c171
commit 8a368efb95
56 changed files with 31 additions and 22 deletions

View File

@ -5,7 +5,7 @@
[ [
{config, {config,
[ [
#{dirs => ["src", "apps/**/src", "lib-ce/**/src", "lib-ee/**/src"], #{dirs => ["src", "apps/**/src", "lib-ee/**/src"],
filter => "*.erl", filter => "*.erl",
ruleset => erl_files, ruleset => erl_files,
rules => [ rules => [
@ -20,7 +20,7 @@
{left, "||"}]}} {left, "||"}]}}
] ]
}, },
#{dirs => ["test", "apps/**/test", "lib-ce/**/src"], #{dirs => ["test", "apps/**/test"],
filter => "*.erl", filter => "*.erl",
rules => [ rules => [
{elvis_text_style, line_length, #{ limit => 100 {elvis_text_style, line_length, #{ limit => 100

View File

@ -78,14 +78,12 @@ is_cover_enabled() ->
is_enterprise() -> is_enterprise() ->
filelib:is_regular("EMQX_ENTERPRISE"). filelib:is_regular("EMQX_ENTERPRISE").
alternative_lib_dir() ->
case is_enterprise() of
true -> "lib-ee";
false -> "lib-ce"
end.
project_app_dirs() -> project_app_dirs() ->
["apps/*", alternative_lib_dir() ++ "/*", "."]. ["apps/*"] ++
case is_enterprise() of
true -> ["lib-ee/*"];
false -> []
end.
plugins(HasElixir) -> plugins(HasElixir) ->
[ {relup_helper,{git,"https://github.com/emqx/relup_helper", {tag, "2.0.0"}}} [ {relup_helper,{git,"https://github.com/emqx/relup_helper", {tag, "2.0.0"}}}
@ -403,8 +401,13 @@ community_plugin_etc_overlays(App0) ->
%% the overlay should be hand-coded but not to rely on build-time wildcards. %% the overlay should be hand-coded but not to rely on build-time wildcards.
find_conf_files(App) -> find_conf_files(App) ->
Dir1 = filename:join(["apps", App, "etc"]), Dir1 = filename:join(["apps", App, "etc"]),
Dir2 = filename:join([alternative_lib_dir(), App, "etc"]), filelib:wildcard("*.conf", Dir1) ++
filelib:wildcard("*.conf", Dir1) ++ filelib:wildcard("*.conf", Dir2). case is_enterprise() of
true ->
Dir2 = filename:join(["lib-ee", App, "etc"]),
filelib:wildcard("*.conf", Dir2);
false -> []
end.
env(Name, Default) -> env(Name, Default) ->
case os:getenv(Name) of case os:getenv(Name) of
@ -445,7 +448,11 @@ provide_bcrypt_release(ReleaseType) ->
erl_opts_i() -> erl_opts_i() ->
[{i, "apps"}] ++ [{i, "apps"}] ++
[{i, Dir} || Dir <- filelib:wildcard(filename:join(["apps", "*", "include"]))] ++ [{i, Dir} || Dir <- filelib:wildcard(filename:join(["apps", "*", "include"]))] ++
[{i, Dir} || Dir <- filelib:wildcard(filename:join([alternative_lib_dir(), "*", "include"]))]. case is_enterprise() of
true ->
[{i, Dir} || Dir <- filelib:wildcard(filename:join(["lib-ee", "*", "include"]))];
false -> []
end.
dialyzer(Config) -> dialyzer(Config) ->
{dialyzer, OldDialyzerConfig} = lists:keyfind(dialyzer, 1, Config), {dialyzer, OldDialyzerConfig} = lists:keyfind(dialyzer, 1, Config),
@ -457,7 +464,11 @@ dialyzer(Config) ->
[ list_to_atom(App) || App <- string:tokens(Value, ",")] [ list_to_atom(App) || App <- string:tokens(Value, ",")]
end, end,
AppNames = [emqx | list_dir("apps")] ++ list_dir(alternative_lib_dir()), AppNames = [list_dir("apps")] ++
case is_enterprise() of
true -> [list_dir("lib-ee")];
false -> []
end,
KnownApps = [Name || Name <- AppsToAnalyse, lists:member(Name, AppNames)], KnownApps = [Name || Name <- AppsToAnalyse, lists:member(Name, AppNames)],

View File

@ -5,14 +5,14 @@
-mode(compile). -mode(compile).
main([]) -> main([]) ->
AppsDir = case filelib:is_file("EMQX_ENTERPRISE") of
true -> "lib-ee";
false -> "lib-ce"
end,
true = filelib:is_dir(AppsDir),
Files = ["rebar.config"] ++ Files = ["rebar.config"] ++
apps_rebar_config("apps") ++ apps_rebar_config("apps") ++
apps_rebar_config(AppsDir), case filelib:is_file("EMQX_ENTERPRISE") of
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 ->

View File

@ -13,8 +13,6 @@ find_app() {
find_app 'apps' find_app 'apps'
if [ -f 'EMQX_ENTERPRISE' ]; then if [ -f 'EMQX_ENTERPRISE' ]; then
find_app 'lib-ee' find_app 'lib-ee'
else
find_app 'lib-ce'
fi fi
## find directories in lib-extra ## find directories in lib-extra

View File

@ -16,7 +16,7 @@ if [ -f 'EMQX_ENTERPRISE' ]; then
DIRECT_DOWNLOAD_URL="" DIRECT_DOWNLOAD_URL=""
else else
VERSION="${EMQX_CE_DASHBOARD_VERSION}" VERSION="${EMQX_CE_DASHBOARD_VERSION}"
DASHBOARD_PATH='lib-ce/emqx_dashboard/priv' DASHBOARD_PATH='apps/emqx_dashboard/priv'
DASHBOARD_REPO='emqx-dashboard-frontend' DASHBOARD_REPO='emqx-dashboard-frontend'
AUTH="" AUTH=""
DIRECT_DOWNLOAD_URL="https://github.com/emqx/${DASHBOARD_REPO}/releases/download/${VERSION}/emqx-dashboard.zip" DIRECT_DOWNLOAD_URL="https://github.com/emqx/${DASHBOARD_REPO}/releases/download/${VERSION}/emqx-dashboard.zip"