From be79d410935d790d921e074fcf7d6f1ec67cab55 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Fri, 22 May 2015 12:11:22 -0500 Subject: have .app.src take precedence over .app file --- src/rebar_app_info.erl | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/rebar_app_info.erl b/src/rebar_app_info.erl index 382ea7a..1b87e0b 100644 --- a/src/rebar_app_info.erl +++ b/src/rebar_app_info.erl @@ -41,6 +41,8 @@ valid/1, valid/2]). +-include("rebar.hrl"). + -export_type([t/0]). -record(app_info_t, {name :: binary(), @@ -161,13 +163,19 @@ app_file(AppInfo=#app_info_t{}, AppFile) -> -spec app_details(t()) -> list(). app_details(AppInfo=#app_info_t{app_details=[]}) -> - AppFile = case app_file(AppInfo) of - undefined -> - app_file_src(AppInfo); - File -> - File - end, - rebar_file_utils:try_consult(AppFile); + case app_file(AppInfo) of + undefined -> + rebar_file_utils:try_consult(app_file_src(AppInfo)); + AppFile -> + try + rebar_file_utils:try_consult(AppFile) + catch + throw:{error, {Module, Reason}} -> + ?DEBUG("Warning, falling back to .app.src because of: ~s", + [Module:format_error(Reason)]), + rebar_file_utils:try_consult(app_file_src(AppInfo)) + end + end; app_details(#app_info_t{app_details=AppDetails}) -> AppDetails. -- cgit v1.1