diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2015-09-02 22:28:18 -0700 |
---|---|---|
committer | Fred Hebert <mononcqc@ferd.ca> | 2015-09-02 22:28:18 -0700 |
commit | 4f90c4f27c00ed52a9f176b641b820238f82fb69 (patch) | |
tree | dcfd226d8ad4588e26ab0c37dcf545cb8455a1d5 | |
parent | 3ed65f91801eb5f049a89745cd9859eaee1ef907 (diff) | |
parent | 3f83b3a38291ed056d66b68d294d5cfd39d9e95f (diff) |
Merge pull request #773 from rebar/revert-771-delay_pkg_load
Revert "only load packages when needed"
-rw-r--r-- | src/rebar3.erl | 2 | ||||
-rw-r--r-- | src/rebar_packages.erl | 9 | ||||
-rw-r--r-- | src/rebar_prv_packages.erl | 1 | ||||
-rw-r--r-- | test/mock_pkg_resource.erl | 2 |
4 files changed, 7 insertions, 7 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}. diff --git a/test/mock_pkg_resource.erl b/test/mock_pkg_resource.erl index a94fe2f..4ed8d8e 100644 --- a/test/mock_pkg_resource.erl +++ b/test/mock_pkg_resource.erl @@ -117,7 +117,7 @@ mock_pkg_index(Opts) -> meck:new(rebar_packages, [passthrough, no_link]), meck:expect(rebar_packages, packages, fun(_State) -> to_index(Deps, Dict) end), - meck:expect(rebar_packages, verify_table, + meck:expect(rebar_packages, load_and_verify_version, fun(_State) -> to_index(Deps, Dict), true end). %%%%%%%%%%%%%%% |