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:
Zaiming (Stone) Shi 2023-10-13 06:45:49 +02:00 committed by GitHub
commit dd03be29a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 22 additions and 75 deletions

View File

@ -43,7 +43,7 @@ jobs:
- uses: actions/cache@v3
with:
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: |
rebar3-dialyzer-plt-${{ matrix.profile }}-${{ matrix.otp }}-
- name: run static checks

View File

@ -296,7 +296,7 @@ $(foreach tt,$(ALL_ELIXIR_TGZS),$(eval $(call gen-elixir-tgz-target,$(tt))))
.PHONY: fmt
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'
@mix format

7
dev
View File

@ -336,13 +336,6 @@ copy_other_conf_files() {
is_current_profile_app() {
local app="$1"
case "$app" in
lib-ee*)
if [ "$PROFILE" = 'emqx-enterprise' ]; then
return 0
else
return 1
fi
;;
*emqx_telemetry*)
if [ "$PROFILE" = 'emqx-enterprise' ]; then
return 1

View File

@ -5,7 +5,7 @@
[
{config,
[
#{dirs => ["src", "apps/**/src", "lib-ee/**/src"],
#{dirs => ["src", "apps/**/src"],
filter => "*.erl",
ruleset => erl_files,
rules => [

15
mix.exs
View File

@ -169,24 +169,10 @@ defmodule EMQXUmbrella.MixProject do
end
defp enterprise_apps(_profile_info = %{edition_type: :enterprise}) do
umbrella_apps =
Enum.map(enterprise_umbrella_apps(), fn app_name ->
path = "apps/#{app_name}"
{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)
|> Enum.concat(umbrella_apps)
end
defp enterprise_apps(_profile_info) do
@ -220,6 +206,7 @@ defmodule EMQXUmbrella.MixProject do
:emqx_bridge_rabbitmq,
:emqx_bridge_clickhouse,
:emqx_ft,
:emqx_license,
:emqx_s3,
:emqx_schema_registry,
:emqx_enterprise,

View File

@ -164,11 +164,7 @@ project_app_dirs(Edition) ->
|| Path <- filelib:wildcard("apps/*"),
is_community_umbrella_app(Path) orelse IsEnterprise
],
UmbrellaApps ++
case IsEnterprise of
true -> ["lib-ee/*"];
false -> []
end.
UmbrellaApps.
plugins() ->
[
@ -539,8 +535,7 @@ provide_bcrypt_release(ReleaseType) ->
erl_opts_i() ->
[{i, "apps"}] ++
[{i, Dir} || Dir <- filelib:wildcard(filename:join(["apps", "*", "include"]))] ++
[{i, Dir} || Dir <- filelib:wildcard(filename:join(["lib-ee", "*", "include"]))].
[{i, Dir} || Dir <- filelib:wildcard(filename:join(["apps", "*", "include"]))].
dialyzer(Config) ->
{dialyzer, OldDialyzerConfig} = lists:keyfind(dialyzer, 1, Config),
@ -597,7 +592,7 @@ coveralls() ->
[]
end.
app_names() -> list_dir("apps") ++ list_dir("lib-ee").
app_names() -> list_dir("apps").
list_dir(Dir) ->
case filelib:is_dir(Dir) of

View File

@ -5,9 +5,7 @@
-mode(compile).
main([]) ->
Files = ["rebar.config"] ++
apps_rebar_config("apps") ++
apps_rebar_config("lib-ee"),
Files = ["rebar.config"] ++ apps_rebar_config("apps"),
Deps = collect_deps(Files, #{}),
case count_bad_deps(Deps) of
0 ->

View File

@ -98,33 +98,18 @@ if [ ! -d "${WHICH_APP}" ]; then
exit 1
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'
DOCKER_CT_ENVS_FILE="${WHICH_APP}/docker-ct"
case "${WHICH_APP}" in
lib-ee*)
## ensure enterprise profile when testing lib-ee applications
export PROFILE='emqx-enterprise'
;;
apps/*)
if [[ -f "${WHICH_APP}/BSL.txt" ]]; then
export PROFILE='emqx-enterprise'
else
export PROFILE='emqx'
if [ -f "${WHICH_APP}/BSL.txt" ]; then
if [ -n "${PROFILE:-}" ] && [ "${PROFILE}" != 'emqx-enterprise' ]; then
echo "bad_profile: PROFILE=${PROFILE} will not work for app ${WHICH_APP}"
exit 1
fi
;;
*)
export PROFILE="${PROFILE:-emqx}"
;;
esac
export PROFILE='emqx-enterprise'
else
export PROFILE='emqx'
fi
if [ -f "$DOCKER_CT_ENVS_FILE" ]; then
# shellcheck disable=SC2002

View File

@ -41,9 +41,7 @@ find_app() {
"$FIND" "${appdir}" -mindepth 1 -maxdepth 1 -type d
}
CE="$(find_app 'apps')"
EE="$(find_app 'lib-ee')"
APPS_ALL="$(echo -e "${CE}\n${EE}")"
APPS_ALL="$(find_app 'apps')"
if [ "$MODE" = 'list' ]; then
echo "${APPS_ALL}"
@ -87,9 +85,6 @@ describe_app() {
profile='emqx'
fi
;;
lib-ee/*)
profile='emqx-enterprise'
;;
*)
echo "unknown app: $app"
exit 1

View File

@ -72,12 +72,6 @@ while [ "$#" -gt 0 ]; do
esac
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
if [ "${SKIP_BUILD:-}" != 'yes' ]; then
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
# shellcheck disable=SC2068
./scripts/update_appup.escript \
--src-dirs "${SRC_DIRS}/**" \
--src-dirs "apps/**" \
--release-dir "_build/${PROFILE}/lib" \
--prev-release-dir "${PREV_REL_DIR}" \
--skip-build \