diff --git a/rebar.config b/rebar.config index ce42703e..d1348592 100644 --- a/rebar.config +++ b/rebar.config @@ -8,7 +8,7 @@ {providers, "1.8.1"}, {getopt, "1.0.1"}, {bbmustache, "1.10.0"}, - {relx, "4.0.0-rc2"}, + {relx, {git, "https://github.com/erlware/relx.git", {branch, "master"}}}, {cf, "0.3.1"}, {cth_readable, "1.4.8"}, {eunit_formatters, "0.5.0"}]}. diff --git a/rebar.lock b/rebar.lock index e7666257..fbad069a 100644 --- a/rebar.lock +++ b/rebar.lock @@ -8,7 +8,10 @@ {<<"getopt">>,{pkg,<<"getopt">>,<<"1.0.1">>},0}, {<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.0">>},0}, {<<"providers">>,{pkg,<<"providers">>,<<"1.8.1">>},0}, - {<<"relx">>,{pkg,<<"relx">>,<<"4.0.0-rc2">>},0}, + {<<"relx">>, + {git,"https://github.com/erlware/relx.git", + {ref,"96182ede21c7bbe23c2708514b4a42de0d974d5f"}}, + 0}, {<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.6">>},0}]}. [ {pkg_hash,[ @@ -21,7 +24,6 @@ {<<"getopt">>, <<"C73A9FA687B217F2FF79F68A3B637711BB1936E712B521D8CE466B29CBF7808A">>}, {<<"parse_trans">>, <<"09765507A3C7590A784615CFD421D101AEC25098D50B89D7AA1D66646BC571C1">>}, {<<"providers">>, <<"70B4197869514344A8A60E2B2A4EF41CA03DEF43CFB1712ECF076A0F3C62F083">>}, - {<<"relx">>, <<"6031ED37FB496435FA992E52E540C22020B6678C9FA541CD748F987AD9D732D7">>}, {<<"ssl_verify_fun">>, <<"CF344F5692C82D2CD7554F5EC8FD961548D4FD09E7D22F5B62482E5AEAEBD4B0">>}]}, {pkg_hash_ext,[ {<<"bbmustache">>, <<"43EFFA3FD4BB9523157AF5A9E2276C493495B8459FC8737144AA186CB13CE2EE">>}, @@ -33,6 +35,5 @@ {<<"getopt">>, <<"53E1AB83B9CEB65C9672D3E7A35B8092E9BDC9B3EE80721471A161C10C59959C">>}, {<<"parse_trans">>, <<"17EF63ABDE837AD30680EA7F857DD9E7CED9476CDD7B0394432AF4BFC241B960">>}, {<<"providers">>, <<"E45745ADE9C476A9A469EA0840E418AB19360DC44F01A233304E118A44486BA0">>}, - {<<"relx">>, <<"7DF43DC485821DC5B7EBC4C43487A06F68769F1406C12D6EC47FC6A3889F23D4">>}, {<<"ssl_verify_fun">>, <<"BDB0D2471F453C88FF3908E7686F86F9BE327D065CC1EC16FA4540197EA04680">>}]} ]. diff --git a/src/rebar_app_info.erl b/src/rebar_app_info.erl index b344f809..47efbfda 100644 --- a/src/rebar_app_info.erl +++ b/src/rebar_app_info.erl @@ -176,13 +176,20 @@ new(Parent, AppName, Vsn, Dir, Deps) -> ebin_dir=filename:join(rebar_utils:to_list(Dir), "ebin"), deps=Deps}}. +-spec app_to_map(t()) -> #{name := atom(), + vsn := string(), + applications := [atom()], + included_applications := [atom()], + dir := file:name(), + out_dir := file:name(), + ebin_dir := file:name(), + link := boolean()}. app_to_map(#app_info_t{name=Name, vsn=Vsn, applications=Applications, included_applications=IncludedApplications, out_dir=OutDir, ebin_dir=EbinDir}) -> - %% TODO: call rlx_app_info to create map #{name => ec_cnv:to_atom(Name), vsn => Vsn, applications => Applications, diff --git a/src/rebar_relx.erl b/src/rebar_relx.erl index 0dc93b03..109d9a5c 100644 --- a/src/rebar_relx.erl +++ b/src/rebar_relx.erl @@ -155,13 +155,26 @@ merge_overlays(Config) -> %% This means the project apps and dependencies but not OTP libraries. -spec all_apps(rebar_state:t()) -> #{atom() => rlx_app_info:t()}. all_apps(State) -> - lists:foldl(fun(AppInfo, Acc) -> - Acc#{binary_to_atom(rebar_app_info:name(AppInfo), utf8) - => rebar_app_info:app_to_map(AppInfo)} - end, #{}, rebar_state:project_apps(State) ++ rebar_state:all_deps(State)). + maps:merge(app_infos_to_relx(rebar_state:project_apps(State), project), + app_infos_to_relx(rebar_state:all_deps(State), dep)). %% +-spec app_infos_to_relx([rlx_app_info:t()], rlx_app_info:app_type()) -> #{atom() => rlx_app_info:t()}. +app_infos_to_relx(AppInfos, AppType) -> + lists:foldl(fun(AppInfo, Acc) -> + Acc#{binary_to_atom(rebar_app_info:name(AppInfo), utf8) + => app_info_to_relx(rebar_app_info:app_to_map(AppInfo), AppType)} + end, #{}, AppInfos). + +app_info_to_relx(#{name := Name, + vsn := Vsn, + applications := Applications, + included_applications := IncludedApplications, + dir := Dir, + link := false}, AppType) -> + rlx_app_info:new(Name, Vsn, Dir, Applications, IncludedApplications, AppType). + -spec opt_spec_list() -> [getopt:option_spec()]. opt_spec_list() -> [{all, undefined, "all", boolean,