Repository navigation
Conversation
|
Thanks for this. Registry operator's view: it fixes a real gap and the approach is the right one. Context from camp (camp-registry.org): every listed subplugin of a third-party parent is published as a Composer package of type Three suggestions, none of which change the approach:
The subplugins.json handling looks right to me for both spellings: |
|
Following up on the requirement mentioned above, so the mapping is on record where HQ can see it. camp's packages.json now links packages to the other camp packages they need: the parent package for a subplugin of a third-party parent, and each This is camp's translation of the author's version.php declaration into Composer's grammar, not a proposal for how plugins should declare things. If HQ defines a convention for this, camp will follow it; the linking pass is behind a switch for that reason. |
|
Thanks for getting back so quickly on this @davidpesce! On the suggestions:
Your point about how you've translated the version.php into composer.json is interesting too, with respect to subplugins. I was once told on the Moodle dev chat by someone at HQ that subplugins should not declare their dependency on the parent plugin as it was already implied. It was years ago and may have changed since then, and I'm not quite sure what the reasoning was - presumably to remove any complications from Moodle's own dependency graph resolver or something like that. Anyway it may be that the composer.json has to diverge from the version.php in that case. |
|
+1 from me, and I'd love to see this merged as soon as possible. I'm already using it. Today I tested this branch on a Moodle site, installing the two subplugins of my VR room activity ( Thanks Michael for the patch. Please merge. |
Hi, this is a patch to add support for subplugins of non-core plugins. The use case I have is this: I have mod_peerwork, and a custom subplugin for it - peerworkcalculator_maemarkcf - and currently there is no way to use composer to build the Moodle codebase with these two plugins as requires. There are various third-party plugins that support subplugins so this is not a one-off case.
The patch basically reads the subplugin types from the subplugins.json file once the parent package has been installed. This is not ideal as it requires
composer installto be run twice but it's literally not possible to support doing it in one go due to the composer architecture. The patch does alert you to this with a message at the end. This seems preferable to not being able to use composer at all in this scenario, and it should be more or less invisible to anyone who doesn't have a subplugin of a non-core plugin. It did however mean changing an unknown package type from a hard fail to a warning.It's probably worth mentioning that running it twice is a fairly normal requirement at the moment due to a common edge case. Where a plugin doesn't declare its dependency on Moodle in its composer.json - and none of the ones I have seen so far do - and the package name is before "moodle/moodle" alphabetically, the package will be installed before Moodle and immediately overwritten. On the second run of
composer installor update the install location is checked and it is re-installed as it's no longer there.A further gotcha along the same lines with the patch is that the subplugin must declare its dependency on the parent plugin otherwise the same sort of thing will happen. If it's alphabetically before the parent plugin then the composer command will need to be run again as the parent plugin's installation will wipe out the subplugin's.
I hope this makes some kind of sense!