From df9b77633a7391a6eed3016378522f6754c655d6 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Mon, 2 Jul 2012 18:47:06 +0200 Subject: [PATCH] Move erl_opts/1 and src_dirs/1 to proper place --- src/rebar_utils.erl | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl index f2290e0..fc8930f 100644 --- a/src/rebar_utils.erl +++ b/src/rebar_utils.erl @@ -283,6 +283,26 @@ delayed_halt(Code) -> 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 %% ==================================================================== @@ -455,26 +475,6 @@ vcs_vsn_invoke(Cmd, Dir) -> {ok, VsnString} = rebar_utils:sh(Cmd, [{cd, Dir}, {use_stdout, false}]), 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 %% those which match the provided architecture regex are returned.