浏览代码

set app_info:vsn from the app details during application discovery

validate_app in rebar_otp_app does not need to set the vsn and
original_vsn because they are set from the app details during
discovery.

The original_vsn was set here before becuase when there is no
.app.src or .app.src.script the app file does not go through
preprocess/3 and preprocess/3 is where vsn is set based on evaluating
the vsn from .app.src. But if neither of these files exist it
means the discovery vsn was the correct version and there is
no need to update.
pull/2303/head
Tristan Sloughter 5 年前
父节点
当前提交
80671df57a
找不到此签名对应的密钥 GPG 密钥 ID: AAB97DDECCEB8150
共有 2 个文件被更改,包括 5 次插入5 次删除
  1. +3
    -2
      src/rebar_app_discover.erl
  2. +2
    -3
      src/rebar_otp_app.erl

+ 3
- 2
src/rebar_app_discover.erl 查看文件

@ -364,8 +364,9 @@ create_app_info(AppInfo, AppDir, AppFile) ->
Applications = proplists:get_value(applications, AppDetails, []), Applications = proplists:get_value(applications, AppDetails, []),
IncludedApplications = proplists:get_value(included_applications, AppDetails, []), IncludedApplications = proplists:get_value(included_applications, AppDetails, []),
AppInfo1 = rebar_app_info:name( AppInfo1 = rebar_app_info:name(
rebar_app_info:original_vsn(
rebar_app_info:dir(AppInfo, AppDir), AppVsn), AppName),
rebar_app_info:vsn(
rebar_app_info:original_vsn(
rebar_app_info:dir(AppInfo, AppDir), AppVsn), AppVsn), AppName),
AppInfo2 = rebar_app_info:applications( AppInfo2 = rebar_app_info:applications(
rebar_app_info:app_details(AppInfo1, AppDetails), Applications), rebar_app_info:app_details(AppInfo1, AppDetails), Applications),
AppInfo3 = rebar_app_info:included_applications(AppInfo2, IncludedApplications), AppInfo3 = rebar_app_info:included_applications(AppInfo2, IncludedApplications),

+ 2
- 3
src/rebar_otp_app.erl 查看文件

@ -85,17 +85,16 @@ validate_app_modules(State, App, AppData) ->
%% In general, the list of modules is an important thing to validate %% In general, the list of modules is an important thing to validate
%% for compliance with OTP guidelines and upgrade procedures. %% for compliance with OTP guidelines and upgrade procedures.
%% However, some people prefer not to validate this list. %% However, some people prefer not to validate this list.
AppVsn = proplists:get_value(vsn, AppData),
case rebar_state:get(State, validate_app_modules, true) of case rebar_state:get(State, validate_app_modules, true) of
true -> true ->
case rebar_app_utils:validate_application_info(App, AppData) of case rebar_app_utils:validate_application_info(App, AppData) of
true -> true ->
{ok, rebar_app_info:original_vsn(rebar_app_info:vsn(App, AppVsn), AppVsn)};
{ok, App};
Error -> Error ->
Error Error
end; end;
false -> false ->
{ok, rebar_app_info:original_vsn(rebar_app_info:vsn(App, AppVsn), AppVsn)}
{ok, App}
end. end.
preprocess(State, AppInfo, AppSrcFile) -> preprocess(State, AppInfo, AppSrcFile) ->

正在加载...
取消
保存