Plugin load order defined by inter-plugin dependencies
Currently plugins requiring another plugin not yet loaded will cause a hard error, forcing plugin authors to somehow name their plugins to have a name that will be sorted after the names of all the other plugins they rely on in the default sort order (alphabetical I'd guess). See source:/tags/3.3.0/lib/redmine/plugin.rb#L236 for the method to require other plugins, which will throw a hard error on line 251 on
Plugin.find when the plugin hasn't been loaded yet.
This was something handled in ChiliProject, see https://github.com/chiliproject/chiliproject/commit/a24a24eb1980625fbc4558fc44f15498e883d2d9
Would something like that be of interest to Redmine? We could take care of adapting that patch to current Redmine trunk.
#2 Updated by Mischa The Evil about 4 years ago
- Status changed from New to Closed
- Resolution set to Duplicate
#3 Updated by Felix Schäfer about 4 years ago
- Status changed from Closed to Reopened
Thanks, I hadn't seen that one.
This is not the same requirement and solution though, as it is not possible to depend on code in not-yet-loaded plugins with this solution.
Example: Plugin A requires Plugin B and specifically needs
lib/b.rb from that plugin to be require-able, which wouldn't work with the solution in #6324.
The referenced ChiliProject commit allows for this. It is a more generic (and in my opinion better) solution to that problem.
#4 Updated by Michael Krupp about 4 years ago
That is not entirely true. Requiring plugin-external libraries in a
after_initialize block works just fine.