summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Sloughter <tristan.sloughter@gmail.com>2014-12-24 11:38:49 -0600
committerTristan Sloughter <tristan.sloughter@gmail.com>2014-12-24 11:38:49 -0600
commitfaeb3d3989d47fb8680fdef3a598ebc4fae62f65 (patch)
treefd6c0c9183bc069d37c5b5002ff24628aebbf171
parentb1bfc03ddfeec0bdde4330a73bf824daf80e025d (diff)
parentb4c579b80d5982dd26f3db4b31c66896c3a12f38 (diff)
Merge pull request #76 from tsloughter/master
Small release fix and new plugin loading
-rw-r--r--src/rebar.app.src1
-rw-r--r--src/rebar_plugins.erl32
-rw-r--r--src/rebar_prv_release.erl2
-rw-r--r--src/rebar_prv_tar.erl2
4 files changed, 21 insertions, 16 deletions
diff --git a/src/rebar.app.src b/src/rebar.app.src
index 5f18321..1a1e528 100644
--- a/src/rebar.app.src
+++ b/src/rebar.app.src
@@ -21,7 +21,6 @@
%% Default log level
{log_level, warn},
- %% any_dir processing modules
{providers, [rebar_prv_as,
rebar_prv_clean,
rebar_prv_deps,
diff --git a/src/rebar_plugins.erl b/src/rebar_plugins.erl
index 000ccdc..e1f529d 100644
--- a/src/rebar_plugins.erl
+++ b/src/rebar_plugins.erl
@@ -18,9 +18,9 @@ install(State) ->
DepsDir = rebar_dir:deps_dir(State1),
expand_plugins(DepsDir),
Plugins = rebar_state:get(State1, plugins, []),
- PluginProviders = rebar_utils:filtermap(fun(Plugin) ->
- handle_plugin(Plugin, State1)
- end, Plugins),
+ PluginProviders = lists:flatten(rebar_utils:filtermap(fun(Plugin) ->
+ handle_plugin(Plugin, State1)
+ end, Plugins)),
State2 = rebar_state:set(State1, deps_dir, OldDepsDir),
{ok, PluginProviders, State2}.
@@ -55,16 +55,22 @@ plugin_providers(Plugin) when is_atom(Plugin) ->
validate_plugin(Plugin).
validate_plugin(Plugin) ->
- Exports = sets:from_list(Plugin:module_info(exports)),
- Required = sets:from_list([{init,1},
- {do,1},
- {format_error,1}]),
- case sets:is_subset(Required, Exports) of
- false ->
- ?WARN("Plugin ~p is not a provider. It will not be used.~n", [Plugin]),
- false;
- true ->
- {true, Plugin}
+ application:load(Plugin),
+ case application:get_env(Plugin, providers) of
+ {ok, Providers} ->
+ {true, Providers};
+ undefined ->
+ Exports = sets:from_list(Plugin:module_info(exports)),
+ Required = sets:from_list([{init,1},
+ {do,1},
+ {format_error,1}]),
+ case sets:is_subset(Required, Exports) of
+ false ->
+ ?WARN("Plugin ~p is not a provider. It will not be used.~n", [Plugin]),
+ false;
+ true ->
+ {true, Plugin}
+ end
end.
expand_plugins(Dir) ->
diff --git a/src/rebar_prv_release.erl b/src/rebar_prv_release.erl
index d82b428..d7495a5 100644
--- a/src/rebar_prv_release.erl
+++ b/src/rebar_prv_release.erl
@@ -34,7 +34,7 @@ init(State) ->
do(State) ->
Options = rebar_state:command_args(State),
DepsDir = rebar_dir:deps_dir(State),
- LibDirs = lists:usort(rebar_utils:filtermap(fun ec_file:exists/1, [DepsDir])),
+ LibDirs = lists:usort(rebar_utils:filtermap(fun ec_file:exists/1, [DepsDir | ?DEFAULT_PROJECT_APP_DIRS])),
OutputDir = filename:join(rebar_dir:base_dir(State), ?DEFAULT_RELEASE_DIR),
AllOptions = string:join(["release" | Options], " "),
try
diff --git a/src/rebar_prv_tar.erl b/src/rebar_prv_tar.erl
index 01fa1ba..2a69a28 100644
--- a/src/rebar_prv_tar.erl
+++ b/src/rebar_prv_tar.erl
@@ -34,7 +34,7 @@ init(State) ->
do(State) ->
Options = rebar_state:command_args(State),
DepsDir = rebar_dir:deps_dir(State),
- LibDirs = lists:usort(rebar_utils:filtermap(fun ec_file:exists/1, [DepsDir])),
+ LibDirs = lists:usort(rebar_utils:filtermap(fun ec_file:exists/1, [DepsDir | ?DEFAULT_PROJECT_APP_DIRS])),
OutputDir = filename:join(rebar_dir:base_dir(State), ?DEFAULT_RELEASE_DIR),
AllOptions = string:join(["release", "tar" | Options], " "),
case rebar_state:get(State, relx, []) of