From 4b8c81fb53e2caaa74a33d5b62664a67427a7bbf Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Sat, 10 Nov 2012 21:59:19 +0100 Subject: Implement 'rebar help CMD1 CMD2' and extend common 'rebar help' msg * allow plugins to print help message for implemented commands * append core rebar.config options to common 'rebar help' message --- src/rebar_erlc_compiler.erl | 43 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) (limited to 'src/rebar_erlc_compiler.erl') diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl index 91f8354..caef0d2 100644 --- a/src/rebar_erlc_compiler.erl +++ b/src/rebar_erlc_compiler.erl @@ -29,8 +29,9 @@ -export([compile/2, clean/2]). -%% for internal use by only eunit and qc --export([test_compile/3]). +%% for internal use only +-export([test_compile/3, + info/2]). -include("rebar.hrl"). @@ -116,8 +117,6 @@ clean(_Config, _AppFile) -> test_compile(Config, Cmd, OutDir) -> %% Obtain all the test modules for inclusion in the compile stage. - %% Notice: this could also be achieved with the following - %% rebar.config option: {test_compile_opts, [{src_dirs, ["src", "test"]}]} TestErls = rebar_utils:find_files("test", ".*\\.erl\$"), %% Copy source files to eunit dir for cover in case they are not directly @@ -165,6 +164,42 @@ test_compile(Config, Cmd, OutDir) -> %% Internal functions %% =================================================================== +info(help, compile) -> + info_help("Build *.erl, *.yrl, *.xrl, and *.mib sources"); +info(help, clean) -> + info_help("Delete *.erl, *.yrl, *.xrl, and *.mib build results"). + +info_help(Description) -> + ?CONSOLE( + "~s.~n" + "~n" + "Valid rebar.config options:~n" + " ~p~n" + " ~p~n" + " ~p~n" + " ~p~n" + " ~p~n" + " ~p~n" + " ~p~n" + " ~p~n", + [ + Description, + {erl_opts, [no_debug_info, + {i, "myinclude"}, + {src_dirs, ["src", "src2", "src3"]}, + {platform_define, + "(linux|solaris|freebsd|darwin)", 'HAVE_SENDFILE'}, + {platform_define, "(linux|freebsd)", 'BACKLOG', 128}, + {platform_define, "R13", 'old_inets'}]}, + {erl_first_files, ["mymib1", "mymib2"]}, + {mib_opts, []}, + {mib_first_files, []}, + {xrl_opts, []}, + {xrl_first_files, []}, + {yrl_opts, []}, + {yrl_first_files, []} + ]). + test_compile_config(Config, Cmd) -> {Config1, TriqOpts} = triq_opts(Config), {Config2, PropErOpts} = proper_opts(Config1), -- cgit v1.1