Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reset default profile app plugins to empty if at the top level #1885

Merged
merged 1 commit into from
Sep 17, 2018

Conversation

tsloughter
Copy link
Collaborator

top level default profile plugins are installed in the run_aux
function. This commit removes the plugins from the plugin opts
of an application that is also at the top level and skips the
default profile when installing top level plugins in
project_apps_install so they aren't handled twice.

@tsloughter
Copy link
Collaborator Author

This isn't as important since I've realized it still doesn't allow for an override to setup compilation of all mix dependencies.

But it seems to clean some cruft up. There is still an issue with if a plugin is included multiple times, like in the project and then in a dependency, and it is a checkout it will be compiled multiple times.

The only way to resolve that checkout "issue" (it doesn't break anything, is just confusing and slower) I think is to do proper tracking of plugin's AppInfo. Then in handle_plugin we can check if it is already in the list of handled plugins and ignore it.

And I'm fine removing this hack from the PR depending on what you think, lists:usort(Plugins) -- [AppName].

Opts = reset_hooks(rebar_state:opts(State), CurrentProfiles),
State1 = rebar_state:opts(State, Opts),

%% set plugins to empty since this is an app at the top level
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the implied tail of this comment is "since they have been handled in rebar3:run_aux" ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I can add that.

StateAcc1 = handle_plugins(Profile, Plugins, StateAcc),
StateAcc1 = case Profile of
default ->
%% default profile state plugins installed in run_aux
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for all apps or only top-level ones?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, that is what I meant by "state" instead of "app". I can make it clearer.

handle_plugins(Profile, Plugins, StateAcc)
%% hack to keep {add, [{plugins, [<plugin>]}]} from attempting
%% to install the added plugin to itself, resulting in a never
%% ending list of plugins to install
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be interesting to add a warning as well. This would be the only functionality that does this, but it might be good to let people know "this is starting to be dangerous territory" and maybe they can pick which apps they add the plugin to instead.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is being removed, I realized we already are tracking plugin apps. So I can ensure we only do each plugin once instead of doing this.

top level default profile plugins are installed in the run_aux
function. This commit removes the plugins from the plugin opts
of an application that is also at the top level and skips the
default profile when installing top level plugins in
project_apps_install so they aren't handled twice.

Additionally, before handling a plugin the state's list of
known plugin apps is checked and the plugin is skipped if it
has already been handled.
@tsloughter tsloughter merged commit cd858a4 into erlang:master Sep 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants