From be209f24ff12dc2518f86ebf50fced143b21782b Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Tue, 29 Mar 2011 13:44:02 +0200 Subject: [PATCH] Make debug_info default Add no_debug_info option. Remove debug_info=1 option. --- priv/shell-completion/bash/rebar | 4 ++-- rebar.config | 2 +- rebar.config.sample | 2 +- src/rebar_erlc_compiler.erl | 13 ++++++------- src/rebar_eunit.erl | 4 ++-- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/priv/shell-completion/bash/rebar b/priv/shell-completion/bash/rebar index 581ec0d..b0d0d2f 100644 --- a/priv/shell-completion/bash/rebar +++ b/priv/shell-completion/bash/rebar @@ -11,8 +11,8 @@ _rebar() cmdsnvars="build-plt check-plt check-deps clean compile \ create create-app create-node ct dialyze doc delete-deps eunit \ get-deps generate generate-upgrade help list-templates update-deps \ - version xref case= debug_info=1 force=1 jobs= suite= verbose=1 \ - appid= previous_release= skip_deps=1 template= template_dir=" + version xref case= force=1 jobs= suite= verbose=1 appid= \ + previous_release= skip_deps=1 template= template_dir=" if [[ ${cur} == --* ]] ; then COMPREPLY=( $(compgen -W "${lopts}" -- ${cur}) ) diff --git a/rebar.config b/rebar.config index 99995eb..d9477e1 100644 --- a/rebar.config +++ b/rebar.config @@ -1,3 +1,3 @@ {app_bin, ["priv/rebar"]}. -{erl_opts, [fail_on_warning, debug_info]}. +{erl_opts, [fail_on_warning]}. {xref_checks, [undefined_function_calls]}. diff --git a/rebar.config.sample b/rebar.config.sample index 50ddc17..d297414 100644 --- a/rebar.config.sample +++ b/rebar.config.sample @@ -16,7 +16,7 @@ {erl_first_files, ["mymib1", "mymib2"]}. %% Erlang compiler options -{erl_opts, [{i, "myinclude"}, {src_dirs, ["src1", "src2"]}, +{erl_opts, [no_debug_info, {i, "myinclude"}, {src_dirs, ["src1", "src2"]}, {platform_define, "(linux|solaris|freebsd|darwin)", 'HAVE_SENDFILE'}, {platform_define, "(linux|freebsd)", 'BACKLOG', 128}, diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl index a9a8360..21db366 100644 --- a/src/rebar_erlc_compiler.erl +++ b/src/rebar_erlc_compiler.erl @@ -118,13 +118,12 @@ 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 rebar_config:get_global(debug_info, "0") of - "0" -> - RawErlOpts; - _ -> - [debug_info|RawErlOpts] - end, + 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]), %% Support the src_dirs option allowing multiple directories to %% contain erlang source. This might be used, for example, should diff --git a/src/rebar_eunit.erl b/src/rebar_eunit.erl index d4ebe0c..67132cc 100644 --- a/src/rebar_eunit.erl +++ b/src/rebar_eunit.erl @@ -182,14 +182,14 @@ eunit_config(Config) -> ErlOpts = rebar_config:get_list(Config, erl_opts, []), EunitOpts = rebar_config:get_list(Config, eunit_compile_opts, []), - Opts = [{d, 'TEST'}, debug_info] ++ + Opts0 = [{d, 'TEST'}] ++ ErlOpts ++ EunitOpts ++ EqcOpts ++ PropErOpts, + Opts = [O || O <- Opts0, O =/= no_debug_info], Config1 = rebar_config:set(Config, erl_opts, Opts), FirstErls = rebar_config:get_list(Config1, eunit_first_files, []), rebar_config:set(Config1, erl_first_files, FirstErls). - eqc_opts() -> define_if('EQC', is_lib_avail(is_eqc_avail, eqc, "eqc.hrl", "QuickCheck")).