Browse Source

Merge pull request #371 from tsloughter/fetch_app_details

read in application details into app_info after fetch
pull/373/head
Tristan Sloughter 10 years ago
parent
commit
521fc144ae
2 changed files with 23 additions and 1 deletions
  1. +13
    -0
      src/rebar_app_info.erl
  2. +10
    -1
      src/rebar_prv_install_deps.erl

+ 13
- 0
src/rebar_app_info.erl View File

@ -157,6 +157,19 @@ app_file(AppInfo=#app_info_t{}, AppFile) ->
AppInfo#app_info_t{app_file=AppFile}. AppInfo#app_info_t{app_file=AppFile}.
-spec app_details(t()) -> list(). -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,
case file:consult(AppFile) of
{ok, [{application, _, AppDetails}]} ->
AppDetails;
_ ->
[]
end;
app_details(#app_info_t{app_details=AppDetails}) -> app_details(#app_info_t{app_details=AppDetails}) ->
AppDetails. AppDetails.

+ 10
- 1
src/rebar_prv_install_deps.erl View File

@ -386,7 +386,7 @@ maybe_fetch(AppInfo, Profile, Upgrade, Seen, State) ->
case fetch_app(AppInfo, AppDir, State) of case fetch_app(AppInfo, AppDir, State) of
true -> true ->
maybe_symlink_default(State, Profile, AppDir, AppInfo), maybe_symlink_default(State, Profile, AppDir, AppInfo),
{true, AppInfo};
{true, update_app_info(AppInfo)};
Other -> Other ->
{Other, AppInfo} {Other, AppInfo}
end; end;
@ -553,6 +553,15 @@ fetch_app(AppInfo, AppDir, State) ->
Result Result
end. end.
update_app_info(AppInfo) ->
AppDetails = rebar_app_info:app_details(AppInfo),
Applications = proplists:get_value(applications, AppDetails, []),
IncludedApplications = proplists:get_value(included_applications, AppDetails, []),
AppInfo1 = rebar_app_info:applications(
rebar_app_info:app_details(AppInfo, AppDetails),
IncludedApplications++Applications),
rebar_app_info:valid(AppInfo1, false).
maybe_upgrade(AppInfo, AppDir, false, State) -> maybe_upgrade(AppInfo, AppDir, false, State) ->
Source = rebar_app_info:source(AppInfo), Source = rebar_app_info:source(AppInfo),
rebar_fetch:needs_update(AppDir, Source, State); rebar_fetch:needs_update(AppDir, Source, State);

Loading…
Cancel
Save