Browse Source

fix find_apps when searching for invalid apps

pull/115/head
Tristan Sloughter 10 years ago
parent
commit
1e71b47817
3 changed files with 11 additions and 10 deletions
  1. +5
    -5
      src/rebar_app_discover.erl
  2. +4
    -4
      src/rebar_app_info.erl
  3. +2
    -1
      test/rebar_hooks_SUITE.erl

+ 5
- 5
src/rebar_app_discover.erl View File

@ -88,15 +88,15 @@ find_app(AppDir, Validate) ->
case validate_application_info(AppInfo2) of case validate_application_info(AppInfo2) of
true -> true ->
{true, AppInfo2}; {true, AppInfo2};
false ->
_ ->
false false
end; end;
invalid -> invalid ->
case validate_application_info(AppInfo2) of case validate_application_info(AppInfo2) of
false ->
{true, AppInfo2};
true -> true ->
false
false;
_ ->
{true, AppInfo2}
end; end;
all -> all ->
{true, AppInfo2} {true, AppInfo2}
@ -177,7 +177,7 @@ has_all_beams(EbinDir, [Module | ModuleList]) ->
true -> true ->
has_all_beams(EbinDir, ModuleList); has_all_beams(EbinDir, ModuleList);
false -> false ->
throw(?PRV_ERROR({missing_module, Module}))
?PRV_ERROR({missing_module, Module})
end; end;
has_all_beams(_, []) -> has_all_beams(_, []) ->
true. true.

+ 4
- 4
src/rebar_app_info.erl View File

@ -224,10 +224,10 @@ state(#app_info_t{state=State}) ->
-spec valid(t()) -> boolean(). -spec valid(t()) -> boolean().
valid(AppInfo=#app_info_t{valid=undefined}) -> 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 false
end; end;
valid(#app_info_t{valid=Valid}) -> valid(#app_info_t{valid=Valid}) ->

+ 2
- 1
test/rebar_hooks_SUITE.erl View File

@ -34,4 +34,5 @@ build_and_clean_app(Config) ->
Vsn = rebar_test_utils:create_random_vsn(), Vsn = rebar_test_utils:create_random_vsn(),
rebar_test_utils:create_app(AppDir, Name, Vsn, [kernel, stdlib]), 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, [], ["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}]}).

Loading…
Cancel
Save