diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2015-11-23 08:58:15 -0500 |
---|---|---|
committer | Fred Hebert <mononcqc@ferd.ca> | 2015-11-23 08:58:15 -0500 |
commit | c3af4ef89b4d82d12c16a1605fb5dfb78c28b97d (patch) | |
tree | 05dfc8a87b97154acf2cf2bffb72053d5fe4fb45 | |
parent | d2628b69403ac5509a8674452791d6b22bc9884e (diff) | |
parent | d67ea4a51130a47df397264881ed6b8d774195ad (diff) |
Merge pull request #934 from tsloughter/dedup_providers
don't add a provider if the same namespace and name already exists
-rwxr-xr-x | bootstrap | 7 | ||||
-rw-r--r-- | rebar.config | 6 | ||||
-rw-r--r-- | rebar.lock | 6 | ||||
-rw-r--r-- | src/rebar.app.src | 1 | ||||
-rw-r--r-- | src/rebar_state.erl | 19 |
5 files changed, 32 insertions, 7 deletions
@@ -15,6 +15,7 @@ main(_Args) -> %% Fetch and build deps required to build rebar3 BaseDeps = [{providers, []} ,{getopt, []} + ,{cf, []} ,{erlware_commons, ["ec_dictionary.erl", "ec_vsn.erl"]} ,{certifi, []}], Deps = get_deps(), @@ -68,6 +69,12 @@ fetch_and_compile({Name, ErlFirstFiles}, Deps) -> {Name, _, Source} -> ok = fetch(Source, Name) end, + + %% Hack: erlware_commons depends on a .script file to check if it is being built with + %% rebar2 or rebar3. But since rebar3 isn't built yet it can't get the vsn with get_key. + %% So we simply make sure that file is deleted before compiling + file:delete("_build/default/lib/erlware_commons/rebar.config.script"), + compile(Name, ErlFirstFiles). fetch({pkg, Name, Vsn}, App) -> diff --git a/rebar.config b/rebar.config index 7cd2ee7..ce807b8 100644 --- a/rebar.config +++ b/rebar.config @@ -1,13 +1,13 @@ %% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*- %% ex: ts=4 sw=4 ft=erlang et -{deps, [{erlware_commons, "0.16.0"}, +{deps, [{erlware_commons, "0.18.0"}, {ssl_verify_hostname, "1.0.5"}, {certifi, "0.1.1"}, - {providers, "1.5.0"}, + {providers, "1.6.0"}, {getopt, "0.8.2"}, {bbmustache, "1.0.4"}, - {relx, "3.8.0"}, + {relx, "3.9.0"}, {cf, "0.2.1"}, {cth_readable, "1.1.0"}, {eunit_formatters, "0.3.1"}]}. @@ -2,9 +2,9 @@ {<<"certifi">>,{pkg,<<"certifi">>,<<"0.1.1">>},0}, {<<"cf">>,{pkg,<<"cf">>,<<"0.2.1">>},0}, {<<"cth_readable">>,{pkg,<<"cth_readable">>,<<"1.1.0">>},0}, - {<<"erlware_commons">>,{pkg,<<"erlware_commons">>,<<"0.16.0">>},0}, + {<<"erlware_commons">>,{pkg,<<"erlware_commons">>,<<"0.18.0">>},0}, {<<"eunit_formatters">>,{pkg,<<"eunit_formatters">>,<<"0.3.1">>},0}, {<<"getopt">>,{pkg,<<"getopt">>,<<"0.8.2">>},0}, - {<<"providers">>,{pkg,<<"providers">>,<<"1.5.0">>},0}, - {<<"relx">>,{pkg,<<"relx">>,<<"3.8.0">>},0}, + {<<"providers">>,{pkg,<<"providers">>,<<"1.6.0">>},0}, + {<<"relx">>,{pkg,<<"relx">>,<<"3.9.0">>},0}, {<<"ssl_verify_hostname">>,{pkg,<<"ssl_verify_hostname">>,<<"1.0.5">>},0}]. 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 |