mirror of
https://github.com/correl/rebar.git
synced 2024-12-18 03:00:17 +00:00
Add -D option
This commit is contained in:
parent
74ca540939
commit
a0dcc624d9
2 changed files with 18 additions and 8 deletions
|
@ -135,6 +135,9 @@ parse_args(Args) ->
|
|||
%% Check options and maybe halt execution
|
||||
ok = show_info_maybe_halt(Options, NonOptArgs),
|
||||
|
||||
GlobalDefines = proplists:get_all_values(defines, Options),
|
||||
rebar_config:set_global(defines, GlobalDefines),
|
||||
|
||||
%% Set global variables based on getopt options
|
||||
set_global_flag(Options, verbose),
|
||||
set_global_flag(Options, force),
|
||||
|
@ -263,6 +266,7 @@ option_spec_list() ->
|
|||
{verbose, $v, "verbose", undefined, "Be verbose about what gets done"},
|
||||
{version, $V, "version", undefined, "Show version information"},
|
||||
{force, $f, "force", undefined, "Force"},
|
||||
{defines, $D, undefined, string, "Define compiler macro"},
|
||||
{jobs, $j, "jobs", integer, JobsHelp},
|
||||
{config, $C, "config", string, "Rebar config file to use"}
|
||||
].
|
||||
|
|
|
@ -122,14 +122,8 @@ doterl_compile(Config, OutDir) ->
|
|||
|
||||
doterl_compile(Config, OutDir, MoreSources) ->
|
||||
FirstErls = rebar_config:get_list(Config, erl_first_files, []),
|
||||
RawErlOpts = filter_defines(rebar_config:get(Config, erl_opts, []), []),
|
||||
ErlOpts = case proplists:is_defined(no_debug_info, RawErlOpts) of
|
||||
true ->
|
||||
[O || O <- RawErlOpts, O =/= no_debug_info];
|
||||
_ ->
|
||||
[debug_info|RawErlOpts]
|
||||
end,
|
||||
?DEBUG("erl_opts ~p~n",[ErlOpts]),
|
||||
ErlOpts = erl_opts(Config),
|
||||
?DEBUG("erl_opts ~p~n", [ErlOpts]),
|
||||
%% Support the src_dirs option allowing multiple directories to
|
||||
%% contain erlang source. This might be used, for example, should
|
||||
%% eunit tests be separated from the core application source.
|
||||
|
@ -170,6 +164,18 @@ doterl_compile(Config, OutDir, MoreSources) ->
|
|||
%% Internal functions
|
||||
%% ===================================================================
|
||||
|
||||
erl_opts(Config) ->
|
||||
RawErlOpts = filter_defines(rebar_config:get(Config, erl_opts, []), []),
|
||||
GlobalDefines = lists:map(fun(D) -> list_to_atom(D) end,
|
||||
rebar_config:get_global(defines, [])),
|
||||
Opts = GlobalDefines ++ RawErlOpts,
|
||||
case proplists:is_defined(no_debug_info, Opts) of
|
||||
true ->
|
||||
[O || O <- Opts, O =/= no_debug_info];
|
||||
_ ->
|
||||
[debug_info|Opts]
|
||||
end.
|
||||
|
||||
-spec include_path(Source::file:filename(),
|
||||
Config::rebar_config:config()) -> [file:filename(), ...].
|
||||
include_path(Source, Config) ->
|
||||
|
|
Loading…
Reference in a new issue