mirror of
https://github.com/correl/rebar.git
synced 2024-11-27 11:09:55 +00:00
commit
329eba4e52
8 changed files with 57 additions and 44 deletions
|
@ -1,7 +1,6 @@
|
||||||
%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
|
%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
|
||||||
%% ex: ts=4 sw=4 ft=erlang et
|
%% ex: ts=4 sw=4 ft=erlang et
|
||||||
|
|
||||||
{app_bin, ["priv/rebar"]}.
|
|
||||||
%% escript_incl_extra is for internal rebar-private use only.
|
%% escript_incl_extra is for internal rebar-private use only.
|
||||||
%% Do not use outside rebar. Config interface is not stable.
|
%% Do not use outside rebar. Config interface is not stable.
|
||||||
{escript_incl_extra, [{"priv/templates/*", "."}]}.
|
{escript_incl_extra, [{"priv/templates/*", "."}]}.
|
||||||
|
|
|
@ -5,6 +5,11 @@
|
||||||
|
|
||||||
%% == Core ==
|
%% == Core ==
|
||||||
|
|
||||||
|
%% Check required ERTS or OTP release version
|
||||||
|
{require_erts_vsn, ".*"}.
|
||||||
|
{require_otp_vsn, ".*"}.
|
||||||
|
{require_min_otp_vsn, ".*"}.
|
||||||
|
|
||||||
%% Additional library directories to add to the code path
|
%% Additional library directories to add to the code path
|
||||||
{lib_dirs, []}.
|
{lib_dirs, []}.
|
||||||
|
|
||||||
|
@ -30,6 +35,18 @@
|
||||||
%% SNMP mibs to compile first?
|
%% SNMP mibs to compile first?
|
||||||
{mib_first_files, []}.
|
{mib_first_files, []}.
|
||||||
|
|
||||||
|
%% leex options
|
||||||
|
{xrl_opts, []}.
|
||||||
|
|
||||||
|
%% leex files to compile first
|
||||||
|
{xrl_first_files, []}.
|
||||||
|
|
||||||
|
%% yecc options
|
||||||
|
{yrl_opts, []}.
|
||||||
|
|
||||||
|
%% yecc files to compile first
|
||||||
|
{yrl_first_files, []}.
|
||||||
|
|
||||||
%% == EDoc ==
|
%% == EDoc ==
|
||||||
|
|
||||||
%% EDoc options
|
%% EDoc options
|
||||||
|
@ -50,6 +67,13 @@
|
||||||
{"linux", "priv/hello_linux", ["c_src/hello_linux.c"]},
|
{"linux", "priv/hello_linux", ["c_src/hello_linux.c"]},
|
||||||
{"linux", "priv/hello_linux", ["c_src/*.c"], [{env, []}]}]}.
|
{"linux", "priv/hello_linux", ["c_src/*.c"], [{env, []}]}]}.
|
||||||
|
|
||||||
|
%% == escriptize ==
|
||||||
|
{escript_name, "application"}.
|
||||||
|
{escript_incl_apps, []}.
|
||||||
|
{escript_shebang, "#!/usr/bin/env escript\n"}.
|
||||||
|
{escript_comment, "%%\n"}.
|
||||||
|
{escript_emu_args, "%%! -pa ~s/~s/ebin\n"}.
|
||||||
|
|
||||||
%% == LFE Compiler ==
|
%% == LFE Compiler ==
|
||||||
|
|
||||||
%% LFE files to compile before the rest
|
%% LFE files to compile before the rest
|
||||||
|
@ -114,16 +138,8 @@
|
||||||
%% Which files to cleanup
|
%% Which files to cleanup
|
||||||
{clean_files, ["file", "file2"]}.
|
{clean_files, ["file", "file2"]}.
|
||||||
|
|
||||||
%% == Reltool ==
|
|
||||||
|
|
||||||
%% Target directory for the release
|
|
||||||
{target, "target"}.
|
|
||||||
|
|
||||||
%% == OTP Applications ==
|
%% == OTP Applications ==
|
||||||
|
|
||||||
%% Binaries to link into the erlang path?
|
|
||||||
{app_bin, []}.
|
|
||||||
|
|
||||||
%% Enable validation of the OTP app module list. Default is 'true'
|
%% Enable validation of the OTP app module list. Default is 'true'
|
||||||
{validate_app_modules, true}.
|
{validate_app_modules, true}.
|
||||||
|
|
||||||
|
|
|
@ -283,6 +283,8 @@ commands() ->
|
||||||
clean Clean
|
clean Clean
|
||||||
compile Compile sources
|
compile Compile sources
|
||||||
|
|
||||||
|
escriptize Generate escript archive
|
||||||
|
|
||||||
create template= [var=foo,...] Create skel based on template and vars
|
create template= [var=foo,...] Create skel based on template and vars
|
||||||
create-app [appid=myapp] Create simple app skel
|
create-app [appid=myapp] Create simple app skel
|
||||||
create-node [nodeid=mynode] Create simple node skel
|
create-node [nodeid=mynode] Create simple node skel
|
||||||
|
@ -379,9 +381,10 @@ filter_flags(Config, [Item | Rest], Commands) ->
|
||||||
|
|
||||||
command_names() ->
|
command_names() ->
|
||||||
["check-deps", "clean", "compile", "create", "create-app", "create-node",
|
["check-deps", "clean", "compile", "create", "create-app", "create-node",
|
||||||
"ct", "delete-deps", "doc", "eunit", "generate", "generate-appups",
|
"ct", "delete-deps", "doc", "eunit", "escriptize", "generate",
|
||||||
"generate-upgrade", "get-deps", "help", "list-deps", "list-templates",
|
"generate-appups", "generate-upgrade", "get-deps", "help", "list-deps",
|
||||||
"qc", "update-deps", "overlay", "shell", "version", "xref"].
|
"list-templates", "qc", "update-deps", "overlay", "shell", "version",
|
||||||
|
"xref"].
|
||||||
|
|
||||||
unabbreviate_command_names([]) ->
|
unabbreviate_command_names([]) ->
|
||||||
[];
|
[];
|
||||||
|
|
|
@ -53,9 +53,10 @@ process_commands([Command | Rest], ParentConfig) ->
|
||||||
|
|
||||||
ParentConfig4 =
|
ParentConfig4 =
|
||||||
try
|
try
|
||||||
%% Convert the code path so that all the entries are absolute paths.
|
%% Convert the code path so that all the entries are
|
||||||
%% If not, code:set_path() may choke on invalid relative paths when trying
|
%% absolute paths. If not, code:set_path() may choke on
|
||||||
%% to restore the code path from inside a subdirectory.
|
%% invalid relative paths when trying to restore the code
|
||||||
|
%% path from inside a subdirectory.
|
||||||
true = rebar_utils:expand_code_path(),
|
true = rebar_utils:expand_code_path(),
|
||||||
{ParentConfig2, _DirSet} = process_dir(rebar_utils:get_cwd(),
|
{ParentConfig2, _DirSet} = process_dir(rebar_utils:get_cwd(),
|
||||||
ParentConfig1, Command,
|
ParentConfig1, Command,
|
||||||
|
@ -68,8 +69,9 @@ process_commands([Command | Rest], ParentConfig) ->
|
||||||
_ ->
|
_ ->
|
||||||
ok
|
ok
|
||||||
end,
|
end,
|
||||||
%% TODO: reconsider after config inheritance removal/redesign
|
%% TODO: reconsider after config inheritance removal/re-design
|
||||||
ParentConfig3 = rebar_config:clean_config(ParentConfig1, ParentConfig2),
|
ParentConfig3 = rebar_config:clean_config(ParentConfig1,
|
||||||
|
ParentConfig2),
|
||||||
%% Wipe out vsn cache to avoid invalid hits when
|
%% Wipe out vsn cache to avoid invalid hits when
|
||||||
%% dependencies are updated
|
%% dependencies are updated
|
||||||
rebar_config:set_xconf(ParentConfig3, vsn_cache, dict:new())
|
rebar_config:set_xconf(ParentConfig3, vsn_cache, dict:new())
|
||||||
|
@ -107,29 +109,29 @@ process_dir(Dir, ParentConfig, Command, DirSet) ->
|
||||||
%% to process this dir.
|
%% to process this dir.
|
||||||
{ok, AvailModuleSets} = application:get_env(rebar, modules),
|
{ok, AvailModuleSets} = application:get_env(rebar, modules),
|
||||||
ModuleSet = choose_module_set(AvailModuleSets, Dir),
|
ModuleSet = choose_module_set(AvailModuleSets, Dir),
|
||||||
maybe_process_dir(ModuleSet, Config, CurrentCodePath,
|
skip_or_process_dir(ModuleSet, Config, CurrentCodePath,
|
||||||
Dir, Command, DirSet)
|
Dir, Command, DirSet)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
maybe_process_dir({[], undefined}=ModuleSet, Config, CurrentCodePath,
|
skip_or_process_dir({[], undefined}=ModuleSet, Config, CurrentCodePath,
|
||||||
Dir, Command, DirSet) ->
|
Dir, Command, DirSet) ->
|
||||||
process_dir0(Dir, Command, DirSet, Config, CurrentCodePath, ModuleSet);
|
process_dir1(Dir, Command, DirSet, Config, CurrentCodePath, ModuleSet);
|
||||||
maybe_process_dir({_, ModuleSetFile}=ModuleSet, Config, CurrentCodePath,
|
skip_or_process_dir({_, ModuleSetFile}=ModuleSet, Config, CurrentCodePath,
|
||||||
Dir, Command, DirSet) ->
|
Dir, Command, DirSet) ->
|
||||||
case lists:suffix(".app.src", ModuleSetFile)
|
case lists:suffix(".app.src", ModuleSetFile)
|
||||||
orelse lists:suffix(".app", ModuleSetFile) of
|
orelse lists:suffix(".app", ModuleSetFile) of
|
||||||
true ->
|
true ->
|
||||||
%% .app or .app.src file, check if is_skipped_app
|
%% .app or .app.src file, check if is_skipped_app
|
||||||
maybe_process_dir0(ModuleSetFile, ModuleSet,
|
skip_or_process_dir1(ModuleSetFile, ModuleSet,
|
||||||
Config, CurrentCodePath, Dir,
|
Config, CurrentCodePath, Dir,
|
||||||
Command, DirSet);
|
Command, DirSet);
|
||||||
false ->
|
false ->
|
||||||
%% not an app dir, no need to consider apps=/skip_apps=
|
%% not an app dir, no need to consider apps=/skip_apps=
|
||||||
process_dir0(Dir, Command, DirSet, Config,
|
process_dir1(Dir, Command, DirSet, Config,
|
||||||
CurrentCodePath, ModuleSet)
|
CurrentCodePath, ModuleSet)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
maybe_process_dir0(AppFile, ModuleSet, Config, CurrentCodePath,
|
skip_or_process_dir1(AppFile, ModuleSet, Config, CurrentCodePath,
|
||||||
Dir, Command, DirSet) ->
|
Dir, Command, DirSet) ->
|
||||||
case rebar_app_utils:is_skipped_app(Config, AppFile) of
|
case rebar_app_utils:is_skipped_app(Config, AppFile) of
|
||||||
{Config1, {true, SkippedApp}} ->
|
{Config1, {true, SkippedApp}} ->
|
||||||
|
@ -137,11 +139,11 @@ maybe_process_dir0(AppFile, ModuleSet, Config, CurrentCodePath,
|
||||||
Config2 = increment_operations(Config1),
|
Config2 = increment_operations(Config1),
|
||||||
{Config2, DirSet};
|
{Config2, DirSet};
|
||||||
{Config1, false} ->
|
{Config1, false} ->
|
||||||
process_dir0(Dir, Command, DirSet, Config1,
|
process_dir1(Dir, Command, DirSet, Config1,
|
||||||
CurrentCodePath, ModuleSet)
|
CurrentCodePath, ModuleSet)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
process_dir0(Dir, Command, DirSet, Config0, CurrentCodePath,
|
process_dir1(Dir, Command, DirSet, Config0, CurrentCodePath,
|
||||||
{DirModules, ModuleSetFile}) ->
|
{DirModules, ModuleSetFile}) ->
|
||||||
%% Get the list of modules for "any dir". This is a catch-all list
|
%% Get the list of modules for "any dir". This is a catch-all list
|
||||||
%% of modules that are processed in addition to modules associated
|
%% of modules that are processed in addition to modules associated
|
||||||
|
@ -270,7 +272,6 @@ process_each([Dir | Rest], Command, Config, ModuleSetFile, DirSet) ->
|
||||||
process_each(Rest, Command, Config3, ModuleSetFile, DirSet2)
|
process_each(Rest, Command, Config3, ModuleSetFile, DirSet2)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
%%
|
%%
|
||||||
%% Given a list of module sets from rebar.app and a directory, find
|
%% Given a list of module sets from rebar.app and a directory, find
|
||||||
%% the appropriate subset of modules for this directory
|
%% the appropriate subset of modules for this directory
|
||||||
|
|
|
@ -26,14 +26,14 @@
|
||||||
%% -------------------------------------------------------------------
|
%% -------------------------------------------------------------------
|
||||||
%%
|
%%
|
||||||
%% Targets:
|
%% Targets:
|
||||||
%% test - runs common test suites in ./test
|
%% test - run common test suites in ./test
|
||||||
%% int_test - runs suites in ./int_test
|
%% int_test - run suites in ./int_test
|
||||||
%% perf_test - runs suites inm ./perf_test
|
%% perf_test - run suites inm ./perf_test
|
||||||
%%
|
%%
|
||||||
%% Global options:
|
%% Global options:
|
||||||
%% verbose=1 - show output from the common_test run as it goes
|
%% verbose=1 - show output from the common_test run as it goes
|
||||||
%% suites="foo,bar" - runs <test>/foo_SUITE and <test>/bar_SUITE
|
%% suites="foo,bar" - run <test>/foo_SUITE and <test>/bar_SUITE
|
||||||
%% case="mycase" - runs individual test case foo_SUITE:mycase
|
%% case="mycase" - run individual test case foo_SUITE:mycase
|
||||||
%% -------------------------------------------------------------------
|
%% -------------------------------------------------------------------
|
||||||
-module(rebar_ct).
|
-module(rebar_ct).
|
||||||
|
|
||||||
|
|
|
@ -265,11 +265,6 @@ doterl_compile(Config, OutDir, MoreSources) ->
|
||||||
true = code:set_path(CurrPath),
|
true = code:set_path(CurrPath),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
|
||||||
%% ===================================================================
|
|
||||||
%% Internal functions
|
|
||||||
%% ===================================================================
|
|
||||||
|
|
||||||
-spec include_path(file:filename(),
|
-spec include_path(file:filename(),
|
||||||
rebar_config:config()) -> [file:filename(), ...].
|
rebar_config:config()) -> [file:filename(), ...].
|
||||||
include_path(Source, Config) ->
|
include_path(Source, Config) ->
|
||||||
|
@ -414,7 +409,6 @@ gather_src([], Srcs) ->
|
||||||
gather_src([Dir|Rest], Srcs) ->
|
gather_src([Dir|Rest], Srcs) ->
|
||||||
gather_src(Rest, Srcs ++ rebar_utils:find_files(Dir, ".*\\.erl\$")).
|
gather_src(Rest, Srcs ++ rebar_utils:find_files(Dir, ".*\\.erl\$")).
|
||||||
|
|
||||||
|
|
||||||
-spec dirs(file:filename()) -> [file:filename()].
|
-spec dirs(file:filename()) -> [file:filename()].
|
||||||
dirs(Dir) ->
|
dirs(Dir) ->
|
||||||
[F || F <- filelib:wildcard(filename:join([Dir, "*"])), filelib:is_dir(F)].
|
[F || F <- filelib:wildcard(filename:join([Dir, "*"])), filelib:is_dir(F)].
|
||||||
|
|
|
@ -57,7 +57,7 @@ compile(Config, _AppFile) ->
|
||||||
fun compile_neo/3, [{check_last_mod,false}]).
|
fun compile_neo/3, [{check_last_mod,false}]).
|
||||||
|
|
||||||
%% ============================================================================
|
%% ============================================================================
|
||||||
%% Public API
|
%% Internal functions
|
||||||
%% ============================================================================
|
%% ============================================================================
|
||||||
|
|
||||||
neotoma_opts(Config) ->
|
neotoma_opts(Config) ->
|
||||||
|
|
|
@ -77,18 +77,18 @@ check_versions(Config) ->
|
||||||
"OTP Release"),
|
"OTP Release"),
|
||||||
case {OtpMaj, OtpMin} >= {MinMaj, MinMin} of
|
case {OtpMaj, OtpMin} >= {MinMaj, MinMin} of
|
||||||
true ->
|
true ->
|
||||||
?DEBUG("~s satisfies the requirement for vsn ~s~n",
|
?DEBUG("~s satisfies the requirement for vsn ~s~n",
|
||||||
[erlang:system_info(otp_release),
|
[erlang:system_info(otp_release),
|
||||||
MinOtpVsn]);
|
MinOtpVsn]);
|
||||||
false ->
|
false ->
|
||||||
?ABORT("OTP release ~s or later is required, you have: ~s~n",
|
?ABORT("OTP release ~s or later is required, you have: ~s~n",
|
||||||
[MinOtpVsn,
|
[MinOtpVsn,
|
||||||
erlang:system_info(otp_release)])
|
erlang:system_info(otp_release)])
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
version_tuple(OtpRelease, Type) ->
|
version_tuple(OtpRelease, Type) ->
|
||||||
case re:run(OtpRelease, "R(\\d+)B?-?(\\d+)?", [{capture, all, list}]) of
|
case re:run(OtpRelease, "R(\\d+)B?-?(\\d+)?", [{capture, all, list}]) of
|
||||||
{match, [_Full, Maj, Min]} ->
|
{match, [_Full, Maj, Min]} ->
|
||||||
{list_to_integer(Maj), list_to_integer(Min)};
|
{list_to_integer(Maj), list_to_integer(Min)};
|
||||||
{match, [_Full, Maj]} ->
|
{match, [_Full, Maj]} ->
|
||||||
|
|
Loading…
Reference in a new issue