Move erl_opts/1 and src_dirs/1 to proper place

This commit is contained in:
Tuncer Ayaz 2012-07-02 18:47:06 +02:00
parent ad2f30ccb9
commit df9b77633a

View file

@ -283,6 +283,26 @@ delayed_halt(Code) ->
end end
end. end.
%% @doc Return list of erl_opts
-spec erl_opts(rebar_config:config()) -> list().
erl_opts(Config) ->
RawErlOpts = filter_defines(rebar_config:get(Config, erl_opts, []), []),
GlobalDefines = [{d, list_to_atom(D)} ||
D <- 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];
false ->
[debug_info|Opts]
end.
-spec src_dirs(SrcDirs::[string()]) -> [file:filename(), ...].
src_dirs([]) ->
["src"];
src_dirs(SrcDirs) ->
SrcDirs.
%% ==================================================================== %% ====================================================================
%% Internal functions %% Internal functions
%% ==================================================================== %% ====================================================================
@ -455,26 +475,6 @@ vcs_vsn_invoke(Cmd, Dir) ->
{ok, VsnString} = rebar_utils:sh(Cmd, [{cd, Dir}, {use_stdout, false}]), {ok, VsnString} = rebar_utils:sh(Cmd, [{cd, Dir}, {use_stdout, false}]),
string:strip(VsnString, right, $\n). string:strip(VsnString, right, $\n).
%% @doc Return list of erl_opts
-spec erl_opts(rebar_config:config()) -> list().
erl_opts(Config) ->
RawErlOpts = filter_defines(rebar_config:get(Config, erl_opts, []), []),
GlobalDefines = [{d, list_to_atom(D)} ||
D <- 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];
false ->
[debug_info|Opts]
end.
-spec src_dirs(SrcDirs::[string()]) -> [file:filename(), ...].
src_dirs([]) ->
["src"];
src_dirs(SrcDirs) ->
SrcDirs.
%% %%
%% Filter a list of erl_opts platform_define options such that only %% Filter a list of erl_opts platform_define options such that only
%% those which match the provided architecture regex are returned. %% those which match the provided architecture regex are returned.