From a015892e211b1276bb681213bb1baa9c7210fd21 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Sat, 10 Nov 2012 21:07:55 +0100 Subject: Cleanup rebar_core and rebar_erlc_compiler Rename rebar_core functions for improved readability. Remove redundant comments and blank lines. --- src/rebar_core.erl | 31 ++++++++++++++++--------------- src/rebar_erlc_compiler.erl | 6 ------ 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/rebar_core.erl b/src/rebar_core.erl index 9e3f9f0..5396dd5 100644 --- a/src/rebar_core.erl +++ b/src/rebar_core.erl @@ -53,9 +53,10 @@ process_commands([Command | Rest], ParentConfig) -> ParentConfig4 = try - %% Convert the code path so that all the entries are absolute paths. - %% If not, code:set_path() may choke on invalid relative paths when trying - %% to restore the code path from inside a subdirectory. + %% Convert the code path so that all the entries are + %% absolute paths. If not, code:set_path() may choke on + %% invalid relative paths when trying to restore the code + %% path from inside a subdirectory. true = rebar_utils:expand_code_path(), {ParentConfig2, _DirSet} = process_dir(rebar_utils:get_cwd(), ParentConfig1, Command, @@ -68,8 +69,9 @@ process_commands([Command | Rest], ParentConfig) -> _ -> ok end, - %% TODO: reconsider after config inheritance removal/redesign - ParentConfig3 = rebar_config:clean_config(ParentConfig1, ParentConfig2), + %% TODO: reconsider after config inheritance removal/re-design + ParentConfig3 = rebar_config:clean_config(ParentConfig1, + ParentConfig2), %% Wipe out vsn cache to avoid invalid hits when %% dependencies are updated rebar_config:set_xconf(ParentConfig3, vsn_cache, dict:new()) @@ -107,29 +109,29 @@ process_dir(Dir, ParentConfig, Command, DirSet) -> %% to process this dir. {ok, AvailModuleSets} = application:get_env(rebar, modules), ModuleSet = choose_module_set(AvailModuleSets, Dir), - maybe_process_dir(ModuleSet, Config, CurrentCodePath, + skip_or_process_dir(ModuleSet, Config, CurrentCodePath, Dir, Command, DirSet) end. -maybe_process_dir({[], undefined}=ModuleSet, Config, CurrentCodePath, +skip_or_process_dir({[], undefined}=ModuleSet, Config, CurrentCodePath, Dir, Command, DirSet) -> - process_dir0(Dir, Command, DirSet, Config, CurrentCodePath, ModuleSet); -maybe_process_dir({_, ModuleSetFile}=ModuleSet, Config, CurrentCodePath, + process_dir1(Dir, Command, DirSet, Config, CurrentCodePath, ModuleSet); +skip_or_process_dir({_, ModuleSetFile}=ModuleSet, Config, CurrentCodePath, Dir, Command, DirSet) -> case lists:suffix(".app.src", ModuleSetFile) orelse lists:suffix(".app", ModuleSetFile) of true -> %% .app or .app.src file, check if is_skipped_app - maybe_process_dir0(ModuleSetFile, ModuleSet, + skip_or_process_dir1(ModuleSetFile, ModuleSet, Config, CurrentCodePath, Dir, Command, DirSet); false -> %% 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) end. -maybe_process_dir0(AppFile, ModuleSet, Config, CurrentCodePath, +skip_or_process_dir1(AppFile, ModuleSet, Config, CurrentCodePath, Dir, Command, DirSet) -> case rebar_app_utils:is_skipped_app(Config, AppFile) of {Config1, {true, SkippedApp}} -> @@ -137,11 +139,11 @@ maybe_process_dir0(AppFile, ModuleSet, Config, CurrentCodePath, Config2 = increment_operations(Config1), {Config2, DirSet}; {Config1, false} -> - process_dir0(Dir, Command, DirSet, Config1, + process_dir1(Dir, Command, DirSet, Config1, CurrentCodePath, ModuleSet) end. -process_dir0(Dir, Command, DirSet, Config0, CurrentCodePath, +process_dir1(Dir, Command, DirSet, Config0, CurrentCodePath, {DirModules, ModuleSetFile}) -> %% Get the list of modules for "any dir". This is a catch-all list %% 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) end. - %% %% Given a list of module sets from rebar.app and a directory, find %% the appropriate subset of modules for this directory diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl index a63f9f4..91f8354 100644 --- a/src/rebar_erlc_compiler.erl +++ b/src/rebar_erlc_compiler.erl @@ -265,11 +265,6 @@ doterl_compile(Config, OutDir, MoreSources) -> true = code:set_path(CurrPath), ok. - -%% =================================================================== -%% Internal functions -%% =================================================================== - -spec include_path(file:filename(), rebar_config:config()) -> [file:filename(), ...]. include_path(Source, Config) -> @@ -414,7 +409,6 @@ gather_src([], Srcs) -> gather_src([Dir|Rest], Srcs) -> gather_src(Rest, Srcs ++ rebar_utils:find_files(Dir, ".*\\.erl\$")). - -spec dirs(file:filename()) -> [file:filename()]. dirs(Dir) -> [F || F <- filelib:wildcard(filename:join([Dir, "*"])), filelib:is_dir(F)]. -- cgit v1.1 From ed55df9648ca296d77c4e11f044066098a3e031a Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Sun, 18 Nov 2012 18:57:55 +0100 Subject: rebar_neotoma_compiler: fix comment --- src/rebar_neotoma_compiler.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rebar_neotoma_compiler.erl b/src/rebar_neotoma_compiler.erl index 9bff892..33f32e3 100644 --- a/src/rebar_neotoma_compiler.erl +++ b/src/rebar_neotoma_compiler.erl @@ -57,7 +57,7 @@ compile(Config, _AppFile) -> fun compile_neo/3, [{check_last_mod,false}]). %% ============================================================================ -%% Public API +%% Internal functions %% ============================================================================ neotoma_opts(Config) -> -- cgit v1.1 From 3ee2a4a6d0c0566ffe5e6d393074117b730521c3 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Sun, 18 Nov 2012 19:36:01 +0100 Subject: rebar.config.sample: document require_*_vsn options --- rebar.config.sample | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rebar.config.sample b/rebar.config.sample index 8e4b51e..f34ff93 100644 --- a/rebar.config.sample +++ b/rebar.config.sample @@ -5,6 +5,11 @@ %% == 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 {lib_dirs, []}. -- cgit v1.1 From 0d5583db5a82473688a313b013203db9242b348b Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Sun, 18 Nov 2012 19:36:59 +0100 Subject: rebar_require_vsn: remove trailing whitespace --- src/rebar_require_vsn.erl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rebar_require_vsn.erl b/src/rebar_require_vsn.erl index 83cb79d..9a0a005 100644 --- a/src/rebar_require_vsn.erl +++ b/src/rebar_require_vsn.erl @@ -77,18 +77,18 @@ check_versions(Config) -> "OTP Release"), case {OtpMaj, OtpMin} >= {MinMaj, MinMin} of true -> - ?DEBUG("~s satisfies the requirement for vsn ~s~n", - [erlang:system_info(otp_release), + ?DEBUG("~s satisfies the requirement for vsn ~s~n", + [erlang:system_info(otp_release), MinOtpVsn]); - false -> + false -> ?ABORT("OTP release ~s or later is required, you have: ~s~n", [MinOtpVsn, erlang:system_info(otp_release)]) - end + end end. 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]} -> {list_to_integer(Maj), list_to_integer(Min)}; {match, [_Full, Maj]} -> -- cgit v1.1 From 39728242f0aa37f432eac0064c2810ac075c498b Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Sun, 18 Nov 2012 19:50:54 +0100 Subject: rebar.config.sample: document leex and yecc options --- rebar.config.sample | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/rebar.config.sample b/rebar.config.sample index f34ff93..b1d824b 100644 --- a/rebar.config.sample +++ b/rebar.config.sample @@ -35,6 +35,18 @@ %% SNMP mibs to compile first? {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 options -- cgit v1.1 From abb319d10a95508eecfce896a6779dba894f86dc Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Sun, 18 Nov 2012 23:36:06 +0100 Subject: rebar_ct: fix wording in comments --- src/rebar_ct.erl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rebar_ct.erl b/src/rebar_ct.erl index e33c6c9..749d025 100644 --- a/src/rebar_ct.erl +++ b/src/rebar_ct.erl @@ -26,14 +26,14 @@ %% ------------------------------------------------------------------- %% %% Targets: -%% test - runs common test suites in ./test -%% int_test - runs suites in ./int_test -%% perf_test - runs suites inm ./perf_test +%% test - run common test suites in ./test +%% int_test - run suites in ./int_test +%% perf_test - run suites inm ./perf_test %% %% Global options: %% verbose=1 - show output from the common_test run as it goes -%% suites="foo,bar" - runs /foo_SUITE and /bar_SUITE -%% case="mycase" - runs individual test case foo_SUITE:mycase +%% suites="foo,bar" - run /foo_SUITE and /bar_SUITE +%% case="mycase" - run individual test case foo_SUITE:mycase %% ------------------------------------------------------------------- -module(rebar_ct). -- cgit v1.1 From 06dbb4cb8083101375f3f243d44f2e9d25b1b8b6 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Sun, 18 Nov 2012 23:44:35 +0100 Subject: Document escriptize command --- src/rebar.erl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/rebar.erl b/src/rebar.erl index c7c9d29..c872ade 100644 --- a/src/rebar.erl +++ b/src/rebar.erl @@ -283,6 +283,8 @@ commands() -> clean Clean compile Compile sources +escriptize Generate escript archive + create template= [var=foo,...] Create skel based on template and vars create-app [appid=myapp] Create simple app skel create-node [nodeid=mynode] Create simple node skel @@ -379,9 +381,10 @@ filter_flags(Config, [Item | Rest], Commands) -> command_names() -> ["check-deps", "clean", "compile", "create", "create-app", "create-node", - "ct", "delete-deps", "doc", "eunit", "generate", "generate-appups", - "generate-upgrade", "get-deps", "help", "list-deps", "list-templates", - "qc", "update-deps", "overlay", "shell", "version", "xref"]. + "ct", "delete-deps", "doc", "eunit", "escriptize", "generate", + "generate-appups", "generate-upgrade", "get-deps", "help", "list-deps", + "list-templates", "qc", "update-deps", "overlay", "shell", "version", + "xref"]. unabbreviate_command_names([]) -> []; -- cgit v1.1 From e74a0feb05750fb803a734b0c1985fe166044372 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Sun, 18 Nov 2012 23:50:56 +0100 Subject: rebar.config: delete unused and unimplemented 'app_bin' option app_bin option was used by the install command which has been removed in 51ed787. --- rebar.config | 1 - rebar.config.sample | 3 --- 2 files changed, 4 deletions(-) diff --git a/rebar.config b/rebar.config index b03f338..9028737 100644 --- a/rebar.config +++ b/rebar.config @@ -1,7 +1,6 @@ %% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*- %% ex: ts=4 sw=4 ft=erlang et -{app_bin, ["priv/rebar"]}. %% escript_incl_extra is for internal rebar-private use only. %% Do not use outside rebar. Config interface is not stable. {escript_incl_extra, [{"priv/templates/*", "."}]}. diff --git a/rebar.config.sample b/rebar.config.sample index b1d824b..c75b01b 100644 --- a/rebar.config.sample +++ b/rebar.config.sample @@ -138,9 +138,6 @@ %% == OTP Applications == -%% Binaries to link into the erlang path? -{app_bin, []}. - %% Enable validation of the OTP app module list. Default is 'true' {validate_app_modules, true}. -- cgit v1.1 From a6617bdaff5c5c9397bca55360703963e9456490 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Mon, 19 Nov 2012 23:42:07 +0100 Subject: rebar.config.sample: document escriptize options --- rebar.config.sample | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rebar.config.sample b/rebar.config.sample index c75b01b..e450530 100644 --- a/rebar.config.sample +++ b/rebar.config.sample @@ -67,6 +67,13 @@ {"linux", "priv/hello_linux", ["c_src/hello_linux.c"]}, {"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 files to compile before the rest -- cgit v1.1 From e86ec457b6bb96379f6c9363f177a40e7d850d36 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Tue, 20 Nov 2012 00:23:24 +0100 Subject: rebar.config.sample: remove non-existing option --- rebar.config.sample | 5 ----- 1 file changed, 5 deletions(-) diff --git a/rebar.config.sample b/rebar.config.sample index e450530..c0d0735 100644 --- a/rebar.config.sample +++ b/rebar.config.sample @@ -138,11 +138,6 @@ %% Which files to cleanup {clean_files, ["file", "file2"]}. -%% == Reltool == - -%% Target directory for the release -{target, "target"}. - %% == OTP Applications == %% Enable validation of the OTP app module list. Default is 'true' -- cgit v1.1