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

[plug-in] fix circular dependency warnings in plugin system #5886

Merged
merged 1 commit into from
Aug 14, 2019

Conversation

evidolob
Copy link
Contributor

@evidolob evidolob commented Aug 8, 2019

What it does

Fixes circular dependency warnings which appears during webpack build for files in @theia/plugin-ext extension. Also it removes reexport from node folder in common/index.ts file.

How to test

Just build and make sure that build output doesn't contain:

@theia/example-browser:     WARNING in Circular dependency detected:
@theia/example-browser:     ../../packages/plugin-ext/lib/common/index.js -> ../../packages/plugin-ext/lib/plugin/plugin-context.js -> ../../packages/plugin-ext/lib/plugin/quick-open.js -> ../../packages/plugin-ext/lib/common/index.js
@theia/example-browser:
@theia/example-browser:     WARNING in Circular dependency detected:
@theia/example-browser:     ../../packages/plugin-ext/lib/plugin/plugin-context.js -> ../../packages/plugin-ext/lib/plugin/quick-open.js -> ../../packages/plugin-ext/lib/common/index.js -> ../../packages/plugin-ext/lib/plugin/plugin-context.js
@theia/example-browser:
@theia/example-browser:     WARNING in Circular dependency detected:
@theia/example-browser:     ../../packages/plugin-ext/lib/plugin/quick-open.js -> ../../packages/plugin-ext/lib/common/index.js -> ../../packages/plugin-ext/lib/plugin/plugin-context.js -> ../../packages/plugin-ext/lib/plugin/quick-open.js
@theia/example-browser:
@theia/example-browser:     WARNING in Circular dependency detected:
@theia/example-browser:     ../../packages/plugin-ext/lib/plugin/tree/tree-views.js -> ../../packages/plugin-ext/lib/common/index.js -> ../../packages/plugin-ext/lib/plugin/plugin-context.js -> ../../packages/plugin-ext/lib/plugin/tree/tree-views.js

Review checklist

Reminder for reviewers

Signed-off-by: Yevhen Vydolob <yvydolob@redhat.com>
@evidolob evidolob added quality issues related to code and application quality plug-in system issues related to the plug-in system labels Aug 8, 2019
@evidolob evidolob self-assigned this Aug 8, 2019
@kittaakos
Copy link
Contributor

I can confirm, the mentioned cyclic dependency warnings are gone, but I can still see warnings from the plug-ins. Is it known?

@theia/example-electron: WARNING in Circular dependency detected:
1376@theia/example-electron: ../../packages/plugin-ext/lib/hosted/browser/hosted-plugin.js -> ../../packages/plugin-ext/lib/main/browser/main-context.js -> ../../packages/plugin-ext/lib/main/browser/debug/debug-main.js -> ../../packages/plugin-ext/lib/hosted/browser/hosted-plugin.js
1377@theia/example-electron: WARNING in Circular dependency detected:
1378@theia/example-electron: ../../packages/plugin-ext/lib/main/browser/debug/debug-main.js -> ../../packages/plugin-ext/lib/hosted/browser/hosted-plugin.js -> ../../packages/plugin-ext/lib/main/browser/main-context.js -> ../../packages/plugin-ext/lib/main/browser/debug/debug-main.js
1379@theia/example-electron: WARNING in Circular dependency detected:
1380@theia/example-electron: ../../packages/plugin-ext/lib/main/browser/main-context.js -> ../../packages/plugin-ext/lib/main/browser/debug/debug-main.js -> ../../packages/plugin-ext/lib/hosted/browser/hosted-plugin.js -> ../../packages/plugin-ext/lib/main/browser/main-context.js

See the logs on Travis.

@evidolob
Copy link
Contributor Author

evidolob commented Aug 8, 2019

@kittaakos No, maybe I miss that, thx, will take a look

@vince-fugnitto
Copy link
Member

@evidolob I assume it fixes the following issue? #5388

@evidolob
Copy link
Contributor Author

evidolob commented Aug 8, 2019

@vince-fugnitto Yes, that one.

Copy link
Contributor

@vinokurig vinokurig left a comment

Choose a reason for hiding this comment

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

Works for me

@evidolob evidolob requested a review from vinokurig August 9, 2019 06:19
@evidolob
Copy link
Contributor Author

evidolob commented Aug 9, 2019

@kittaakos Now all cyclic dependency warnings in plugin-ext should gone, can you check?

Copy link
Contributor

@vinokurig vinokurig left a comment

Choose a reason for hiding this comment

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

works good for me

Copy link
Member

@azatsarynnyy azatsarynnyy left a comment

Choose a reason for hiding this comment

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

checked and I see no circular dependency in plugin-ext

export type DebugActivationEvent = 'onDebugResolve' | 'onDebugInitialConfigurations' | 'onDebugAdapterProtocolTracker';

export const MainPluginService = Symbol('MainPluginService');
export interface MainPluginService {
Copy link
Member

@akosyakov akosyakov Aug 9, 2019

Choose a reason for hiding this comment

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

Is there a way to avoid boilerplate interfaces and symbols or it is somehow required to break the cycle?

btw i like MainPluginService, it would be good to rename HostedPluginSupport to it and change a file name as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For me no, at least I cannot think up a better solution.

For name, yes I plan to rename everything in plugin-ext with this plan #3871 (comment)

@akosyakov
Copy link
Member

akosyakov commented Aug 9, 2019

I'm actually not sure what is so bad in cyclic dependencies between classes which should be used together. Is there a conceptual reasoning behind breaking such cycle?

Maybe we just should get rid of cycle dependency check? And have better check where we say such module cannot use such module because of such conceptual reasons, like we do for project organization. Current check to me is an artificial constraint.

Otherwise we introduce indirections with interfaces and symbols not clear for that cause? If there is not a real cause let's rather discuss getting rid of a check on next dev meeting?

@evidolob
Copy link
Contributor Author

evidolob commented Aug 9, 2019

I'm actually not sure what is so bad in cyclic dependencies between classes which cannot be used together. Is there a conceptual reasoning behind breaking such cycle?

No, just desire to remove cyclic dependencies warnings.

Maybe we just should get rid of cycle dependency check? And have better check where we say >such module cannot use such module because such conceptual reasons, like we do for project >organization.

Otherwise we introduce indirections with interfaces and symbols not clear for that cause? If there >is not a real cause let's rather discuss getting rid of a check on next dev meeting?

+1 to discuss, we have a lot of cyclic dependencies warnings in core extension either

In general I'm fine with first commit in this PR, but as for second, yes it just refactoring to resolve cyclic dependencies, and introducing new interface is not very good. So I can revert last commit.
And we can discuss what we will do with all cyclic dependencies in project.

@akosyakov
Copy link
Member

@evidolob added to next dev meeting agenda

@akosyakov
Copy link
Member

akosyakov commented Aug 9, 2019

@evidolob first commit is good, it removes a dependency from common to node modules, we want it 👍

@evidolob
Copy link
Contributor Author

evidolob commented Aug 9, 2019

OK, I'm going to delete second commit from this PR

@evidolob evidolob requested a review from a team as a code owner August 13, 2019 08:22
Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

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

i think it is good, index file of common module does not pull nodejs modules anymore

@evidolob evidolob merged commit 3d2d2fd into master Aug 14, 2019
@evidolob evidolob deleted the yv/fix-circular-dependency branch August 14, 2019 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plug-in system issues related to the plug-in system quality issues related to code and application quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants