c594a97518
GitOrigin-RevId: 301aada7a64812853f2e2634a530ef5d34505048
80 lines
3.8 KiB
Diff
80 lines
3.8 KiB
Diff
diff --git a/apps/rebar/src/rebar_plugins.erl b/apps/rebar/src/rebar_plugins.erl
|
|
index cd5f377c..469be42e 100644
|
|
--- a/apps/rebar/src/rebar_plugins.erl
|
|
+++ b/apps/rebar/src/rebar_plugins.erl
|
|
@@ -108,41 +108,9 @@ handle_plugins(Profile, Plugins, State, Upgrade) ->
|
|
State3 = rebar_state:set(State2, deps_dir, DepsDir),
|
|
rebar_state:lock(State3, Locks).
|
|
|
|
-handle_plugin(Profile, Plugin, State, SrcPlugins, Upgrade) ->
|
|
+handle_plugin(_Profile, Plugin, State, _SrcPlugins, _Upgrade) ->
|
|
try
|
|
- %% Inject top-level src plugins as project apps, so that they get skipped
|
|
- %% by the installation as already seen
|
|
- ProjectApps = rebar_state:project_apps(State),
|
|
- State0 = rebar_state:project_apps(State, SrcPlugins),
|
|
- %% We however have to pick the deps of top-level apps and promote them
|
|
- %% directly to make sure they are installed if they were not also at the top level
|
|
- TopDeps = top_level_deps(State, SrcPlugins),
|
|
- %% Install the plugins
|
|
- {Apps, State1} = rebar_prv_install_deps:handle_deps_as_profile(Profile, State0, [Plugin|TopDeps], Upgrade),
|
|
- {no_cycle, Sorted} = rebar_prv_install_deps:find_cycles(SrcPlugins++Apps),
|
|
- ToBuild = rebar_prv_install_deps:cull_compile(Sorted, []),
|
|
- %% Return things to normal
|
|
- State2 = rebar_state:project_apps(State1, ProjectApps),
|
|
-
|
|
- %% Add already built plugin deps to the code path
|
|
- ToBuildPaths = [rebar_app_info:ebin_dir(A) || A <- ToBuild],
|
|
- PreBuiltPaths = [Ebin || A <- Sorted,
|
|
- Ebin <- [rebar_app_info:ebin_dir(A)],
|
|
- not lists:member(Ebin, ToBuildPaths)],
|
|
- code:add_pathsa(PreBuiltPaths),
|
|
-
|
|
- %% Build plugin and its deps
|
|
- build_plugins(ToBuild, Sorted, State2),
|
|
-
|
|
- %% Add newly built deps and plugin to code path
|
|
- State3 = rebar_state:update_all_plugin_deps(State2, Sorted),
|
|
- NewCodePaths = [rebar_app_info:ebin_dir(A) || A <- ToBuild],
|
|
-
|
|
- %% Store plugin code paths so we can remove them when compiling project apps
|
|
- State4 = rebar_state:update_code_paths(State3, all_plugin_deps, PreBuiltPaths++NewCodePaths),
|
|
- rebar_paths:set_paths([plugins], State4),
|
|
-
|
|
- {plugin_providers(Plugin), State4}
|
|
+ {plugin_providers(Plugin), State}
|
|
catch
|
|
?WITH_STACKTRACE(C,T,S)
|
|
?DEBUG("~p ~p ~p", [C, T, S]),
|
|
@@ -150,15 +118,6 @@ handle_plugin(Profile, Plugin, State, SrcPlugins, Upgrade) ->
|
|
{[], State}
|
|
end.
|
|
|
|
-build_plugins(MustBuildApps, AllApps, State) ->
|
|
- State1 = rebar_state:deps_to_build(State, MustBuildApps),
|
|
- State2 = rebar_state:all_deps(State1, AllApps),
|
|
- State3 = rebar_state:set(State2, deps_dir, ?DEFAULT_PLUGINS_DIR),
|
|
- {Args, Extra} = rebar_state:command_parsed_args(State),
|
|
- State4 = rebar_state:command_parsed_args(State3, {[{deps_only, true}|Args], Extra}),
|
|
- rebar_prv_compile:do(State4),
|
|
- ok.
|
|
-
|
|
plugin_providers({Plugin, _, _, _}) when is_atom(Plugin) ->
|
|
validate_plugin(Plugin);
|
|
plugin_providers({Plugin, _, _}) when is_atom(Plugin) ->
|
|
@@ -251,15 +210,6 @@ prepare_plugin(AppInfo) ->
|
|
false -> rebar_app_info:valid(Relocated, undefined) % force revalidation
|
|
end.
|
|
|
|
-top_level_deps(State, Apps) ->
|
|
- CurrentProfiles = rebar_state:current_profiles(State),
|
|
- Keys = lists:append([[{plugins, P}, {deps, P}] || P <- CurrentProfiles]),
|
|
- RawDeps = lists:foldl(fun(App, Acc) ->
|
|
- %% Only support the profiles we would with regular plugins?
|
|
- lists:append([rebar_app_info:get(App, Key, []) || Key <- Keys]) ++ Acc
|
|
- end, [], Apps),
|
|
- rebar_utils:tup_dedup(RawDeps).
|
|
-
|
|
needs_rebuild(AppInfo) ->
|
|
%% if source files are newer than built files then the code was edited
|
|
%% and can't be considered valid -- force a rebuild.
|