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

#1309: Improve plugin managment #229

Merged
merged 31 commits into from
May 27, 2024

Conversation

diiinesh
Copy link
Contributor

@diiinesh diiinesh commented Feb 26, 2024

Solves devonfw/ide#1309
Improves plugin managment by solving the error of installing duplicate plugins

@diiinesh diiinesh self-assigned this Feb 26, 2024
@coveralls
Copy link
Collaborator

coveralls commented Feb 26, 2024

Pull Request Test Coverage Report for Build 9221194472

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 20 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.09%) to 59.627%

Files with Coverage Reduction New Missed Lines %
com/devonfw/tools/ide/tool/PluginBasedCommandlet.java 20 44.71%
Totals Coverage Status
Change from base Build 9210541439: 0.09%
Covered Lines: 4670
Relevant Lines: 7545

💛 - Coveralls

@diiinesh diiinesh marked this pull request as ready for review March 1, 2024 08:53
@tobka777 tobka777 assigned mvomiero and unassigned diiinesh Mar 1, 2024
Copy link
Contributor

@mvomiero mvomiero left a comment

Choose a reason for hiding this comment

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

except the unused import and maybe the refactoring for the assert(), LGTM :)

@mvomiero mvomiero assigned diiinesh and unassigned mvomiero Mar 11, 2024
@diiinesh diiinesh marked this pull request as draft March 15, 2024 15:08
@diiinesh
Copy link
Contributor Author

diiinesh commented Apr 19, 2024

After reviewing and analyzing issue devonfw/ide#1309, I found that the issue of duplicate plugins, caused by not properly removing the plugins folder after every tool update, does not exist in IDEasy.
In IDEasy, the plugin folder is removed correctly, and the plugins are reinstalled automatically.

This behavior has been thoroughly tested for both Eclipse and IntelliJ.

Additionally, I have made modifications to PluginBasedCommandlet.java. These modifications introduce two PluginMaps: one with plugin IDs as keys and another with plugin names as keys.
The function getPlugin was adjusted to make it possible to look for a plugin either using id or name as the argument.

@diiinesh diiinesh marked this pull request as ready for review April 19, 2024 11:52
@diiinesh diiinesh assigned mvomiero and unassigned diiinesh Apr 19, 2024
Copy link
Contributor

@mvomiero mvomiero left a comment

Choose a reason for hiding this comment

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

Thank you for your implementation, LGTM 🌹

@mvomiero mvomiero assigned diiinesh and hohwille and unassigned mvomiero Apr 22, 2024
Copy link
Member

@hohwille hohwille left a comment

Choose a reason for hiding this comment

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

@diiinesh thanks for your rework, improvements and testing on this feature.
I took your approach further to encapsulate the plugin mapping into the new PluginMaps class. See my review comments with the suggested code-changes.
The JUnit would still need adoption that I can not do reliably in the browser.

After all I am thinking that we might have over-complicated things with adding the additional by-id map:

  • some plugins may not even have an ID but that is covered in the code
  • eclipse plugin ID is a comma separated list of feature IDs. In case you have more than one feature overriding can become problematic: If you want to override the plugin configuration but want to have a more or less features, the plugin ID will change and therefore you are not technically overriding things even if you pick the same filename «plugin».properties. Therefore it is impossible to reduce the number of features but only add more features.
    Maybe always using the mapByName for getPlugins() would be a better solution...

diiinesh and others added 10 commits April 30, 2024 10:36
Co-authored-by: Jörg Hohwiller <hohwille@users.noreply.github.com>
…dlet.java

Co-authored-by: Jörg Hohwiller <hohwille@users.noreply.github.com>
…dlet.java

Co-authored-by: Jörg Hohwiller <hohwille@users.noreply.github.com>
…ment

# Conflicts:
#	cli/src/main/java/com/devonfw/tools/ide/tool/PluginBasedCommandlet.java
#	cli/src/test/java/com/devonfw/tools/ide/tool/PluginBasedCommandletTest.java
…ement' into Enhancement/improve_plugin_management
…ement' into Enhancement/improve_plugin_management

# Conflicts:
#	cli/src/main/java/com/devonfw/tools/ide/tool/PluginBasedCommandlet.java
#	cli/src/test/java/com/devonfw/tools/ide/tool/PluginBasedCommandletTest.java
@hohwille
Copy link
Member

@diiinesh there are test errors:

[ERROR] com.devonfw.tools.ide.commandlet.UpdateCommandletTest.testRunPullSettingsAndUpdateSoftware -- Time elapsed: 0.032 s <<< ERROR!
java.lang.NullPointerException: Cannot invoke "com.devonfw.tools.ide.tool.PluginMaps.getPlugins()" because "this.pluginsMap" is null
	at com.devonfw.tools.ide.tool.PluginBasedCommandlet.doInstall(PluginBasedCommandlet.java:158)

Please have a look. Thanks.

Copy link
Member

@hohwille hohwille left a comment

Choose a reason for hiding this comment

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

@diiinesh thanks for the update. You finally nailed it 👍

@hohwille hohwille merged commit 998ef92 into devonfw:main May 27, 2024
4 checks passed
@hohwille hohwille added this to the release:2024.05.001 milestone May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

4 participants