Merge pull request #12179 from zmstone/1215-chore-fix-app-src-for-emqx-app
1215 chore fix app src for emqx app
This commit is contained in:
commit
fbea2b73ac
|
@ -66,7 +66,6 @@
|
||||||
{plt_location, "."},
|
{plt_location, "."},
|
||||||
{plt_prefix, "emqx_dialyzer"},
|
{plt_prefix, "emqx_dialyzer"},
|
||||||
{plt_apps, all_apps},
|
{plt_apps, all_apps},
|
||||||
{plt_extra_apps, [hocon,mnesia,bcrypt,os_mon,pbkdf2,emqx_http_lib, recon]},
|
|
||||||
{statistics, true}
|
{statistics, true}
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,7 @@ Quicer = {quicer, {git, "https://github.com/emqx/quic.git", {tag, "0.0.308"}}}.
|
||||||
|
|
||||||
Dialyzer = fun(Config) ->
|
Dialyzer = fun(Config) ->
|
||||||
{dialyzer, OldDialyzerConfig} = lists:keyfind(dialyzer, 1, Config),
|
{dialyzer, OldDialyzerConfig} = lists:keyfind(dialyzer, 1, Config),
|
||||||
{plt_extra_apps, OldExtra} = lists:keyfind(plt_extra_apps, 1, OldDialyzerConfig),
|
Extra = [quicer || IsQuicSupp()],
|
||||||
Extra = OldExtra ++ [quicer || IsQuicSupp()],
|
|
||||||
NewDialyzerConfig = [{plt_extra_apps, Extra} | OldDialyzerConfig],
|
NewDialyzerConfig = [{plt_extra_apps, Extra} | OldDialyzerConfig],
|
||||||
lists:keystore(
|
lists:keystore(
|
||||||
dialyzer,
|
dialyzer,
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
stdlib,
|
stdlib,
|
||||||
gproc,
|
gproc,
|
||||||
gen_rpc,
|
gen_rpc,
|
||||||
|
mnesia,
|
||||||
mria,
|
mria,
|
||||||
ekka,
|
ekka,
|
||||||
esockd,
|
esockd,
|
||||||
|
@ -17,7 +18,12 @@
|
||||||
sasl,
|
sasl,
|
||||||
lc,
|
lc,
|
||||||
hocon,
|
hocon,
|
||||||
emqx_durable_storage
|
emqx_durable_storage,
|
||||||
|
bcrypt,
|
||||||
|
pbkdf2,
|
||||||
|
emqx_http_lib,
|
||||||
|
recon,
|
||||||
|
os_mon
|
||||||
]},
|
]},
|
||||||
{mod, {emqx_app, []}},
|
{mod, {emqx_app, []}},
|
||||||
{env, []},
|
{env, []},
|
||||||
|
|
|
@ -132,7 +132,7 @@ maps_key_take([K | Ks], M, Acc) ->
|
||||||
|
|
||||||
validate_listener_name(Name) ->
|
validate_listener_name(Name) ->
|
||||||
try
|
try
|
||||||
{match, _} = re:run(Name, "^[0-9a-zA-Z_-]+$"),
|
{match, _} = re:run(Name, "^[a-zA-Z][0-9a-zA-Z_-]*$"),
|
||||||
ok
|
ok
|
||||||
catch
|
catch
|
||||||
_:_ ->
|
_:_ ->
|
||||||
|
@ -140,7 +140,7 @@ validate_listener_name(Name) ->
|
||||||
{badconf, #{
|
{badconf, #{
|
||||||
key => name,
|
key => name,
|
||||||
value => Name,
|
value => Name,
|
||||||
reason => illegal_listener_name
|
reason => bad_listener_name
|
||||||
}}
|
}}
|
||||||
)
|
)
|
||||||
end.
|
end.
|
||||||
|
|
|
@ -166,7 +166,7 @@ start_grpc_server(GwName, Options = #{bind := ListenOn}) ->
|
||||||
{badconf, #{
|
{badconf, #{
|
||||||
key => server,
|
key => server,
|
||||||
value => Options,
|
value => Options,
|
||||||
reason => illegal_grpc_server_confs
|
reason => invalid_grpc_server_confs
|
||||||
}}
|
}}
|
||||||
)
|
)
|
||||||
end;
|
end;
|
||||||
|
@ -175,7 +175,7 @@ start_grpc_server(_GwName, Options) ->
|
||||||
{badconf, #{
|
{badconf, #{
|
||||||
key => server,
|
key => server,
|
||||||
value => Options,
|
value => Options,
|
||||||
reason => illegal_grpc_server_confs
|
reason => invalid_grpc_server_confs
|
||||||
}}
|
}}
|
||||||
).
|
).
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ start_grpc_client_channel(
|
||||||
{badconf, #{
|
{badconf, #{
|
||||||
key => address,
|
key => address,
|
||||||
value => Address,
|
value => Address,
|
||||||
reason => illegal_grpc_address
|
reason => invalid_grpc_address
|
||||||
}}
|
}}
|
||||||
)
|
)
|
||||||
end,
|
end,
|
||||||
|
@ -222,7 +222,7 @@ start_grpc_client_channel(_GwName, Options) ->
|
||||||
{badconf, #{
|
{badconf, #{
|
||||||
key => handler,
|
key => handler,
|
||||||
value => Options,
|
value => Options,
|
||||||
reason => ililegal_grpc_client_confs
|
reason => invalid_grpc_client_confs
|
||||||
}}
|
}}
|
||||||
).
|
).
|
||||||
|
|
||||||
|
|
|
@ -250,7 +250,7 @@ init_state_and_channel([Req, Opts, _WsOpts], _State = undefined) ->
|
||||||
cowboy_req:parse_cookies(Req)
|
cowboy_req:parse_cookies(Req)
|
||||||
catch
|
catch
|
||||||
error:badarg ->
|
error:badarg ->
|
||||||
?SLOG(error, #{msg => "illegal_cookie"}),
|
?SLOG(error, #{msg => "bad_cookie"}),
|
||||||
undefined;
|
undefined;
|
||||||
Error:Reason ->
|
Error:Reason ->
|
||||||
?SLOG(error, #{
|
?SLOG(error, #{
|
||||||
|
|
54
mix.exs
54
mix.exs
|
@ -98,11 +98,12 @@ defmodule EMQXUmbrella.MixProject do
|
||||||
# set by hackney (dependency)
|
# set by hackney (dependency)
|
||||||
{:ssl_verify_fun, "1.1.7", override: true},
|
{:ssl_verify_fun, "1.1.7", override: true},
|
||||||
{:rfc3339, github: "emqx/rfc3339", tag: "0.2.3", override: true},
|
{:rfc3339, github: "emqx/rfc3339", tag: "0.2.3", override: true},
|
||||||
|
{:bcrypt, github: "emqx/erlang-bcrypt", tag: "0.6.1", override: true},
|
||||||
{:uuid, github: "okeuday/uuid", tag: "v2.0.6", override: true},
|
{:uuid, github: "okeuday/uuid", tag: "v2.0.6", override: true},
|
||||||
{:quickrand, github: "okeuday/quickrand", tag: "v2.0.6", override: true}
|
{:quickrand, github: "okeuday/quickrand", tag: "v2.0.6", override: true}
|
||||||
] ++
|
] ++
|
||||||
emqx_apps(profile_info, version) ++
|
emqx_apps(profile_info, version) ++
|
||||||
enterprise_deps(profile_info) ++ bcrypt_dep() ++ jq_dep() ++ quicer_dep()
|
enterprise_deps(profile_info) ++ jq_dep() ++ quicer_dep()
|
||||||
end
|
end
|
||||||
|
|
||||||
defp emqx_apps(profile_info, version) do
|
defp emqx_apps(profile_info, version) do
|
||||||
|
@ -374,10 +375,8 @@ defmodule EMQXUmbrella.MixProject do
|
||||||
%{
|
%{
|
||||||
mnesia_rocksdb: enable_rocksdb?(),
|
mnesia_rocksdb: enable_rocksdb?(),
|
||||||
quicer: enable_quicer?(),
|
quicer: enable_quicer?(),
|
||||||
bcrypt: enable_bcrypt?(),
|
|
||||||
jq: enable_jq?(),
|
jq: enable_jq?(),
|
||||||
observer: is_app?(:observer),
|
observer: is_app?(:observer)
|
||||||
os_mon: enable_os_mon?()
|
|
||||||
}
|
}
|
||||||
|> Enum.reject(&elem(&1, 1))
|
|> Enum.reject(&elem(&1, 1))
|
||||||
|> Enum.map(&elem(&1, 0))
|
|> Enum.map(&elem(&1, 0))
|
||||||
|
@ -786,12 +785,6 @@ defmodule EMQXUmbrella.MixProject do
|
||||||
defp emqx_schema_mod(:enterprise), do: :emqx_enterprise_schema
|
defp emqx_schema_mod(:enterprise), do: :emqx_enterprise_schema
|
||||||
defp emqx_schema_mod(:community), do: :emqx_conf_schema
|
defp emqx_schema_mod(:community), do: :emqx_conf_schema
|
||||||
|
|
||||||
defp bcrypt_dep() do
|
|
||||||
if enable_bcrypt?(),
|
|
||||||
do: [{:bcrypt, github: "emqx/erlang-bcrypt", tag: "0.6.1", override: true}],
|
|
||||||
else: []
|
|
||||||
end
|
|
||||||
|
|
||||||
defp jq_dep() do
|
defp jq_dep() do
|
||||||
if enable_jq?(),
|
if enable_jq?(),
|
||||||
do: [{:jq, github: "emqx/jq", tag: "v0.3.12", override: true}],
|
do: [{:jq, github: "emqx/jq", tag: "v0.3.12", override: true}],
|
||||||
|
@ -805,35 +798,25 @@ defmodule EMQXUmbrella.MixProject do
|
||||||
else: []
|
else: []
|
||||||
end
|
end
|
||||||
|
|
||||||
defp enable_bcrypt?() do
|
|
||||||
not win32?()
|
|
||||||
end
|
|
||||||
|
|
||||||
defp enable_os_mon?() do
|
|
||||||
not win32?()
|
|
||||||
end
|
|
||||||
|
|
||||||
defp enable_jq?() do
|
defp enable_jq?() do
|
||||||
not Enum.any?([
|
not Enum.any?([
|
||||||
build_without_jq?(),
|
build_without_jq?()
|
||||||
win32?()
|
])
|
||||||
]) or "1" == System.get_env("BUILD_WITH_JQ")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
defp enable_quicer?() do
|
defp enable_quicer?() do
|
||||||
|
"1" == System.get_env("BUILD_WITH_QUIC") or
|
||||||
not Enum.any?([
|
not Enum.any?([
|
||||||
build_without_quic?(),
|
macos?(),
|
||||||
win32?(),
|
build_without_quic?()
|
||||||
centos6?(),
|
])
|
||||||
macos?()
|
|
||||||
]) or "1" == System.get_env("BUILD_WITH_QUIC")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
defp enable_rocksdb?() do
|
defp enable_rocksdb?() do
|
||||||
not Enum.any?([
|
not Enum.any?([
|
||||||
build_without_rocksdb?(),
|
raspbian?(),
|
||||||
raspbian?()
|
build_without_rocksdb?()
|
||||||
]) or "1" == System.get_env("BUILD_WITH_ROCKSDB")
|
])
|
||||||
end
|
end
|
||||||
|
|
||||||
defp pkg_vsn() do
|
defp pkg_vsn() do
|
||||||
|
@ -848,19 +831,6 @@ defmodule EMQXUmbrella.MixProject do
|
||||||
String.trim(str)
|
String.trim(str)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp win32?(),
|
|
||||||
do: match?({:win_32, _}, :os.type())
|
|
||||||
|
|
||||||
defp centos6?() do
|
|
||||||
case File.read("/etc/centos-release") do
|
|
||||||
{:ok, "CentOS release 6" <> _} ->
|
|
||||||
true
|
|
||||||
|
|
||||||
_ ->
|
|
||||||
false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
defp macos?() do
|
defp macos?() do
|
||||||
{:unix, :darwin} == :os.type()
|
{:unix, :darwin} == :os.type()
|
||||||
end
|
end
|
||||||
|
|
|
@ -97,6 +97,7 @@
|
||||||
, {uuid, {git, "https://github.com/okeuday/uuid.git", {tag, "v2.0.6"}}}
|
, {uuid, {git, "https://github.com/okeuday/uuid.git", {tag, "v2.0.6"}}}
|
||||||
, {ssl_verify_fun, "1.1.7"}
|
, {ssl_verify_fun, "1.1.7"}
|
||||||
, {rfc3339, {git, "https://github.com/emqx/rfc3339.git", {tag, "0.2.3"}}}
|
, {rfc3339, {git, "https://github.com/emqx/rfc3339.git", {tag, "0.2.3"}}}
|
||||||
|
, {bcrypt, {git, "https://github.com/emqx/erlang-bcrypt.git", {tag, "0.6.1"}}}
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
{xref_ignores,
|
{xref_ignores,
|
||||||
|
|
|
@ -35,9 +35,6 @@ assert_otp() ->
|
||||||
ok
|
ok
|
||||||
end.
|
end.
|
||||||
|
|
||||||
bcrypt() ->
|
|
||||||
{bcrypt, {git, "https://github.com/emqx/erlang-bcrypt.git", {tag, "0.6.1"}}}.
|
|
||||||
|
|
||||||
quicer() ->
|
quicer() ->
|
||||||
{quicer, {git, "https://github.com/emqx/quic.git", {tag, "0.0.308"}}}.
|
{quicer, {git, "https://github.com/emqx/quic.git", {tag, "0.0.308"}}}.
|
||||||
|
|
||||||
|
@ -47,7 +44,6 @@ jq() ->
|
||||||
deps(Config) ->
|
deps(Config) ->
|
||||||
{deps, OldDeps} = lists:keyfind(deps, 1, Config),
|
{deps, OldDeps} = lists:keyfind(deps, 1, Config),
|
||||||
MoreDeps =
|
MoreDeps =
|
||||||
[bcrypt() || provide_bcrypt_dep()] ++
|
|
||||||
[jq() || is_jq_supported()] ++
|
[jq() || is_jq_supported()] ++
|
||||||
[quicer() || is_quicer_supported()],
|
[quicer() || is_quicer_supported()],
|
||||||
lists:keystore(deps, 1, Config, {deps, OldDeps ++ MoreDeps}).
|
lists:keystore(deps, 1, Config, {deps, OldDeps ++ MoreDeps}).
|
||||||
|
@ -121,45 +117,41 @@ is_community_umbrella_app("apps/emqx_gateway_jt808") -> false;
|
||||||
is_community_umbrella_app("apps/emqx_bridge_syskeeper") -> false;
|
is_community_umbrella_app("apps/emqx_bridge_syskeeper") -> false;
|
||||||
is_community_umbrella_app(_) -> true.
|
is_community_umbrella_app(_) -> true.
|
||||||
|
|
||||||
|
%% BUILD_WITHOUT_JQ
|
||||||
|
%% BUILD_WITHOUT_QUIC
|
||||||
|
%% BUILD_WITHOUT_ROCKSDB
|
||||||
|
is_build_without(Name) ->
|
||||||
|
"1" =:= os:getenv("BUILD_WITHOUT_" ++ Name).
|
||||||
|
|
||||||
|
%% BUILD_WITH_QUIC
|
||||||
|
is_build_with(Name) ->
|
||||||
|
"1" =:= os:getenv("BUILD_WITH_" ++ Name).
|
||||||
|
|
||||||
is_jq_supported() ->
|
is_jq_supported() ->
|
||||||
not (false =/= os:getenv("BUILD_WITHOUT_JQ") orelse
|
not is_build_without("JQ").
|
||||||
is_win32()) orelse
|
|
||||||
"1" == os:getenv("BUILD_WITH_JQ").
|
|
||||||
|
|
||||||
is_quicer_supported() ->
|
is_quicer_supported() ->
|
||||||
not (false =/= os:getenv("BUILD_WITHOUT_QUIC") orelse
|
%% for ones who want to build QUIC on macos
|
||||||
is_macos() orelse
|
%% export BUILD_WITH_QUIC=1
|
||||||
is_win32() orelse is_centos_6()) orelse
|
is_build_with("QUIC") orelse
|
||||||
"1" == os:getenv("BUILD_WITH_QUIC").
|
is_quicer_supported(os:type()).
|
||||||
|
|
||||||
|
is_quicer_supported({unix, darwin}) ->
|
||||||
|
%% no quic on macos so far
|
||||||
|
false;
|
||||||
|
is_quicer_supported(_) ->
|
||||||
|
not is_build_without("QUIC").
|
||||||
|
|
||||||
is_rocksdb_supported() ->
|
is_rocksdb_supported() ->
|
||||||
not (false =/= os:getenv("BUILD_WITHOUT_ROCKSDB") orelse
|
%% there is no way one can build rocksdb on raspbian
|
||||||
is_raspbian()) orelse
|
%% so no need to check is_build_with
|
||||||
"1" == os:getenv("BUILD_WITH_ROCKSDB").
|
Distro = os_cmd("./scripts/get-distro.sh"),
|
||||||
|
is_rocksdb_supported(Distro).
|
||||||
|
|
||||||
is_macos() ->
|
is_rocksdb_supported("respbian" ++ _) ->
|
||||||
{unix, darwin} =:= os:type().
|
false;
|
||||||
|
is_rocksdb_supported(_) ->
|
||||||
is_centos_6() ->
|
not is_build_without("ROCKSDB").
|
||||||
%% reason:
|
|
||||||
%% glibc is too old
|
|
||||||
case file:read_file("/etc/centos-release") of
|
|
||||||
{ok, <<"CentOS release 6", _/binary>>} ->
|
|
||||||
true;
|
|
||||||
_ ->
|
|
||||||
false
|
|
||||||
end.
|
|
||||||
|
|
||||||
is_raspbian() ->
|
|
||||||
case os_cmd("./scripts/get-distro.sh") of
|
|
||||||
"raspbian" ++ _ ->
|
|
||||||
true;
|
|
||||||
_ ->
|
|
||||||
false
|
|
||||||
end.
|
|
||||||
|
|
||||||
is_win32() ->
|
|
||||||
win32 =:= element(1, os:type()).
|
|
||||||
|
|
||||||
project_app_dirs() ->
|
project_app_dirs() ->
|
||||||
project_app_dirs(get_edition_from_profile_env()).
|
project_app_dirs(get_edition_from_profile_env()).
|
||||||
|
@ -421,14 +413,12 @@ relx_apps(ReleaseType, Edition) ->
|
||||||
[{App, load} || App <- BusinessApps]),
|
[{App, load} || App <- BusinessApps]),
|
||||||
lists:foldl(fun proplists:delete/2, Apps, excluded_apps(ReleaseType)).
|
lists:foldl(fun proplists:delete/2, Apps, excluded_apps(ReleaseType)).
|
||||||
|
|
||||||
excluded_apps(ReleaseType) ->
|
excluded_apps(_ReleaseType) ->
|
||||||
OptionalApps = [
|
OptionalApps = [
|
||||||
{quicer, is_quicer_supported()},
|
{quicer, is_quicer_supported()},
|
||||||
{bcrypt, provide_bcrypt_release(ReleaseType)},
|
|
||||||
{jq, is_jq_supported()},
|
{jq, is_jq_supported()},
|
||||||
{observer, is_app(observer)},
|
{observer, is_app(observer)},
|
||||||
{mnesia_rocksdb, is_rocksdb_supported()},
|
{mnesia_rocksdb, is_rocksdb_supported()}
|
||||||
{os_mon, provide_os_mon_release()}
|
|
||||||
],
|
],
|
||||||
[App || {App, false} <- OptionalApps].
|
[App || {App, false} <- OptionalApps].
|
||||||
|
|
||||||
|
@ -531,15 +521,6 @@ is_debug(VarName) ->
|
||||||
_ -> true
|
_ -> true
|
||||||
end.
|
end.
|
||||||
|
|
||||||
provide_bcrypt_dep() ->
|
|
||||||
not is_win32().
|
|
||||||
|
|
||||||
provide_os_mon_release() ->
|
|
||||||
not is_win32().
|
|
||||||
|
|
||||||
provide_bcrypt_release(ReleaseType) ->
|
|
||||||
provide_bcrypt_dep() andalso ReleaseType =:= cloud.
|
|
||||||
|
|
||||||
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"]))].
|
||||||
|
@ -562,8 +543,7 @@ dialyzer(Config) ->
|
||||||
AppsToExclude = AppNames -- KnownApps,
|
AppsToExclude = AppNames -- KnownApps,
|
||||||
|
|
||||||
Extra =
|
Extra =
|
||||||
[os_mon, system_monitor, tools, covertool] ++
|
[system_monitor, tools, covertool] ++
|
||||||
[bcrypt || provide_bcrypt_dep()] ++
|
|
||||||
[jq || is_jq_supported()] ++
|
[jq || is_jq_supported()] ++
|
||||||
[quicer || is_quicer_supported()],
|
[quicer || is_quicer_supported()],
|
||||||
NewDialyzerConfig =
|
NewDialyzerConfig =
|
||||||
|
|
Loading…
Reference in New Issue