Solve potential composer conflicts between the application and plugins #8106
jonasraoni
started this conversation in
Proposals
Replies: 1 comment 1 reply
-
Motivating issues: |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Problem
Some plugins make use of Composer packages, which has the potential of getting in conflict with the packages loaded by the application.
With the presence of multiple Composer autoloaders, the last added one is the first one to be called (in our use case, plugins are the last).
If the plugin requires a package which is also required by the application, then once the plugin registers its autoloader, the plugin's version of the package will be loaded instead of the application one... If there are breaking changes between both versions, the application might be broken unexpectedly (if something has to fail, it should clearly be the plugin).
It would be good to find a solution that doesn't require many workarounds and that works both for official and userland plugins.
Ideas to improve the situation:
prepend-autoloader
setting, will ensure the plugin's autoloader doesn't have a high priority, and decrease the probability of failures.--dev
flag, then we can filter them out when packaging the plugin for release.composer.json
files (https://getcomposer.org/doc/05-repositories.md#path), must be enough to solve conflicts within known submodules (the ones included withinpkp-lib
).composer.json
at the applications' root, which would just incorporate all internalcomposer.json
files. The installation should succeed without conflicts. New builds in OJS/OPS/OMP should trigger the build for the plugins (if not possible, scheduled builds should be enough).Ideas to fix (none of them are acceptable for me):
composer install
(this way the othercomposer.json
files would be included as a dependency) after downloading a plugin. If it fails due to conflicts, then the plugin should be disabled or the user should be warned (is the composer clean enough to be trusted? I remember about prompts to input a GitHub token, which would be a red flag).Beta Was this translation helpful? Give feedback.
All reactions