|
6 | 6 | new/3, |
7 | 7 | new/4, |
8 | 8 | new/5, |
| 9 | + app_to_map/1, |
9 | 10 | update_opts/3, |
10 | 11 | update_opts/2, |
11 | 12 | update_opts_deps/2, |
|
27 | 28 | priv_dir/1, |
28 | 29 | applications/1, |
29 | 30 | applications/2, |
| 31 | + included_applications/1, |
| 32 | + included_applications/2, |
30 | 33 | profiles/1, |
31 | 34 | profiles/2, |
32 | 35 | deps/1, |
|
76 | 79 |
|
77 | 80 | -type project_type() :: rebar3 | mix | undefined. |
78 | 81 |
|
79 | | --record(app_info_t, {name :: binary() | undefined, |
80 | | - app_file_src :: file:filename_all() | undefined, |
81 | | - app_file_src_script:: file:filename_all() | undefined, |
82 | | - app_file :: file:filename_all() | undefined, |
83 | | - original_vsn :: binary() | undefined, |
84 | | - parent=root :: binary() | root, |
85 | | - app_details=[] :: list(), |
86 | | - applications=[] :: list(), |
87 | | - deps=[] :: list(), |
88 | | - profiles=[default] :: [atom()], |
89 | | - default=dict:new() :: rebar_dict(), |
90 | | - opts=dict:new() :: rebar_dict(), |
91 | | - dep_level=0 :: integer(), |
92 | | - dir :: file:name(), |
93 | | - out_dir :: file:name(), |
94 | | - ebin_dir :: file:name(), |
95 | | - source :: string() | tuple() | checkout | undefined, |
96 | | - is_lock=false :: boolean(), |
97 | | - is_checkout=false :: boolean(), |
98 | | - valid :: boolean() | undefined, |
99 | | - project_type :: project_type(), |
100 | | - is_available=false :: boolean()}). |
| 82 | +-record(app_info_t, {name :: binary() | undefined, |
| 83 | + app_file_src :: file:filename_all() | undefined, |
| 84 | + app_file_src_script :: file:filename_all() | undefined, |
| 85 | + app_file :: file:filename_all() | undefined, |
| 86 | + original_vsn :: binary() | undefined, |
| 87 | + parent=root :: binary() | root, |
| 88 | + app_details=[] :: list(), |
| 89 | + applications=[] :: list(), |
| 90 | + included_applications=[] :: [atom()], |
| 91 | + deps=[] :: list(), |
| 92 | + profiles=[default] :: [atom()], |
| 93 | + default=dict:new() :: rebar_dict(), |
| 94 | + opts=dict:new() :: rebar_dict(), |
| 95 | + dep_level=0 :: integer(), |
| 96 | + dir :: file:name(), |
| 97 | + out_dir :: file:name(), |
| 98 | + ebin_dir :: file:name(), |
| 99 | + source :: string() | tuple() | checkout | undefined, |
| 100 | + is_lock=false :: boolean(), |
| 101 | + is_checkout=false :: boolean(), |
| 102 | + valid :: boolean() | undefined, |
| 103 | + project_type :: project_type(), |
| 104 | + is_available=false :: boolean()}). |
101 | 105 |
|
102 | 106 | %%============================================================================ |
103 | 107 | %% types |
@@ -159,6 +163,22 @@ new(Parent, AppName, Vsn, Dir, Deps) -> |
159 | 163 | ebin_dir=filename:join(rebar_utils:to_list(Dir), "ebin"), |
160 | 164 | deps=Deps}}. |
161 | 165 |
|
| 166 | +app_to_map(#app_info_t{name=Name, |
| 167 | + original_vsn=Vsn, |
| 168 | + applications=Applications, |
| 169 | + included_applications=IncludedApplications, |
| 170 | + out_dir=OutDir, |
| 171 | + ebin_dir=EbinDir}) -> |
| 172 | + %% TODO: call rlx_app_info to create map |
| 173 | + #{name => ec_cnv:to_atom(Name), |
| 174 | + vsn => Vsn, |
| 175 | + applications => Applications, |
| 176 | + included_applications => IncludedApplications, |
| 177 | + dir => OutDir, |
| 178 | + out_dir => OutDir, |
| 179 | + ebin_dir => EbinDir, |
| 180 | + link => false}. |
| 181 | + |
162 | 182 | %% @doc update the opts based on the contents of a config |
163 | 183 | %% file for the app |
164 | 184 | -spec update_opts(t(), rebar_dict(), [any()]) -> t(). |
@@ -406,6 +426,17 @@ applications(#app_info_t{applications=Applications}) -> |
406 | 426 | applications(AppInfo=#app_info_t{}, Applications) -> |
407 | 427 | AppInfo#app_info_t{applications=Applications}. |
408 | 428 |
|
| 429 | +%% @doc returns the list of included_applications the app depends on. |
| 430 | +-spec included_applications(t()) -> list(). |
| 431 | +included_applications(#app_info_t{included_applications=Applications}) -> |
| 432 | + Applications. |
| 433 | + |
| 434 | +%% @doc sets the list of applications the app depends on. |
| 435 | +%% Should be obtained from the app file. |
| 436 | +-spec included_applications(t(), list()) -> t(). |
| 437 | +included_applications(AppInfo=#app_info_t{}, Applications) -> |
| 438 | + AppInfo#app_info_t{included_applications=Applications}. |
| 439 | + |
409 | 440 | %% @doc returns the list of active profiles |
410 | 441 | -spec profiles(t()) -> list(). |
411 | 442 | profiles(#app_info_t{profiles=Profiles}) -> |
|
0 commit comments