Merge pull request #4248 from zmstone/chore-mod-vsn-ng

chore(build): inject emqx_vsn as compile_info
This commit is contained in:
Zaiming Shi 2021-03-01 06:44:34 +01:00 committed by GitHub
commit 85b43af2ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 12 deletions

View File

@ -6,13 +6,10 @@
%% with rebar.config.erl module. Final result is written to %% with rebar.config.erl module. Final result is written to
%% rebar.config.rendered if environment DEBUG is set. %% rebar.config.rendered if environment DEBUG is set.
{minimum_otp_vsn, "21.3"}.
{edoc_opts, [{preprocess,true}]}. {edoc_opts, [{preprocess,true}]}.
{erl_opts, [warn_unused_vars,warn_shadow_vars,warn_unused_import, {erl_opts, [warn_unused_vars,warn_shadow_vars,warn_unused_import,
warn_obsolete_guard,compressed]}. warn_obsolete_guard,compressed]}.
{overrides,[{add,[{extra_src_dirs, [{"etc", [{recursive,true}]}]}]}
]}.
{extra_src_dirs, [{"etc", [{recursive,true}]}]}. {extra_src_dirs, [{"etc", [{recursive,true}]}]}.
{xref_checks,[undefined_function_calls,undefined_functions,locals_not_used, {xref_checks,[undefined_function_calls,undefined_functions,locals_not_used,

View File

@ -6,7 +6,7 @@ do(Dir, CONFIG) ->
ok = compile_and_load_pase_transforms(Dir), ok = compile_and_load_pase_transforms(Dir),
C1 = deps(CONFIG), C1 = deps(CONFIG),
Config = dialyzer(C1), Config = dialyzer(C1),
dump(Config ++ coveralls() ++ config()). dump(Config ++ [{overrides, overrides()}] ++ coveralls() ++ config()).
bcrypt() -> bcrypt() ->
{bcrypt, {git, "https://github.com/emqx/erlang-bcrypt.git", {branch, "0.6.0"}}}. {bcrypt, {git, "https://github.com/emqx/erlang-bcrypt.git", {branch, "0.6.0"}}}.
@ -19,6 +19,14 @@ deps(Config) ->
end, end,
lists:keystore(deps, 1, Config, {deps, OldDpes ++ MoreDeps}). lists:keystore(deps, 1, Config, {deps, OldDpes ++ MoreDeps}).
overrides() ->
[ {add, [ {extra_src_dirs, [{"etc", [{recursive,true}]}]}
, {erl_opts, [ deterministic
, {compile_info, [{emqx_vsn, get_vsn()}]}
]}
]}
].
config() -> config() ->
[ {plugins, plugins()} [ {plugins, plugins()}
, {profiles, profiles()} , {profiles, profiles()}
@ -51,27 +59,41 @@ test_deps() ->
, meck , meck
]. ].
default_compile_opts() -> common_compile_opts() ->
[compressed, deterministic, no_debug_info, warnings_as_errors, {parse_transform, mod_vsn}]. [ deterministic
, {compile_info, [{emqx_vsn, get_vsn()}]}
].
prod_compile_opts() ->
[ compressed
, no_debug_info
, warnings_as_errors
| common_compile_opts()
].
test_compile_opts() ->
[ debug_info
| common_compile_opts()
].
profiles() -> profiles() ->
[ {'emqx', [ {erl_opts, default_compile_opts()} [ {'emqx', [ {erl_opts, prod_compile_opts()}
, {relx, relx('emqx')} , {relx, relx('emqx')}
]} ]}
, {'emqx-pkg', [ {erl_opts, default_compile_opts()} , {'emqx-pkg', [ {erl_opts, prod_compile_opts()}
, {relx, relx('emqx-pkg')} , {relx, relx('emqx-pkg')}
]} ]}
, {'emqx-edge', [ {erl_opts, default_compile_opts()} , {'emqx-edge', [ {erl_opts, prod_compile_opts()}
, {relx, relx('emqx-edge')} , {relx, relx('emqx-edge')}
]} ]}
, {'emqx-edge-pkg', [ {erl_opts, default_compile_opts()} , {'emqx-edge-pkg', [ {erl_opts, prod_compile_opts()}
, {relx, relx('emqx-edge-pkg')} , {relx, relx('emqx-edge-pkg')}
]} ]}
, {check, [ {erl_opts, [debug_info, warnings_as_errors, {parse_transform, mod_vsn}]} , {check, [ {erl_opts, test_compile_opts()}
]} ]}
, {test, [ {deps, test_deps()} , {test, [ {deps, test_deps()}
, {plugins, test_plugins()} , {plugins, test_plugins()}
, {erl_opts, [debug_info, {parse_transform, mod_vsn}] ++ erl_opts_i()} , {erl_opts, test_compile_opts() ++ erl_opts_i()}
, {extra_src_dirs, [{"test", [{recursive,true}]}]} , {extra_src_dirs, [{"test", [{recursive,true}]}]}
]} ]}
]. ].