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

Simplify halo plugin manager #5251

Merged
merged 6 commits into from
Jan 26, 2024

Conversation

JohnNiang
Copy link
Member

What type of PR is this?

/kind improvement
/area core
/area plugin
/milestone 2.12.x

What this PR does / why we need it:

This PR mainly simplifies halo plugin manager. Before this,

  • we have too many repeat code from super class, which is uncessary
  • we maintain plugin application context in ExtensionComponentsFinder, which is uncessary and is hard to manage
  • we fire halo plugin event in halo plugin manager, which is complicated and leads to too many repeat code

This PR does:

  • refactor halo plugin manager
  • wrap base plugin with spring plugin which contains application context
  • remove ExtensionComponentsFinder
  • bridge halo plugin event and spring plugin event
  • wait extensions fully deleted when stopping

Meanwhile, this PR will supersede PR #5236.

Which issue(s) this PR fixes:

Fixes #5226

Special notes for your reviewer:

Test installing, enabing, disabling, upgrading, reloading and deleting plugins.

Does this PR introduce a user-facing change?

None

@JohnNiang JohnNiang requested a review from guqing January 25, 2024 07:23
@f2c-ci-robot f2c-ci-robot bot added the release-note-none Denotes a PR that doesn't merit a release note. label Jan 25, 2024
@f2c-ci-robot f2c-ci-robot bot added this to the 2.12.x milestone Jan 25, 2024
@f2c-ci-robot f2c-ci-robot bot added kind/improvement Categorizes issue or PR as related to a improvement. area/core Issues or PRs related to the Halo Core area/plugin Issues or PRs related to the Plugin Provider labels Jan 25, 2024
@f2c-ci-robot f2c-ci-robot bot requested review from lan-yonghui and LIlGG January 25, 2024 07:24
Copy link

codecov bot commented Jan 25, 2024

Codecov Report

Attention: 342 lines in your changes are missing coverage. Please review.

Comparison is base (3f27f6f) 57.06% compared to head (55d7b54) 57.07%.
Report is 2 commits behind head on main.

Files Patch % Lines
...plugin/DefaultPluginApplicationContextFactory.java 2.22% 176 Missing ⚠️
...rc/main/java/run/halo/app/plugin/SpringPlugin.java 0.00% 30 Missing ⚠️
.../halo/app/plugin/PluginBeforeStopSyncListener.java 4.54% 21 Missing ⚠️
.../halo/app/theme/finders/DefaultFinderRegistry.java 59.52% 15 Missing and 2 partials ⚠️
...va/run/halo/app/plugin/SpringComponentsFinder.java 6.66% 14 Missing ⚠️
...a/run/halo/app/plugin/PluginControllerManager.java 0.00% 13 Missing ⚠️
...main/java/run/halo/app/plugin/DevPluginLoader.java 23.07% 10 Missing ⚠️
...in/java/run/halo/app/plugin/HaloPluginManager.java 75.67% 7 Missing and 2 partials ⚠️
...app/plugin/DefaultSharedEventListenerRegistry.java 36.36% 6 Missing and 1 partial ⚠️
...ava/run/halo/app/plugin/PluginStartedListener.java 0.00% 6 Missing ⚠️
... and 14 more
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5251      +/-   ##
============================================
+ Coverage     57.06%   57.07%   +0.01%     
+ Complexity     3364     3327      -37     
============================================
  Files           585      587       +2     
  Lines         19185    18947     -238     
  Branches       1428     1399      -29     
============================================
- Hits          10947    10814     -133     
+ Misses         7652     7555      -97     
+ Partials        586      578       -8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@guqing guqing left a comment

Choose a reason for hiding this comment

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

/approve

未见异常

@f2c-ci-robot f2c-ci-robot bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 26, 2024
Copy link
Member

@ruibaby ruibaby left a comment

Choose a reason for hiding this comment

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

/lgtm

@f2c-ci-robot f2c-ci-robot bot added the lgtm Indicates that a PR is ready to be merged. label Jan 26, 2024
Copy link

f2c-ci-robot bot commented Jan 26, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: guqing, ruibaby

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@f2c-ci-robot f2c-ci-robot bot merged commit 8288e4e into halo-dev:main Jan 26, 2024
7 checks passed
@JohnNiang JohnNiang deleted the refactor/halo-plugin-manager branch January 26, 2024 09:10
@JohnNiang JohnNiang modified the milestones: 2.12.x, 2.12.0 Jan 28, 2024
f2c-ci-robot bot pushed a commit that referenced this pull request Jan 29, 2024
…scheme (#5271)

#### What type of PR is this?

/kind bug
/area core
/area plugin
/milestone 2.12.0

#### What this PR does / why we need it:

This PR adjusts the order of starting reconcilers in plugin, or it will be stuck in starting synchronizer and no reconcilers will be executed.

The problem may be introduced by <#5251>.

#### Does this PR introduce a user-facing change?

```release-note
None
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/core Issues or PRs related to the Halo Core area/plugin Issues or PRs related to the Plugin Provider kind/improvement Categorizes issue or PR as related to a improvement. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sometimes not to initialize extensions in the plugin properly
3 participants