summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2015-09-02 21:35:13 -0700
committerFred Hebert <mononcqc@ferd.ca>2015-09-02 21:35:13 -0700
commit3f83b3a38291ed056d66b68d294d5cfd39d9e95f (patch)
treedcfd226d8ad4588e26ab0c37dcf545cb8455a1d5 /src
parent3ed65f91801eb5f049a89745cd9859eaee1ef907 (diff)
Revert "only load packages when needed"
Diffstat (limited to 'src')
-rw-r--r--src/rebar3.erl2
-rw-r--r--src/rebar_packages.erl9
-rw-r--r--src/rebar_prv_packages.erl1
3 files changed, 6 insertions, 6 deletions
diff --git a/src/rebar3.erl b/src/rebar3.erl
index 52b4094..ab3e0eb 100644
--- a/src/rebar3.erl
+++ b/src/rebar3.erl
@@ -105,6 +105,7 @@ run_aux(State, RawArgs) ->
{ok, Providers} = application:get_env(rebar, providers),
%% Providers can modify profiles stored in opts, so set default after initializing providers
State4 = rebar_state:create_logic_providers(Providers, State3),
+ rebar_packages:packages(State4),
State5 = rebar_plugins:project_apps_install(State4),
State6 = rebar_state:default(State5, rebar_state:opts(State5)),
@@ -284,6 +285,7 @@ state_from_global_config(Config, GlobalConfigFile) ->
[] ->
GlobalConfigThrowAway;
GlobalPluginsToInstall ->
+ rebar_packages:packages(GlobalConfigThrowAway),
rebar_plugins:handle_plugins(global,
GlobalPluginsToInstall,
GlobalConfigThrowAway)
diff --git a/src/rebar_packages.erl b/src/rebar_packages.erl
index dc111de..e3346ae 100644
--- a/src/rebar_packages.erl
+++ b/src/rebar_packages.erl
@@ -8,7 +8,6 @@
,package_dir/1
,registry_checksum/2
,find_highest_matching/4
- ,verify_table/1
,format_error/1]).
-export_type([package/0]).
@@ -52,7 +51,7 @@ load_and_verify_version(State) ->
deps(Name, Vsn, State) ->
try
- ?MODULE:verify_table(State),
+ verify_table(State),
ets:lookup_element(?PACKAGE_TABLE, {ec_cnv:to_binary(Name), ec_cnv:to_binary(Vsn)}, 2)
catch
_:_ ->
@@ -83,7 +82,7 @@ package_dir(State) ->
registry_checksum({pkg, Name, Vsn}, State) ->
try
- ?MODULE:verify_table(State),
+ verify_table(State),
ets:lookup_element(?PACKAGE_TABLE, {Name, Vsn}, 3)
catch
_:_ ->
@@ -106,7 +105,7 @@ registry_checksum({pkg, Name, Vsn}, State) ->
%% `~> 2.0` | `>= 2.0.0 and < 3.0.0`
%% `~> 2.1` | `>= 2.1.0 and < 3.0.0`
find_highest_matching(Dep, Constraint, Table, State) ->
- ?MODULE:verify_table(State),
+ verify_table(State),
try ets:lookup_element(Table, Dep, 2) of
[[HeadVsn | VsnTail]] ->
{ok, handle_vsns(Constraint, HeadVsn, VsnTail)};
@@ -146,4 +145,4 @@ format_error({missing_package, Package, Version}) ->
io_lib:format("Package not found in registry: ~s-~s. Try to fix with `rebar3 update`", [Package, Version]).
verify_table(State) ->
- ets:info(?PACKAGE_TABLE, named_table) =:= true orelse load_and_verify_version(State).
+ ets:info(?PACKAGE_TABLE, named_table) =:= true orelse ?MODULE:load_and_verify_version(State).
diff --git a/src/rebar_prv_packages.erl b/src/rebar_prv_packages.erl
index 998320c..5b8ea66 100644
--- a/src/rebar_prv_packages.erl
+++ b/src/rebar_prv_packages.erl
@@ -27,7 +27,6 @@ init(State) ->
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
do(State) ->
- rebar_packages:packages(State),
print_packages(),
{ok, State}.