summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rebar.config2
-rw-r--r--rebar.lock4
-rw-r--r--src/rebar_opts.erl40
-rw-r--r--src/rebar_prv_compile.erl13
-rw-r--r--src/rebar_prv_install_deps.erl9
-rw-r--r--test/rebar_compile_SUITE.erl19
-rw-r--r--test/rebar_profiles_SUITE.erl26
7 files changed, 100 insertions, 13 deletions
diff --git a/rebar.config b/rebar.config
index 02ef550..680e6f2 100644
--- a/rebar.config
+++ b/rebar.config
@@ -7,7 +7,7 @@
{providers, "1.7.0"},
{getopt, "1.0.1"},
{bbmustache, "1.3.0"},
- {relx, "3.24.2"},
+ {relx, "3.24.3"},
{cf, "0.2.2"},
{cth_readable, "1.3.2"},
{eunit_formatters, "0.5.0"}]}.
diff --git a/rebar.lock b/rebar.lock
index 0ed5e5a..85df571 100644
--- a/rebar.lock
+++ b/rebar.lock
@@ -7,7 +7,7 @@
{<<"eunit_formatters">>,{pkg,<<"eunit_formatters">>,<<"0.5.0">>},0},
{<<"getopt">>,{pkg,<<"getopt">>,<<"1.0.1">>},0},
{<<"providers">>,{pkg,<<"providers">>,<<"1.7.0">>},0},
- {<<"relx">>,{pkg,<<"relx">>,<<"3.24.2">>},0},
+ {<<"relx">>,{pkg,<<"relx">>,<<"3.24.3">>},0},
{<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.3">>},0}]}.
[
{pkg_hash,[
@@ -19,6 +19,6 @@
{<<"eunit_formatters">>, <<"6A9133943D36A465D804C1C5B6E6839030434B8879C5600D7DDB5B3BAD4CCB59">>},
{<<"getopt">>, <<"C73A9FA687B217F2FF79F68A3B637711BB1936E712B521D8CE466B29CBF7808A">>},
{<<"providers">>, <<"BBF730563914328EC2511D205E6477A94831DB7297DE313B3872A2B26C562EAB">>},
- {<<"relx">>, <<"4BC77F30385A208BF7A4B1D0E5CB9098D1FD6794CDE8E3014B7D1BAFCF0AF47F">>},
+ {<<"relx">>, <<"A7ADA05319D52791FC63BAC8027F464156B52A0453BA5DD09A9386BABF06AF26">>},
{<<"ssl_verify_fun">>, <<"6C49665D4326E26CD4A5B7BD54AA442B33DADFB7C5D59A0D0CD0BF5534BBFBD7">>}]}
].
diff --git a/src/rebar_opts.erl b/src/rebar_opts.erl
index b7156b2..1a927ba 100644
--- a/src/rebar_opts.erl
+++ b/src/rebar_opts.erl
@@ -35,12 +35,40 @@ erl_opts(Opts) ->
Defines = [{d, list_to_atom(D)} ||
D <- ?MODULE:get(Opts, defines, [])],
AllOpts = Defines ++ RawErlOpts,
- case proplists:is_defined(no_debug_info, AllOpts) of
- true ->
- [O || O <- AllOpts, O =/= no_debug_info];
- false ->
- [debug_info|AllOpts]
- end.
+ lists:reverse(filter_debug_info(lists:reverse(AllOpts))).
+
+filter_debug_info([]) ->
+ %% Default == ON
+ [debug_info];
+filter_debug_info([debug_info|_] = L) ->
+ %% drop no_debug_info and {debug_info_key, _} since those would
+ %% conflict with a plain debug_info
+ [debug_info |
+ lists:filter(fun(K) ->
+ K =/= no_debug_info andalso K =/= debug_info andalso
+ not (is_tuple(K) andalso element(1,K) =:= debug_info_key)
+ end, L)];
+filter_debug_info([{debug_info, _} = H | T]) ->
+ %% custom debug_info field; keep and filter the rest except
+ %% without no_debug_info. Still have to filter for regular or crypto
+ %% debug_info.
+ [H | filter_debug_info(lists:filter(fun(K) -> K =/= no_debug_info end, T))];
+filter_debug_info([{debug_info_key, _}=H | T]) ->
+ %% Drop no_debug_info and regular debug_info
+ [H | lists:filter(fun(K) ->
+ K =/= no_debug_info andalso K =/= debug_info andalso
+ not (is_tuple(K) andalso element(1,K) =:= debug_info_key)
+ end, T)];
+filter_debug_info([no_debug_info|T]) ->
+ %% Drop all debug info
+ lists:filter(fun(debug_info) -> false
+ ; ({debug_info, _}) -> false
+ ; ({debug_info_key, _}) -> false
+ ; (no_debug_info) -> false
+ ; (_Other) -> true
+ end, T);
+filter_debug_info([H|T]) ->
+ [H|filter_debug_info(T)].
apply_overrides(Opts, Name, Overrides) ->
%% Inefficient. We want the order we get here though.
diff --git a/src/rebar_prv_compile.erl b/src/rebar_prv_compile.erl
index c9a77a5..72320fb 100644
--- a/src/rebar_prv_compile.erl
+++ b/src/rebar_prv_compile.erl
@@ -136,7 +136,18 @@ compile(State, Providers, AppInfo) ->
AppInfo3 = rebar_hooks:run_all_hooks(AppDir, post, ?ERLC_HOOK, Providers, AppInfo2, State),
AppInfo4 = rebar_hooks:run_all_hooks(AppDir, pre, ?APP_HOOK, Providers, AppInfo3, State),
- case rebar_otp_app:compile(State, AppInfo4) of
+
+ %% Load plugins back for make_vsn calls in custom resources.
+ %% The rebar_otp_app compilation step is safe regarding the
+ %% overall path management, so we can just load all plugins back
+ %% in memory.
+ PluginDepsPaths = rebar_state:code_paths(State, all_plugin_deps),
+ code:add_pathsa(PluginDepsPaths),
+ AppFileCompileResult = rebar_otp_app:compile(State, AppInfo4),
+ %% Clean up after ourselves, leave things as they were.
+ rebar_utils:remove_from_code_path(PluginDepsPaths),
+
+ case AppFileCompileResult of
{ok, AppInfo5} ->
AppInfo6 = rebar_hooks:run_all_hooks(AppDir, post, ?APP_HOOK, Providers, AppInfo5, State),
AppInfo7 = rebar_hooks:run_all_hooks(AppDir, post, ?PROVIDER, Providers, AppInfo6, State),
diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl
index 65aabff..b735ed0 100644
--- a/src/rebar_prv_install_deps.erl
+++ b/src/rebar_prv_install_deps.erl
@@ -419,8 +419,13 @@ warn_skip_deps(AppInfo, State) ->
Args = [rebar_app_info:name(AppInfo),
rebar_app_info:source(AppInfo)],
case rebar_state:get(State, deps_error_on_conflict, false) of
- false -> ?WARN(Msg, Args);
- true -> ?ERROR(Msg, Args), ?FAIL
+ false ->
+ case rebar_state:get(State, deps_warning_on_conflict, true) of
+ true -> ?WARN(Msg, Args);
+ false -> ok
+ end;
+ true ->
+ ?ERROR(Msg, Args), ?FAIL
end.
not_needs_compile(App) ->
diff --git a/test/rebar_compile_SUITE.erl b/test/rebar_compile_SUITE.erl
index 1655336..c5336cf 100644
--- a/test/rebar_compile_SUITE.erl
+++ b/test/rebar_compile_SUITE.erl
@@ -40,6 +40,7 @@
clean_all/1,
override_deps/1,
profile_override_deps/1,
+ profile_deps/1,
deps_build_in_prod/1,
include_file_relative_to_working_directory/1,
include_file_in_src/1,
@@ -76,6 +77,7 @@ all() ->
parse_transform_test, erl_first_files_test, mib_test,
umbrella_mib_first_test, only_default_transitive_deps,
clean_all, override_deps, profile_override_deps, deps_build_in_prod,
+ profile_override_deps, profile_deps, deps_build_in_prod,
include_file_relative_to_working_directory, include_file_in_src,
include_file_relative_to_working_directory_test, include_file_in_src_test,
include_file_in_src_test_multiapp,
@@ -1288,9 +1290,10 @@ override_deps(Config) ->
).
profile_override_deps(Config) ->
- mock_git_resource:mock([{deps, [{some_dep, "0.0.1"},{other_dep, "0.0.1"}]}]),
Deps = rebar_test_utils:expand_deps(git, [{"some_dep", "0.0.1", [{"other_dep", "0.0.1", []}]}]),
TopDeps = rebar_test_utils:top_level_deps(Deps),
+ {SrcDeps, _} = rebar_test_utils:flat_deps(Deps),
+ mock_git_resource:mock([{deps, SrcDeps}]),
RebarConfig = [
{deps, TopDeps},
@@ -1307,6 +1310,20 @@ profile_override_deps(Config) ->
{ok, [{dep, "some_dep"},{dep_not_exist, "other_dep"}]}
).
+profile_deps(Config) ->
+ Deps = rebar_test_utils:expand_deps(git, [{"some_dep", "0.0.1", [{"other_dep", "0.0.1", []}]}]),
+ TopDeps = rebar_test_utils:top_level_deps(Deps),
+ {SrcDeps, _} = rebar_test_utils:flat_deps(Deps),
+ mock_git_resource:mock([{deps, SrcDeps}]),
+
+ RebarConfig = [
+ {deps, TopDeps},
+ {profiles, [{a, []}]}],
+ rebar_test_utils:run_and_check(
+ Config, RebarConfig, ["as", "a", "compile"],
+ {ok, [{dep, "some_dep"},{dep, "other_dep"}]}
+ ).
+
%% verify a deps prod profile is used
%% tested by checking prod hooks run and outputs to default profile dir for dep
%% and prod deps are installed for dep
diff --git a/test/rebar_profiles_SUITE.erl b/test/rebar_profiles_SUITE.erl
index 324a771..6afdc39 100644
--- a/test/rebar_profiles_SUITE.erl
+++ b/test/rebar_profiles_SUITE.erl
@@ -27,6 +27,7 @@
test_profile_erl_opts_order_3/1,
test_profile_erl_opts_order_4/1,
test_profile_erl_opts_order_5/1,
+ test_erl_opts_debug_info/1,
first_files_exception/1]).
-include_lib("common_test/include/ct.hrl").
@@ -50,6 +51,7 @@ all() ->
test_profile_erl_opts_order_3,
test_profile_erl_opts_order_4,
test_profile_erl_opts_order_5,
+ test_erl_opts_debug_info,
first_files_exception].
init_per_suite(Config) ->
@@ -501,6 +503,30 @@ test_profile_erl_opts_order_5(Config) ->
Opt = last_erl_opt(Opts, [warn_export_all, nowarn_export_all], undefined),
warn_export_all = Opt.
+test_erl_opts_debug_info(_Config) ->
+ ToOpts = fun(List) -> rebar_opts:erl_opts(dict:from_list([{erl_opts, List}])) end,
+ ?assertEqual([debug_info,a,b,c],
+ ToOpts([a,b,c])),
+ ?assertEqual([{debug_info,{mod,123}},a,b,c,debug_info],
+ ToOpts([{debug_info,{mod,123}},a,b,c,debug_info])),
+ ?assertEqual([a,b,debug_info,c],
+ ToOpts([no_debug_info,a,b,debug_info,c])),
+ ?assertEqual([a,b,c],
+ ToOpts([debug_info,a,b,no_debug_info,c])),
+ ?assertEqual([a,b,c,debug_info],
+ ToOpts([{debug_info_key, "12345"},a,b,
+ no_debug_info,c,debug_info])),
+ ?assertEqual([a,b,c],
+ ToOpts([{debug_info,{mod,123}},{debug_info_key, "12345"},
+ a,no_debug_info,b,c,debug_info,no_debug_info])),
+ ?assertEqual([a,b,c,{debug_info_key,"123"}],
+ ToOpts([{debug_info_key, "12345"},a,b,no_debug_info,debug_info,
+ c,{debug_info_key, "123"}])),
+ ?assertEqual([{debug_info_key,"12345"},a,b,c,{debug_info,{mod,"123"}}],
+ ToOpts([debug_info,{debug_info_key,"12345"},a,
+ no_debug_info,b,c,{debug_info,{mod,"123"}}])),
+ ok.
+
first_files_exception(_Config) ->
RebarConfig = [{erl_first_files, ["c","a","b"]},
{mib_first_files, ["c","a","b"]},