diff options
author | Bob Ippolito <bob@redivi.com> | 2010-05-11 08:35:47 -0700 |
---|---|---|
committer | Bob Ippolito <bob@redivi.com> | 2010-05-11 08:35:47 -0700 |
commit | 92be7a38bfc534100675f27968f1e65915ba0f54 (patch) | |
tree | 02f94e426611894c5a797102d6c1a692af9ae281 /src | |
parent | 59ab113f3bedee12bac6b4c41ab0cc5dd5edc285 (diff) |
rebar_plugins in rebar_config to allow extensions
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_core.erl | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/rebar_core.erl b/src/rebar_core.erl index 061fd5c..cfc0b96 100644 --- a/src/rebar_core.erl +++ b/src/rebar_core.erl @@ -274,7 +274,12 @@ process_dir(Dir, ParentConfig, Commands) -> %% that are processed in addition to modules associated with this directory %% type. These any_dir modules are processed FIRST. {ok, AnyDirModules} = application:get_env(rebar, any_dir_modules), - Modules = AnyDirModules ++ DirModules, + + %% Get the list of plug-in modules from rebar.config. These modules are + %% processed LAST. + {ok, PluginModules} = plugin_modules(Config), + + Modules = AnyDirModules ++ DirModules ++ PluginModules, %% Give the modules a chance to tweak config and indicate if there %% are any other dirs that might need processing first. @@ -323,6 +328,21 @@ choose_module_set([{Fn, Modules} | Rest], Dir) -> end. %% +%% Return a flat list of rebar plugin modules. +%% +plugin_modules(Config) -> + Modules = lists:flatten(rebar_config:get_all(Config, rebar_plugins)), + FoundModules = [M || M <- Modules, code:which(M) =/= non_existing], + case (Modules =/= FoundModules) of + true -> + ok; + false -> + ?DEBUG("Missing plugins: ~p\n", [Modules -- FoundModules]), + ok + end, + {ok, FoundModules}. + +%% %% Return .app file if the current directory is an OTP app %% app_dir(Dir) -> |