summaryrefslogtreecommitdiff
path: root/src/rebar_app_info.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rebar_app_info.erl')
-rw-r--r--src/rebar_app_info.erl9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/rebar_app_info.erl b/src/rebar_app_info.erl
index 1b87e0b..9db20e7 100644
--- a/src/rebar_app_info.erl
+++ b/src/rebar_app_info.erl
@@ -34,6 +34,7 @@
source/2,
state/1,
state/2,
+ state_or_new/2,
is_lock/1,
is_lock/2,
is_checkout/1,
@@ -260,6 +261,14 @@ state(AppInfo=#app_info_t{}, State) ->
state(#app_info_t{state=State}) ->
State.
+-spec state_or_new(rebar_state:t(), t()) -> rebar_state:t().
+state_or_new(State, AppInfo=#app_info_t{state=undefined}) ->
+ AppDir = dir(AppInfo),
+ C = rebar_config:consult(AppDir),
+ rebar_state:new(State, C, AppDir);
+state_or_new(_State, #app_info_t{state=State}) ->
+ State.
+
-spec is_lock(t(), boolean()) -> t().
is_lock(AppInfo=#app_info_t{}, IsLock) ->
AppInfo#app_info_t{is_lock=IsLock}.