summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2015-09-02 22:32:34 -0700
committerFred Hebert <mononcqc@ferd.ca>2015-09-02 22:32:34 -0700
commitc57177fde8f0891462aa91cf161f1372a3dd5813 (patch)
tree702e77d59ecd6cb01eab02c5dc4599262985d6ea /src
parent4f90c4f27c00ed52a9f176b641b820238f82fb69 (diff)
Revert "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 ab3e0eb..52b4094 100644
--- a/src/rebar3.erl
+++ b/src/rebar3.erl
@@ -105,7 +105,6 @@ 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)),
@@ -285,7 +284,6 @@ 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 e3346ae..dc111de 100644
--- a/src/rebar_packages.erl
+++ b/src/rebar_packages.erl
@@ -8,6 +8,7 @@
,package_dir/1
,registry_checksum/2
,find_highest_matching/4
+ ,verify_table/1
,format_error/1]).
-export_type([package/0]).
@@ -51,7 +52,7 @@ load_and_verify_version(State) ->
deps(Name, Vsn, State) ->
try
- verify_table(State),
+ ?MODULE:verify_table(State),
ets:lookup_element(?PACKAGE_TABLE, {ec_cnv:to_binary(Name), ec_cnv:to_binary(Vsn)}, 2)
catch
_:_ ->
@@ -82,7 +83,7 @@ package_dir(State) ->
registry_checksum({pkg, Name, Vsn}, State) ->
try
- verify_table(State),
+ ?MODULE:verify_table(State),
ets:lookup_element(?PACKAGE_TABLE, {Name, Vsn}, 3)
catch
_:_ ->
@@ -105,7 +106,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) ->
- verify_table(State),
+ ?MODULE:verify_table(State),
try ets:lookup_element(Table, Dep, 2) of
[[HeadVsn | VsnTail]] ->
{ok, handle_vsns(Constraint, HeadVsn, VsnTail)};
@@ -145,4 +146,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 ?MODULE:load_and_verify_version(State).
+ ets:info(?PACKAGE_TABLE, named_table) =:= true orelse load_and_verify_version(State).
diff --git a/src/rebar_prv_packages.erl b/src/rebar_prv_packages.erl
index 5b8ea66..998320c 100644
--- a/src/rebar_prv_packages.erl
+++ b/src/rebar_prv_packages.erl
@@ -27,6 +27,7 @@ init(State) ->
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
do(State) ->
+ rebar_packages:packages(State),
print_packages(),
{ok, State}.