Pārlūkot izejas kodu

Merge pull request #2333 from tsloughter/relx-upgrade-xref

upgrades relx which now checks for undefined functions of project apps
pull/2336/head
Tristan Sloughter pirms 4 gadiem
revīziju iesūtīja GitHub
vecāks
revīzija
d7ee6ffe25
Šim parakstam datu bāzē netika atrasta zināma atslēga GPG atslēgas ID: 4AEE18F83AFDEB23
6 mainītis faili ar 53 papildinājumiem un 18 dzēšanām
  1. +21
    -9
      priv/templates/relx_rebar.config
  2. +1
    -1
      rebar.config
  3. +4
    -3
      rebar.lock
  4. +8
    -1
      src/rebar_app_info.erl
  5. +2
    -0
      src/rebar_prv_lock.erl
  6. +17
    -4
      src/rebar_relx.erl

+ 21
- 9
priv/templates/relx_rebar.config Parādīt failu

@ -6,16 +6,28 @@
[@@name@@,
sasl]},
{mode, dev},
%% automatically picked up if the files
%% exist but can be set manually, which
%% is required if the names aren't exactly
%% sys.config and vm.args
{sys_config, "./config/sys.config"},
{vm_args, "./config/vm.args"},
{vm_args, "./config/vm.args"}
{dev_mode, true},
{include_erts, false},
%% the .src form of the configuration files do
%% not require setting RELX_REPLACE_OS_VARS
%% {sys_config_src, "./config/sys.config.src"},
%% {vm_args_src, "./config/vm.args.src"}
]}.
{extended_start_script, true}]
}.
{profiles, [{prod, [{relx,
[%% prod is the default mode when prod
%% profile is used, so does not have
%% to be explicitly included like this
{mode, prod}
{profiles, [{prod, [{relx, [{dev_mode, false},
{include_erts, true}]}]
}]
}.
%% use minimal mode to exclude ERTS
%% {mode, minimal}
]
}]}]}.

+ 1
- 1
rebar.config Parādīt failu

@ -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"}]}.

+ 4
- 3
rebar.lock Parādīt failu

@ -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">>}]}
].

+ 8
- 1
src/rebar_app_info.erl Parādīt failu

@ -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,

+ 2
- 0
src/rebar_prv_lock.erl Parādīt failu

@ -43,6 +43,8 @@ do(State) ->
%% so that they do not appear in the rebar_utils:info_useless/1 warning.
OldLockNames = [element(1,L) || L <- OldLocks] -- Checkouts,
NewLockNames = [element(1,L) || L <- Locks],
%% TODO: don't output this message if the dep is now a checkout
rebar_utils:info_useless(OldLockNames, NewLockNames),
info_checkout_deps(Checkouts),

+ 17
- 4
src/rebar_relx.erl Parādīt failu

@ -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,

Notiek ielāde…
Atcelt
Saglabāt