1diff --git a/apps/rebar/src/rebar_plugins.erl b/apps/rebar/src/rebar_plugins.erl
2index cd5f377c..469be42e 100644
3--- a/apps/rebar/src/rebar_plugins.erl
4+++ b/apps/rebar/src/rebar_plugins.erl
5@@ -108,41 +108,9 @@ handle_plugins(Profile, Plugins, State, Upgrade) ->
6 State3 = rebar_state:set(State2, deps_dir, DepsDir),
7 rebar_state:lock(State3, Locks).
8
9-handle_plugin(Profile, Plugin, State, SrcPlugins, Upgrade) ->
10+handle_plugin(_Profile, Plugin, State, _SrcPlugins, _Upgrade) ->
11 try
12- %% Inject top-level src plugins as project apps, so that they get skipped
13- %% by the installation as already seen
14- ProjectApps = rebar_state:project_apps(State),
15- State0 = rebar_state:project_apps(State, SrcPlugins),
16- %% We however have to pick the deps of top-level apps and promote them
17- %% directly to make sure they are installed if they were not also at the top level
18- TopDeps = top_level_deps(State, SrcPlugins),
19- %% Install the plugins
20- {Apps, State1} = rebar_prv_install_deps:handle_deps_as_profile(Profile, State0, [Plugin|TopDeps], Upgrade),
21- {no_cycle, Sorted} = rebar_prv_install_deps:find_cycles(SrcPlugins++Apps),
22- ToBuild = rebar_prv_install_deps:cull_compile(Sorted, []),
23- %% Return things to normal
24- State2 = rebar_state:project_apps(State1, ProjectApps),
25-
26- %% Add already built plugin deps to the code path
27- ToBuildPaths = [rebar_app_info:ebin_dir(A) || A <- ToBuild],
28- PreBuiltPaths = [Ebin || A <- Sorted,
29- Ebin <- [rebar_app_info:ebin_dir(A)],
30- not lists:member(Ebin, ToBuildPaths)],
31- code:add_pathsa(PreBuiltPaths),
32-
33- %% Build plugin and its deps
34- build_plugins(ToBuild, Sorted, State2),
35-
36- %% Add newly built deps and plugin to code path
37- State3 = rebar_state:update_all_plugin_deps(State2, Sorted),
38- NewCodePaths = [rebar_app_info:ebin_dir(A) || A <- ToBuild],
39-
40- %% Store plugin code paths so we can remove them when compiling project apps
41- State4 = rebar_state:update_code_paths(State3, all_plugin_deps, PreBuiltPaths++NewCodePaths),
42- rebar_paths:set_paths([plugins], State4),
43-
44- {plugin_providers(Plugin), State4}
45+ {plugin_providers(Plugin), State}
46 catch
47 ?WITH_STACKTRACE(C,T,S)
48 ?DEBUG("~p ~p ~p", [C, T, S]),
49@@ -150,15 +118,6 @@ handle_plugin(Profile, Plugin, State, SrcPlugins, Upgrade) ->
50 {[], State}
51 end.
52
53-build_plugins(MustBuildApps, AllApps, State) ->
54- State1 = rebar_state:deps_to_build(State, MustBuildApps),
55- State2 = rebar_state:all_deps(State1, AllApps),
56- State3 = rebar_state:set(State2, deps_dir, ?DEFAULT_PLUGINS_DIR),
57- {Args, Extra} = rebar_state:command_parsed_args(State),
58- State4 = rebar_state:command_parsed_args(State3, {[{deps_only, true}|Args], Extra}),
59- rebar_prv_compile:do(State4),
60- ok.
61-
62 plugin_providers({Plugin, _, _, _}) when is_atom(Plugin) ->
63 validate_plugin(Plugin);
64 plugin_providers({Plugin, _, _}) when is_atom(Plugin) ->
65@@ -251,15 +210,6 @@ prepare_plugin(AppInfo) ->
66 false -> rebar_app_info:valid(Relocated, undefined) % force revalidation
67 end.
68
69-top_level_deps(State, Apps) ->
70- CurrentProfiles = rebar_state:current_profiles(State),
71- Keys = lists:append([[{plugins, P}, {deps, P}] || P <- CurrentProfiles]),
72- RawDeps = lists:foldl(fun(App, Acc) ->
73- %% Only support the profiles we would with regular plugins?
74- lists:append([rebar_app_info:get(App, Key, []) || Key <- Keys]) ++ Acc
75- end, [], Apps),
76- rebar_utils:tup_dedup(RawDeps).
77-
78 needs_rebuild(AppInfo) ->
79 %% if source files are newer than built files then the code was edited
80 %% and can't be considered valid -- force a rebuild.