mirror of
https://github.com/correl/rebar.git
synced 2024-12-18 03:00:17 +00:00
Fix -D and -v handling with new getopt.erl
This commit is contained in:
parent
c4e40714ee
commit
194f3caa3f
2 changed files with 16 additions and 11 deletions
|
@ -156,9 +156,7 @@ parse_args(Args) ->
|
|||
proplists:get_bool(profile, Options)),
|
||||
|
||||
%% Set global variables based on getopt options
|
||||
LogLevel = proplists:get_value(verbose, Options,
|
||||
rebar_log:default_level()),
|
||||
rebar_config:set_global(verbose, LogLevel),
|
||||
set_log_level(Options),
|
||||
set_global_flag(Options, force),
|
||||
DefJobs = rebar_config:get_jobs(),
|
||||
case proplists:get_value(jobs, Options, DefJobs) of
|
||||
|
@ -184,6 +182,18 @@ parse_args(Args) ->
|
|||
halt(1)
|
||||
end.
|
||||
|
||||
%%
|
||||
%% set log level based on getopt option
|
||||
%%
|
||||
set_log_level(Options) ->
|
||||
LogLevel = case proplists:get_all_values(verbose, Options) of
|
||||
[] ->
|
||||
rebar_log:default_level();
|
||||
Verbosities ->
|
||||
lists:last(Verbosities)
|
||||
end,
|
||||
rebar_config:set_global(verbose, LogLevel).
|
||||
|
||||
%%
|
||||
%% show version information and halt
|
||||
%%
|
||||
|
|
|
@ -155,14 +155,9 @@ setup_env(Config) ->
|
|||
%% ===================================================================
|
||||
|
||||
global_defines() ->
|
||||
[begin
|
||||
case string:tokens(D, "=") of
|
||||
[Var, Val] ->
|
||||
{Var, Val};
|
||||
[Def] ->
|
||||
{Def, "1"}
|
||||
end
|
||||
end || D <- rebar_config:get_global(defines, [])].
|
||||
Defines = rebar_config:get_global(defines, []),
|
||||
Flags = string:join(["-D" ++ D || D <- Defines], " "),
|
||||
[{"ERL_CFLAGS", "$ERL_CFLAGS " ++ Flags}].
|
||||
|
||||
expand_sources([], Acc) ->
|
||||
Acc;
|
||||
|
|
Loading…
Reference in a new issue