diff options
author | Tristan Sloughter <t@crashfast.com> | 2015-11-22 09:10:10 -0600 |
---|---|---|
committer | Tristan Sloughter <t@crashfast.com> | 2015-11-23 07:44:24 -0600 |
commit | 740d8a3c74c26fc91370fd83cd81807d0d29e7b0 (patch) | |
tree | 1db506e4633f01246146ae7fc502749d3fbf08eb /src | |
parent | d2628b69403ac5509a8674452791d6b22bc9884e (diff) |
if a provider of the same namespace and name already exists, skip adding new provider
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar.app.src | 1 | ||||
-rw-r--r-- | src/rebar_state.erl | 19 |
2 files changed, 19 insertions, 1 deletions
diff --git a/src/rebar.app.src b/src/rebar.app.src index 67973eb..58fee02 100644 --- a/src/rebar.app.src +++ b/src/rebar.app.src @@ -27,6 +27,7 @@ certifi, cth_readable, relx, + cf, inets, eunit_formatters]}, {env, [ diff --git a/src/rebar_state.erl b/src/rebar_state.erl index 176a80b..0c07b2a 100644 --- a/src/rebar_state.erl +++ b/src/rebar_state.erl @@ -370,7 +370,24 @@ providers(State, NewProviders) -> -spec add_provider(t(), providers:t()) -> t(). add_provider(State=#state_t{providers=Providers}, Provider) -> - State#state_t{providers=[Provider | Providers]}. + Name = providers:impl(Provider), + Namespace = providers:namespace(Provider), + Module = providers:module(Provider), + case lists:any(fun(P) -> + case {providers:impl(P), providers:namespace(P)} of + {Name, Namespace} -> + ?DEBUG("Not adding provider ~p ~p from module ~p because it already exists from module ~p", + [Namespace, Name, providers:module(P), Module]), + true; + _ -> + false + end + end, Providers) of + true -> + State; + false -> + State#state_t{providers=[Provider | Providers]} + end. create_logic_providers(ProviderModules, State0) -> try |