diff --git a/ebin/rebar.app b/ebin/rebar.app index 3565fed1..a6bb69a0 100644 --- a/ebin/rebar.app +++ b/ebin/rebar.app @@ -29,8 +29,6 @@ rebar_protobuffs_compiler, rebar_neotoma_compiler, rebar_port_compiler, - rebar_post_script, - rebar_pre_script, rebar_rel_utils, rebar_reltool, rebar_require_vsn, @@ -64,7 +62,6 @@ %% Dir specific processing modules {modules, [ {app_dir, [ - rebar_pre_script, rebar_abnfc_compiler, rebar_protobuffs_compiler, rebar_neotoma_compiler, @@ -79,8 +76,7 @@ rebar_dialyzer, rebar_escripter, rebar_edoc, - rebar_xref, - rebar_post_script + rebar_xref ]}, {rel_dir, [ diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl index efbdf09f..6567f067 100644 --- a/src/rebar_erlc_compiler.erl +++ b/src/rebar_erlc_compiler.erl @@ -70,9 +70,13 @@ -spec compile(Config::rebar_config:config(), AppFile::file:filename()) -> 'ok'. compile(Config, _AppFile) -> - ?DEPRECATED(fail_on_warning, warnings_as_errors, - rebar_config:get_list(Config, erl_opts, []), - "once OTP R14B03 is released"), + %% TODO: enable as soon as OTP patch has been accepted + %% ?DEPRECATED(fail_on_warning, warnings_as_errors, + %% rebar_config:get_list(Config, xrl_opts, []), + %% "once R15 is released"), + %% ?DEPRECATED(fail_on_warning, warnings_as_errors, + %% rebar_config:get_list(Config, yrl_opts, []), + %% "once R15 is released"), rebar_base_compiler:run(Config, check_files(rebar_config:get_local( @@ -252,17 +256,6 @@ internal_erl_compile(Source, Config, Outdir, ErlOpts) -> case compile:file(Source, Opts) of {ok, _, []} -> ok; - {ok, _, _Warnings} -> - %% We got at least one warning -- if fail_on_warning - %% is in options, fail - case lists:member(fail_on_warning, Opts) of - true -> - %% remove target to prevent overlooking this failure - ok = file:delete(Target), - ?FAIL; - false -> - ok - end; _ -> ?FAIL end; @@ -287,14 +280,14 @@ compile_mib(Source, Target, Config) -> Config::rebar_config:config()) -> 'ok'. compile_xrl(Source, Target, Config) -> Opts = [{scannerfile, Target}, {return, true} - |rebar_config:get(Config, xrl_opts, [])], + | rebar_config:get(Config, xrl_opts, [])], compile_xrl_yrl(Source, Target, Opts, leex). -spec compile_yrl(Source::file:filename(), Target::file:filename(), Config::rebar_config:config()) -> 'ok'. compile_yrl(Source, Target, Config) -> Opts = [{parserfile, Target}, {return, true} - |rebar_config:get(Config, yrl_opts, [])], + | rebar_config:get(Config, yrl_opts, [])], compile_xrl_yrl(Source, Target, Opts, yecc). -spec compile_xrl_yrl(Source::file:filename(), Target::file:filename(), @@ -306,6 +299,7 @@ compile_xrl_yrl(Source, Target, Opts, Mod) -> {ok, _, []} -> ok; {ok, _, _Warnings} -> + %% TODO: remove once R15 is released case lists:member(fail_on_warning, Opts) of true -> ?FAIL; diff --git a/src/rebar_lfe_compiler.erl b/src/rebar_lfe_compiler.erl index 50b7c29d..4534c9ff 100644 --- a/src/rebar_lfe_compiler.erl +++ b/src/rebar_lfe_compiler.erl @@ -45,7 +45,7 @@ compile(Config, _AppFile) -> %% Internal functions %% =================================================================== -compile_lfe(Source, Target, Config) -> +compile_lfe(Source, _Target, Config) -> case code:which(lfe_comp) of non_existing -> ?CONSOLE(<< @@ -66,14 +66,6 @@ compile_lfe(Source, Target, Config) -> case lfe_comp:file(Source, Opts) of {ok, _, []} -> ok; - {ok, _, _Warnings} -> - case lists:member(fail_on_warning, Opts) of - true -> - ok = file:delete(Target), - ?FAIL; - false -> - ok - end; _ -> ?FAIL end diff --git a/src/rebar_port_compiler.erl b/src/rebar_port_compiler.erl index 31547389..272c151f 100644 --- a/src/rebar_port_compiler.erl +++ b/src/rebar_port_compiler.erl @@ -97,10 +97,6 @@ compile(Config, AppFile) -> _ -> Env = setup_env(Config), - %% One or more files are available for building. - %% Run the pre-compile hook, if necessary. - ok = run_precompile_hook(Config, Env), - %% Compile each of the sources {NewBins, ExistingBins} = compile_each(Sources, Config, Env, [], []), @@ -142,10 +138,7 @@ clean(Config, AppFile) -> ExtractSoName = fun({SoName, _}) -> SoName end, rebar_file_utils:delete_each([ExtractSoName(S) || S <- so_specs(Config, AppFile, - expand_objects(Sources))]), - - %% Run the cleanup script, if it exists - run_cleanup_hook(Config). + expand_objects(Sources))]). setup_env(Config) -> %% Extract environment values from the config (if specified) and @@ -179,39 +172,6 @@ expand_objects(Sources) -> [filename:join([filename:dirname(F), filename:basename(F) ++ ".o"]) || F <- Sources]. -run_precompile_hook(Config, Env) -> - case rebar_config:get(Config, port_pre_script, undefined) of - undefined -> - ok; - {Script, BypassFileName} -> - ?DEPRECATED(port_pre_script, - {pre_hooks, [{compile, "script"}]}, - "in a future build of rebar"), - case filelib:is_regular(BypassFileName) of - false -> - ?CONSOLE("Running ~s\n", [Script]), - {ok, _} = rebar_utils:sh(Script, [{env, Env}]), - ok; - true -> - ?INFO("~s exists; not running ~s\n", - [BypassFileName, Script]) - end - end. - -run_cleanup_hook(Config) -> - case rebar_config:get(Config, port_cleanup_script, undefined) of - undefined -> - ok; - Script -> - ?DEPRECATED(port_cleanup_script, - {post_hooks, [{clean, "script"}]}, - "in a future build of rebar"), - ?CONSOLE("Running ~s\n", [Script]), - {ok, _} = rebar_utils:sh(Script, []), - ok - end. - - compile_each([], _Config, _Env, NewBins, ExistingBins) -> {lists:reverse(NewBins), lists:reverse(ExistingBins)}; compile_each([Source | Rest], Config, Env, NewBins, ExistingBins) -> diff --git a/src/rebar_post_script.erl b/src/rebar_post_script.erl deleted file mode 100644 index c254fb8a..00000000 --- a/src/rebar_post_script.erl +++ /dev/null @@ -1,65 +0,0 @@ -%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*- -%% ex: ts=4 sw=4 et -%% ------------------------------------------------------------------- -%% -%% rebar: Erlang Build Tools -%% -%% Copyright (c) 2009, 2010 Dave Smith (dizzyd@dizzyd.com) -%% -%% Permission is hereby granted, free of charge, to any person obtaining a copy -%% of this software and associated documentation files (the "Software"), to deal -%% in the Software without restriction, including without limitation the rights -%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -%% copies of the Software, and to permit persons to whom the Software is -%% furnished to do so, subject to the following conditions: -%% -%% The above copyright notice and this permission notice shall be included in -%% all copies or substantial portions of the Software. -%% -%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -%% THE SOFTWARE. -%% ------------------------------------------------------------------- --module(rebar_post_script). - --export([compile/2, - clean/2]). - --include("rebar.hrl"). - -%% =================================================================== -%% Public API -%% =================================================================== - -compile(Config, _) -> - execute_post_script(Config, compile_post_script). - -clean(Config, _) -> - execute_post_script(Config, clean_post_script). - - -%% =================================================================== -%% Internal functions -%% =================================================================== - -execute_post_script(Config, Key) -> - case rebar_config:get_local(Config, Key, undefined) of - undefined -> - ok; - Script -> - deprecated(Key), - {ok, _} = rebar_utils:sh(Script, []), - ok - end. - - -deprecated(Key=compile_post_script) -> - ?DEPRECATED(Key, {post_hooks, [{compile, "script"}]}, - "in a future build of rebar"); -deprecated(Key=clean_post_script) -> - ?DEPRECATED(Key, {post_hooks, [{clean, "script"}]}, - "in a future build of rebar"). diff --git a/src/rebar_pre_script.erl b/src/rebar_pre_script.erl deleted file mode 100644 index d79d6628..00000000 --- a/src/rebar_pre_script.erl +++ /dev/null @@ -1,64 +0,0 @@ -%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*- -%% ex: ts=4 sw=4 et -%% ------------------------------------------------------------------- -%% -%% rebar: Erlang Build Tools -%% -%% Copyright (c) 2009, 2010 Dave Smith (dizzyd@dizzyd.com) -%% -%% Permission is hereby granted, free of charge, to any person obtaining a copy -%% of this software and associated documentation files (the "Software"), to deal -%% in the Software without restriction, including without limitation the rights -%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -%% copies of the Software, and to permit persons to whom the Software is -%% furnished to do so, subject to the following conditions: -%% -%% The above copyright notice and this permission notice shall be included in -%% all copies or substantial portions of the Software. -%% -%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -%% THE SOFTWARE. -%% ------------------------------------------------------------------- --module(rebar_pre_script). - --export([compile/2, - clean/2]). - --include("rebar.hrl"). - -%% =================================================================== -%% Public API -%% =================================================================== - -compile(Config, _) -> - execute_pre_script(Config, compile_pre_script). - -clean(Config, _) -> - execute_pre_script(Config, clean_pre_script). - - -%% =================================================================== -%% Internal functions -%% =================================================================== - -execute_pre_script(Config, Key) -> - case rebar_config:get_local(Config, Key, undefined) of - undefined -> - ok; - Script -> - deprecated(Key), - {ok, _} = rebar_utils:sh(Script, []), - ok - end. - -deprecated(Key=compile_pre_script) -> - ?DEPRECATED(Key, {pre_hooks, [{compile, "script"}]}, - "in a future build of rebar"); -deprecated(Key=clean_pre_script) -> - ?DEPRECATED(Key, {pre_hooks, [{clean, "script"}]}, - "in a future build of rebar").