KCModuleLoader deployment issues
Open, Needs TriagePublic

Description

KCModuleLoader:
Always uses plugins from system, can't really use self-built without deployment

Should allow to query the "right" set of modules based on QT_PLUGIN_PATH or similar stuff.

cullmann created this task.Nov 23 2019, 2:56 PM
alex claimed this task.EditedMay 7 2021, 10:16 AM
alex added a subscriber: alex.

Currently KPluginLoader loader(KPluginLoader::findPlugin(QLatin1String("kcms/") + mod.library())); is called, or were you referring to the old-style code paths?

You also made https://invent.kde.org/frameworks/kcoreaddons/-/merge_requests/84, which goes into the direction of allowing self-built projects without deployment.

D7347 improved the default location inside the build dir of the plugins. But this not very extensively used at the moment, IMHO sth. definitely worth doing.

davidre added a subscriber: davidre.EditedMay 7 2021, 11:37 AM

I think one of the problems was that if you do findPlugins and you have the same kcms in two different directories that are in the search path, the returned list contains both plugins. Now if the using code doesn't manually maintain a list of already instantiated plugin ids, this will cause you to load the same plugin twice. Even worse if you use a QMap or a similiar data structure to store your plugins, you will end up using the most unpreffered version since it comes last in the list.

This was fixed in systemsettings but we also had it at least in ksystemsettings, too. Maybe it would be worth it that KPluginloader to skip plugins with duplicate ids, otherwise every application that wants to load "all" plugins need to do the same. (I believe I saw such code also in other projects)

EDIT: I remembered wrong and the check was only added for view plugins but not kcms since we don't load plugins that way

alex added a comment.May 7 2021, 11:53 AM

I think one of the problems was that if you do findPlugins and you have the same kcms in two different directories that are in the search path, the returned list contains both plugins

I have seen that behavior KPluginSelector, but a replacement for it is already in progress. T12265

Maybe it would be worth it that KPluginloader to skip plugins with duplicate ids, otherwise every application that wants to load "all" plugins need to do the same. (I believe I saw such code also in other projects)

That seems sane.

Actually, I am not sure to which code path I refer, I only know that I wasn't able to ever load my local kscreen kcm module even if QT_PLUGIN_PATH was set to the right path.

alex moved this task from Backlog to In Progress on the KF6 board.May 17 2021, 6:39 PM
alex added a comment.EditedMay 17 2021, 6:47 PM

That seems to work now.

https://invent.kde.org/frameworks/kcoreaddons/-/commit/e99a8eaa0c48b51647feede16ad55a0482eba740 Took care of not returning duplicate plugins, now we can remove all of the hacks in the various usages :)

https://invent.kde.org/frameworks/purpose/commit/a28fab087d599261ef64b2987dcb1c44a35fb80b
https://invent.kde.org/plasma/systemsettings/-/commit/4be765ea365afbda846b968698a59200afc3e623

Krfb, Kate, KMyMoney need to wait for their version being bumped.

The usages in PIM are cleaned up, Laurent did some commits which were identical to https://invent.kde.org/pim/akonadi-import-wizard/-/merge_requests/4

alex moved this task from In Progress to Done on the KF6 board.Jul 11 2021, 4:24 PM

Moving this to done, because it is not actionable on the frameworks side.