summaryrefslogtreecommitdiff
path: root/src/rebar_app_info.erl
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2015-08-27 07:29:08 +1200
committerFred Hebert <mononcqc@ferd.ca>2015-08-27 07:29:08 +1200
commitbb14f2425763857e40aba9d8ce8299e5cc96a9a2 (patch)
tree4483b595fa49e92829f7b25994e22382040af146 /src/rebar_app_info.erl
parent79d66de59c7a1673ce7374d45f5853a9f4aa3d91 (diff)
parenta27fd22c3fe1f71091dce27be3c71dc5b75ae2f0 (diff)
Merge pull request #748 from tsloughter/pkg_attribute
support pkg attribute on dep to declare package name different from app name
Diffstat (limited to 'src/rebar_app_info.erl')
-rw-r--r--src/rebar_app_info.erl16
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.