mirror of
https://github.com/correl/rebar.git
synced 2024-11-23 19:19:54 +00:00
Cleanup deprecations now that R14B03 is released
This commit is contained in:
parent
70137292e1
commit
3a8b4d5e8f
6 changed files with 13 additions and 200 deletions
|
@ -29,8 +29,6 @@
|
||||||
rebar_protobuffs_compiler,
|
rebar_protobuffs_compiler,
|
||||||
rebar_neotoma_compiler,
|
rebar_neotoma_compiler,
|
||||||
rebar_port_compiler,
|
rebar_port_compiler,
|
||||||
rebar_post_script,
|
|
||||||
rebar_pre_script,
|
|
||||||
rebar_rel_utils,
|
rebar_rel_utils,
|
||||||
rebar_reltool,
|
rebar_reltool,
|
||||||
rebar_require_vsn,
|
rebar_require_vsn,
|
||||||
|
@ -64,7 +62,6 @@
|
||||||
%% Dir specific processing modules
|
%% Dir specific processing modules
|
||||||
{modules, [
|
{modules, [
|
||||||
{app_dir, [
|
{app_dir, [
|
||||||
rebar_pre_script,
|
|
||||||
rebar_abnfc_compiler,
|
rebar_abnfc_compiler,
|
||||||
rebar_protobuffs_compiler,
|
rebar_protobuffs_compiler,
|
||||||
rebar_neotoma_compiler,
|
rebar_neotoma_compiler,
|
||||||
|
@ -79,8 +76,7 @@
|
||||||
rebar_dialyzer,
|
rebar_dialyzer,
|
||||||
rebar_escripter,
|
rebar_escripter,
|
||||||
rebar_edoc,
|
rebar_edoc,
|
||||||
rebar_xref,
|
rebar_xref
|
||||||
rebar_post_script
|
|
||||||
]},
|
]},
|
||||||
|
|
||||||
{rel_dir, [
|
{rel_dir, [
|
||||||
|
|
|
@ -70,9 +70,13 @@
|
||||||
|
|
||||||
-spec compile(Config::rebar_config:config(), AppFile::file:filename()) -> 'ok'.
|
-spec compile(Config::rebar_config:config(), AppFile::file:filename()) -> 'ok'.
|
||||||
compile(Config, _AppFile) ->
|
compile(Config, _AppFile) ->
|
||||||
?DEPRECATED(fail_on_warning, warnings_as_errors,
|
%% TODO: enable as soon as OTP patch has been accepted
|
||||||
rebar_config:get_list(Config, erl_opts, []),
|
%% ?DEPRECATED(fail_on_warning, warnings_as_errors,
|
||||||
"once OTP R14B03 is released"),
|
%% 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,
|
rebar_base_compiler:run(Config,
|
||||||
check_files(rebar_config:get_local(
|
check_files(rebar_config:get_local(
|
||||||
|
@ -252,17 +256,6 @@ internal_erl_compile(Source, Config, Outdir, ErlOpts) ->
|
||||||
case compile:file(Source, Opts) of
|
case compile:file(Source, Opts) of
|
||||||
{ok, _, []} ->
|
{ok, _, []} ->
|
||||||
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
|
?FAIL
|
||||||
end;
|
end;
|
||||||
|
@ -306,6 +299,7 @@ compile_xrl_yrl(Source, Target, Opts, Mod) ->
|
||||||
{ok, _, []} ->
|
{ok, _, []} ->
|
||||||
ok;
|
ok;
|
||||||
{ok, _, _Warnings} ->
|
{ok, _, _Warnings} ->
|
||||||
|
%% TODO: remove once R15 is released
|
||||||
case lists:member(fail_on_warning, Opts) of
|
case lists:member(fail_on_warning, Opts) of
|
||||||
true ->
|
true ->
|
||||||
?FAIL;
|
?FAIL;
|
||||||
|
|
|
@ -45,7 +45,7 @@ compile(Config, _AppFile) ->
|
||||||
%% Internal functions
|
%% Internal functions
|
||||||
%% ===================================================================
|
%% ===================================================================
|
||||||
|
|
||||||
compile_lfe(Source, Target, Config) ->
|
compile_lfe(Source, _Target, Config) ->
|
||||||
case code:which(lfe_comp) of
|
case code:which(lfe_comp) of
|
||||||
non_existing ->
|
non_existing ->
|
||||||
?CONSOLE(<<
|
?CONSOLE(<<
|
||||||
|
@ -66,14 +66,6 @@ compile_lfe(Source, Target, Config) ->
|
||||||
case lfe_comp:file(Source, Opts) of
|
case lfe_comp:file(Source, Opts) of
|
||||||
{ok, _, []} ->
|
{ok, _, []} ->
|
||||||
ok;
|
ok;
|
||||||
{ok, _, _Warnings} ->
|
|
||||||
case lists:member(fail_on_warning, Opts) of
|
|
||||||
true ->
|
|
||||||
ok = file:delete(Target),
|
|
||||||
?FAIL;
|
|
||||||
false ->
|
|
||||||
ok
|
|
||||||
end;
|
|
||||||
_ ->
|
_ ->
|
||||||
?FAIL
|
?FAIL
|
||||||
end
|
end
|
||||||
|
|
|
@ -97,10 +97,6 @@ compile(Config, AppFile) ->
|
||||||
_ ->
|
_ ->
|
||||||
Env = setup_env(Config),
|
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
|
%% Compile each of the sources
|
||||||
{NewBins, ExistingBins} = compile_each(Sources, Config, Env,
|
{NewBins, ExistingBins} = compile_each(Sources, Config, Env,
|
||||||
[], []),
|
[], []),
|
||||||
|
@ -142,10 +138,7 @@ clean(Config, AppFile) ->
|
||||||
ExtractSoName = fun({SoName, _}) -> SoName end,
|
ExtractSoName = fun({SoName, _}) -> SoName end,
|
||||||
rebar_file_utils:delete_each([ExtractSoName(S)
|
rebar_file_utils:delete_each([ExtractSoName(S)
|
||||||
|| S <- so_specs(Config, AppFile,
|
|| S <- so_specs(Config, AppFile,
|
||||||
expand_objects(Sources))]),
|
expand_objects(Sources))]).
|
||||||
|
|
||||||
%% Run the cleanup script, if it exists
|
|
||||||
run_cleanup_hook(Config).
|
|
||||||
|
|
||||||
setup_env(Config) ->
|
setup_env(Config) ->
|
||||||
%% Extract environment values from the config (if specified) and
|
%% 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"])
|
[filename:join([filename:dirname(F), filename:basename(F) ++ ".o"])
|
||||||
|| F <- Sources].
|
|| 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) ->
|
compile_each([], _Config, _Env, NewBins, ExistingBins) ->
|
||||||
{lists:reverse(NewBins), lists:reverse(ExistingBins)};
|
{lists:reverse(NewBins), lists:reverse(ExistingBins)};
|
||||||
compile_each([Source | Rest], Config, Env, NewBins, ExistingBins) ->
|
compile_each([Source | Rest], Config, Env, NewBins, ExistingBins) ->
|
||||||
|
|
|
@ -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").
|
|
|
@ -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").
|
|
Loading…
Reference in a new issue