diff options
Diffstat (limited to 'src/rebar_app_info.erl')
-rw-r--r-- | src/rebar_app_info.erl | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/rebar_app_info.erl b/src/rebar_app_info.erl index bb99584..bb5104e 100644 --- a/src/rebar_app_info.erl +++ b/src/rebar_app_info.erl @@ -4,6 +4,7 @@ new/2, new/3, new/4, + new/5, discover/1, name/1, name/2, @@ -58,7 +59,7 @@ app_file :: file:filename_all() | undefined, config :: rebar_state:t() | undefined, original_vsn :: binary() | string() | undefined, - parent :: binary() | root, + parent=root :: binary() | root, app_details=[] :: list(), applications=[] :: list(), deps=[] :: list(), @@ -113,6 +114,17 @@ new(AppName, Vsn, Dir, Deps) -> out_dir=ec_cnv:to_list(Dir), deps=Deps}}. +%% @doc build a complete version of the app info with all fields set. +-spec new(atom() | binary(), atom() | binary() | string(), binary() | string(), file:name(), list()) -> + {ok, t()}. +new(Parent, AppName, Vsn, Dir, Deps) -> + {ok, #app_info_t{name=ec_cnv:to_binary(AppName), + parent=Parent, + original_vsn=Vsn, + dir=ec_cnv:to_list(Dir), + out_dir=ec_cnv:to_list(Dir), + deps=Deps}}. + %% @doc discover a complete version of the app info with all fields set. -spec discover(file:filename_all()) -> {ok, t()} | not_found. discover(Dir) -> @@ -305,7 +317,7 @@ state(#app_info_t{state=State}) -> state_or_new(State, AppInfo=#app_info_t{state=undefined}) -> AppDir = dir(AppInfo), C = rebar_config:consult(AppDir), - rebar_state:new(State, C, AppDir); + rebar_state:new(State, C, AppInfo); state_or_new(_State, #app_info_t{state=State}) -> State. |