refactor(build): Move parse_transform module to root app

So we do not have to workaround the compile order issue
This commit is contained in:
Zaiming Shi 2021-03-01 22:03:49 +01:00 committed by turtleDeng
parent b166ee5651
commit dd06d70bce
3 changed files with 2 additions and 17 deletions

View File

@ -34,7 +34,7 @@
{post_hooks,[]}.
{erl_first_files, ["src/emqx_logger.erl"]}.
{erl_first_files, ["src/emqx_logger.erl", "src/emqx_rule_actions_trans.erl"]}.
{deps,
[ {gproc, {git, "https://github.com/uwiger/gproc", {tag, "0.8.0"}}}

View File

@ -2,8 +2,7 @@
-export([do/2]).
do(Dir, CONFIG) ->
ok = compile_and_load_pase_transforms(Dir),
do(_Dir, CONFIG) ->
C1 = deps(CONFIG),
Config = dialyzer(C1),
dump(Config ++ [{overrides, overrides()}] ++ coveralls() ++ config()).
@ -299,20 +298,6 @@ provide_bcrypt_dep() ->
provide_bcrypt_release(ReleaseType) ->
provide_bcrypt_dep() andalso ReleaseType =:= cloud.
%% this is a silly but working patch.
%% rebar3 does not handle umberella project's cross-app parse_transform well
compile_and_load_pase_transforms(Dir) ->
PtFiles =
[ "apps/emqx_rule_engine/src/emqx_rule_actions_trans.erl"
],
CompileOpts = [verbose,report_errors,report_warnings,return_errors,debug_info],
lists:foreach(fun(PtFile) -> {ok, _Mod} = compile:file(path(Dir, PtFile), CompileOpts) end, PtFiles).
path(Dir, Path) -> str(filename:join([Dir, Path])).
str(L) when is_list(L) -> L;
str(B) when is_binary(B) -> unicode:characters_to_list(B, utf8).
erl_opts_i() ->
[{i, "apps"}] ++
[{i, Dir} || Dir <- filelib:wildcard(filename:join(["apps", "*", "include"]))] ++