From 1e71b4781774d9f12e240a2af6ddb8f166b8eee3 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Mon, 2 Feb 2015 18:20:23 -0600 Subject: fix find_apps when searching for invalid apps --- src/rebar_app_discover.erl | 10 +++++----- src/rebar_app_info.erl | 8 ++++---- test/rebar_hooks_SUITE.erl | 3 ++- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/rebar_app_discover.erl b/src/rebar_app_discover.erl index 4d89c0d..21dbe1b 100644 --- a/src/rebar_app_discover.erl +++ b/src/rebar_app_discover.erl @@ -88,15 +88,15 @@ find_app(AppDir, Validate) -> case validate_application_info(AppInfo2) of true -> {true, AppInfo2}; - false -> + _ -> false end; invalid -> case validate_application_info(AppInfo2) of - false -> - {true, AppInfo2}; true -> - false + false; + _ -> + {true, AppInfo2} end; all -> {true, AppInfo2} @@ -177,7 +177,7 @@ has_all_beams(EbinDir, [Module | ModuleList]) -> true -> has_all_beams(EbinDir, ModuleList); false -> - throw(?PRV_ERROR({missing_module, Module})) + ?PRV_ERROR({missing_module, Module}) end; has_all_beams(_, []) -> true. diff --git a/src/rebar_app_info.erl b/src/rebar_app_info.erl index 23d118f..dca5aa8 100644 --- a/src/rebar_app_info.erl +++ b/src/rebar_app_info.erl @@ -224,10 +224,10 @@ state(#app_info_t{state=State}) -> -spec valid(t()) -> boolean(). valid(AppInfo=#app_info_t{valid=undefined}) -> - try - rebar_app_discover:validate_application_info(AppInfo) - catch - _:_ -> + case rebar_app_discover:validate_application_info(AppInfo) of + true -> + true; + _ -> false end; valid(#app_info_t{valid=Valid}) -> diff --git a/test/rebar_hooks_SUITE.erl b/test/rebar_hooks_SUITE.erl index 6a00320..642798f 100644 --- a/test/rebar_hooks_SUITE.erl +++ b/test/rebar_hooks_SUITE.erl @@ -34,4 +34,5 @@ build_and_clean_app(Config) -> Vsn = rebar_test_utils:create_random_vsn(), rebar_test_utils:create_app(AppDir, Name, Vsn, [kernel, stdlib]), rebar_test_utils:run_and_check(Config, [], ["compile"], {ok, [{app, Name, valid}]}), - rebar_test_utils:run_and_check(Config, [{provider_hooks, [{post, [{compile, clean}]}]}], ["compile"], {ok, [{app, Name, invalid}]}). + rebar_test_utils:run_and_check(Config, [{provider_hooks, [{post, [{compile, clean}]}]}], + ["compile"], {ok, [{app, Name, invalid}]}). -- cgit v1.1