Merge pull request #11751 from zmstone/1011-refactor-move-emqx_license-app-to-apps
1011 refactor move emqx_license app to apps
This commit is contained in:
commit
dd03be29a6
|
@ -43,7 +43,7 @@ jobs:
|
||||||
- uses: actions/cache@v3
|
- uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: "emqx_dialyzer_${{ matrix.otp }}_plt"
|
path: "emqx_dialyzer_${{ matrix.otp }}_plt"
|
||||||
key: rebar3-dialyzer-plt-${{ matrix.profile }}-${{ matrix.otp }}-${{ hashFiles('rebar.*', 'apps/*/rebar.*', 'lib-ee/*/rebar.*') }}
|
key: rebar3-dialyzer-plt-${{ matrix.profile }}-${{ matrix.otp }}-${{ hashFiles('rebar.*', 'apps/*/rebar.*') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
rebar3-dialyzer-plt-${{ matrix.profile }}-${{ matrix.otp }}-
|
rebar3-dialyzer-plt-${{ matrix.profile }}-${{ matrix.otp }}-
|
||||||
- name: run static checks
|
- name: run static checks
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -296,7 +296,7 @@ $(foreach tt,$(ALL_ELIXIR_TGZS),$(eval $(call gen-elixir-tgz-target,$(tt))))
|
||||||
|
|
||||||
.PHONY: fmt
|
.PHONY: fmt
|
||||||
fmt: $(REBAR)
|
fmt: $(REBAR)
|
||||||
@$(SCRIPTS)/erlfmt -w '{apps,lib-ee}/*/{src,include,priv,test,integration_test}/**/*.{erl,hrl,app.src,eterm}'
|
@$(SCRIPTS)/erlfmt -w 'apps/*/{src,include,priv,test,integration_test}/**/*.{erl,hrl,app.src,eterm}'
|
||||||
@$(SCRIPTS)/erlfmt -w 'rebar.config.erl'
|
@$(SCRIPTS)/erlfmt -w 'rebar.config.erl'
|
||||||
@mix format
|
@mix format
|
||||||
|
|
||||||
|
|
7
dev
7
dev
|
@ -336,13 +336,6 @@ copy_other_conf_files() {
|
||||||
is_current_profile_app() {
|
is_current_profile_app() {
|
||||||
local app="$1"
|
local app="$1"
|
||||||
case "$app" in
|
case "$app" in
|
||||||
lib-ee*)
|
|
||||||
if [ "$PROFILE" = 'emqx-enterprise' ]; then
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*emqx_telemetry*)
|
*emqx_telemetry*)
|
||||||
if [ "$PROFILE" = 'emqx-enterprise' ]; then
|
if [ "$PROFILE" = 'emqx-enterprise' ]; then
|
||||||
return 1
|
return 1
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
[
|
[
|
||||||
{config,
|
{config,
|
||||||
[
|
[
|
||||||
#{dirs => ["src", "apps/**/src", "lib-ee/**/src"],
|
#{dirs => ["src", "apps/**/src"],
|
||||||
filter => "*.erl",
|
filter => "*.erl",
|
||||||
ruleset => erl_files,
|
ruleset => erl_files,
|
||||||
rules => [
|
rules => [
|
||||||
|
|
21
mix.exs
21
mix.exs
|
@ -169,24 +169,10 @@ defmodule EMQXUmbrella.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp enterprise_apps(_profile_info = %{edition_type: :enterprise}) do
|
defp enterprise_apps(_profile_info = %{edition_type: :enterprise}) do
|
||||||
umbrella_apps =
|
Enum.map(enterprise_umbrella_apps(), fn app_name ->
|
||||||
Enum.map(enterprise_umbrella_apps(), 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)
|
|
||||||
|
|
||||||
"lib-ee/*"
|
|
||||||
|> Path.wildcard()
|
|
||||||
|> Enum.filter(&File.dir?/1)
|
|
||||||
|> Enum.map(fn path ->
|
|
||||||
app =
|
|
||||||
path
|
|
||||||
|> Path.basename()
|
|
||||||
|> String.to_atom()
|
|
||||||
|
|
||||||
{app, path: path, manager: :rebar3, override: true}
|
|
||||||
end)
|
end)
|
||||||
|> Enum.concat(umbrella_apps)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
defp enterprise_apps(_profile_info) do
|
defp enterprise_apps(_profile_info) do
|
||||||
|
@ -220,6 +206,7 @@ defmodule EMQXUmbrella.MixProject do
|
||||||
:emqx_bridge_rabbitmq,
|
:emqx_bridge_rabbitmq,
|
||||||
:emqx_bridge_clickhouse,
|
:emqx_bridge_clickhouse,
|
||||||
:emqx_ft,
|
:emqx_ft,
|
||||||
|
:emqx_license,
|
||||||
:emqx_s3,
|
:emqx_s3,
|
||||||
:emqx_schema_registry,
|
:emqx_schema_registry,
|
||||||
:emqx_enterprise,
|
:emqx_enterprise,
|
||||||
|
|
|
@ -164,11 +164,7 @@ project_app_dirs(Edition) ->
|
||||||
|| Path <- filelib:wildcard("apps/*"),
|
|| Path <- filelib:wildcard("apps/*"),
|
||||||
is_community_umbrella_app(Path) orelse IsEnterprise
|
is_community_umbrella_app(Path) orelse IsEnterprise
|
||||||
],
|
],
|
||||||
UmbrellaApps ++
|
UmbrellaApps.
|
||||||
case IsEnterprise of
|
|
||||||
true -> ["lib-ee/*"];
|
|
||||||
false -> []
|
|
||||||
end.
|
|
||||||
|
|
||||||
plugins() ->
|
plugins() ->
|
||||||
[
|
[
|
||||||
|
@ -539,8 +535,7 @@ 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(["lib-ee", "*", "include"]))].
|
|
||||||
|
|
||||||
dialyzer(Config) ->
|
dialyzer(Config) ->
|
||||||
{dialyzer, OldDialyzerConfig} = lists:keyfind(dialyzer, 1, Config),
|
{dialyzer, OldDialyzerConfig} = lists:keyfind(dialyzer, 1, Config),
|
||||||
|
@ -597,7 +592,7 @@ coveralls() ->
|
||||||
[]
|
[]
|
||||||
end.
|
end.
|
||||||
|
|
||||||
app_names() -> list_dir("apps") ++ list_dir("lib-ee").
|
app_names() -> list_dir("apps").
|
||||||
|
|
||||||
list_dir(Dir) ->
|
list_dir(Dir) ->
|
||||||
case filelib:is_dir(Dir) of
|
case filelib:is_dir(Dir) of
|
||||||
|
|
|
@ -5,9 +5,7 @@
|
||||||
-mode(compile).
|
-mode(compile).
|
||||||
|
|
||||||
main([]) ->
|
main([]) ->
|
||||||
Files = ["rebar.config"] ++
|
Files = ["rebar.config"] ++ apps_rebar_config("apps"),
|
||||||
apps_rebar_config("apps") ++
|
|
||||||
apps_rebar_config("lib-ee"),
|
|
||||||
Deps = collect_deps(Files, #{}),
|
Deps = collect_deps(Files, #{}),
|
||||||
case count_bad_deps(Deps) of
|
case count_bad_deps(Deps) of
|
||||||
0 ->
|
0 ->
|
||||||
|
|
|
@ -98,33 +98,18 @@ if [ ! -d "${WHICH_APP}" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${WHICH_APP}" == lib-ee* && (-z "${PROFILE+x}" || "${PROFILE}" != emqx-enterprise) ]]; then
|
|
||||||
echo 'You are trying to run an enterprise test case without the emqx-enterprise profile.'
|
|
||||||
echo 'This will most likely not work.'
|
|
||||||
echo ''
|
|
||||||
echo 'Run "export PROFILE=emqx-enterprise" and "make" to fix this'
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
ERLANG_CONTAINER='erlang'
|
ERLANG_CONTAINER='erlang'
|
||||||
DOCKER_CT_ENVS_FILE="${WHICH_APP}/docker-ct"
|
DOCKER_CT_ENVS_FILE="${WHICH_APP}/docker-ct"
|
||||||
|
|
||||||
case "${WHICH_APP}" in
|
if [ -f "${WHICH_APP}/BSL.txt" ]; then
|
||||||
lib-ee*)
|
if [ -n "${PROFILE:-}" ] && [ "${PROFILE}" != 'emqx-enterprise' ]; then
|
||||||
## ensure enterprise profile when testing lib-ee applications
|
echo "bad_profile: PROFILE=${PROFILE} will not work for app ${WHICH_APP}"
|
||||||
export PROFILE='emqx-enterprise'
|
exit 1
|
||||||
;;
|
fi
|
||||||
apps/*)
|
export PROFILE='emqx-enterprise'
|
||||||
if [[ -f "${WHICH_APP}/BSL.txt" ]]; then
|
else
|
||||||
export PROFILE='emqx-enterprise'
|
export PROFILE='emqx'
|
||||||
else
|
fi
|
||||||
export PROFILE='emqx'
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
export PROFILE="${PROFILE:-emqx}"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -f "$DOCKER_CT_ENVS_FILE" ]; then
|
if [ -f "$DOCKER_CT_ENVS_FILE" ]; then
|
||||||
# shellcheck disable=SC2002
|
# shellcheck disable=SC2002
|
||||||
|
|
|
@ -41,9 +41,7 @@ find_app() {
|
||||||
"$FIND" "${appdir}" -mindepth 1 -maxdepth 1 -type d
|
"$FIND" "${appdir}" -mindepth 1 -maxdepth 1 -type d
|
||||||
}
|
}
|
||||||
|
|
||||||
CE="$(find_app 'apps')"
|
APPS_ALL="$(find_app 'apps')"
|
||||||
EE="$(find_app 'lib-ee')"
|
|
||||||
APPS_ALL="$(echo -e "${CE}\n${EE}")"
|
|
||||||
|
|
||||||
if [ "$MODE" = 'list' ]; then
|
if [ "$MODE" = 'list' ]; then
|
||||||
echo "${APPS_ALL}"
|
echo "${APPS_ALL}"
|
||||||
|
@ -87,9 +85,6 @@ describe_app() {
|
||||||
profile='emqx'
|
profile='emqx'
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
lib-ee/*)
|
|
||||||
profile='emqx-enterprise'
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
echo "unknown app: $app"
|
echo "unknown app: $app"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
@ -72,12 +72,6 @@ while [ "$#" -gt 0 ]; do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$TAG_PREFIX" = 'v' ]; then
|
|
||||||
SRC_DIRS="{apps}"
|
|
||||||
else
|
|
||||||
SRC_DIRS="{apps,lib-ee}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
## make sure we build here in bash and always pass --skip-build to escript
|
## make sure we build here in bash and always pass --skip-build to escript
|
||||||
if [ "${SKIP_BUILD:-}" != 'yes' ]; then
|
if [ "${SKIP_BUILD:-}" != 'yes' ]; then
|
||||||
make "${PROFILE}"
|
make "${PROFILE}"
|
||||||
|
@ -114,7 +108,7 @@ PREV_REL_DIR="${PREV_DIR_BASE}/${PREV_TAG}/_build/${PROFILE}/lib"
|
||||||
# this in turn makes quoting "${ESCRIPT_ARGS[@]}" problematic, hence disable SC2068 check here
|
# this in turn makes quoting "${ESCRIPT_ARGS[@]}" problematic, hence disable SC2068 check here
|
||||||
# shellcheck disable=SC2068
|
# shellcheck disable=SC2068
|
||||||
./scripts/update_appup.escript \
|
./scripts/update_appup.escript \
|
||||||
--src-dirs "${SRC_DIRS}/**" \
|
--src-dirs "apps/**" \
|
||||||
--release-dir "_build/${PROFILE}/lib" \
|
--release-dir "_build/${PROFILE}/lib" \
|
||||||
--prev-release-dir "${PREV_REL_DIR}" \
|
--prev-release-dir "${PREV_REL_DIR}" \
|
||||||
--skip-build \
|
--skip-build \
|
||||||
|
|
Loading…
Reference in New Issue