diff options
author | Tristan Sloughter <t@crashfast.com> | 2015-09-01 19:42:01 -0500 |
---|---|---|
committer | Tristan Sloughter <t@crashfast.com> | 2015-09-01 19:42:01 -0500 |
commit | a81444ae1c32fb1ff73bd571327fd6adeec9901f (patch) | |
tree | 9f43468f9d42b8e0593a685834ad045692ba1c70 | |
parent | d034f40c38753860c2da894f1966af5399f3efce (diff) |
move otp version verification to a single app_info function
-rw-r--r-- | src/rebar_app_discover.erl | 4 | ||||
-rw-r--r-- | src/rebar_app_info.erl | 5 | ||||
-rw-r--r-- | src/rebar_prv_install_deps.erl | 4 |
3 files changed, 9 insertions, 4 deletions
diff --git a/src/rebar_app_discover.erl b/src/rebar_app_discover.erl index e702786..9d7c62a 100644 --- a/src/rebar_app_discover.erl +++ b/src/rebar_app_discover.erl @@ -84,8 +84,8 @@ merge_deps(AppInfo, State) -> AppInfo1 = rebar_app_info:apply_overrides(rebar_state:get(State, overrides, []), AppInfo0), AppInfo2 = rebar_app_info:apply_profiles(AppInfo1, CurrentProfiles), - rebar_utils:check_min_otp_version(rebar_app_info:get(AppInfo2, minimum_otp_vsn, undefined)), - rebar_utils:check_blacklisted_otp_versions(rebar_app_info:get(AppInfo2, blacklisted_otp_vsns, [])), + %% Will throw an exception if checks fail + rebar_app_info:verify_otp_vsn(AppInfo2), State1 = lists:foldl(fun(Profile, StateAcc) -> handle_profile(Profile, Name, AppInfo2, StateAcc) diff --git a/src/rebar_app_info.erl b/src/rebar_app_info.erl index 268b09d..92706f3 100644 --- a/src/rebar_app_info.erl +++ b/src/rebar_app_info.erl @@ -53,6 +53,7 @@ valid/1, valid/2, + verify_otp_vsn/1, has_all_artifacts/1, apply_overrides/2, @@ -404,6 +405,10 @@ valid(#app_info_t{valid=Valid}) -> valid(AppInfo=#app_info_t{}, Valid) -> AppInfo#app_info_t{valid=Valid}. +verify_otp_vsn(AppInfo) -> + rebar_utils:check_min_otp_version(rebar_app_info:get(AppInfo, minimum_otp_vsn, undefined)), + rebar_utils:check_blacklisted_otp_versions(rebar_app_info:get(AppInfo, blacklisted_otp_vsns, [])). + -spec has_all_artifacts(#app_info_t{}) -> true | {false, file:filename()}. has_all_artifacts(AppInfo) -> Artifacts = rebar_app_info:get(AppInfo, artifacts, []), diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl index cb1bf00..fd1aa49 100644 --- a/src/rebar_prv_install_deps.erl +++ b/src/rebar_prv_install_deps.erl @@ -262,8 +262,8 @@ handle_dep(State, Profile, DepsDir, AppInfo, Locks, Level) -> Plugins = rebar_app_info:get(AppInfo2, plugins, []), AppInfo3 = rebar_app_info:set(AppInfo2, {plugins, Profile}, Plugins), - rebar_utils:check_min_otp_version(rebar_app_info:get(AppInfo3, minimum_otp_vsn, undefined)), - rebar_utils:check_blacklisted_otp_versions(rebar_app_info:get(AppInfo3, blacklisted_otp_vsns, [])), + %% Will throw an exception if checks fail + rebar_app_info:verify_otp_vsn(AppInfo3), %% Dep may have plugins to install. Find and install here. State1 = rebar_plugins:install(State, AppInfo3), |