sofa icon indicating copy to clipboard operation
sofa copied to clipboard

[All] POC: ObjectFactory: Explicit components registration

Open fredroy opened this issue 2 years ago • 9 comments

⚠️ Proof-of-concept ⚠️

  • Task #3770

Main goal is to remove the ObjectFactory singleton (later) and the implicit registration of objects while loading dynamic libraries (plugins)

In this PR, the explicit registration is applied on components of Sofa.Component.StateContainer

The legacy RegisterObject mechanism is preserved and will warn the user at the compilation and at run-time.

EDIT:

  • add tests about plugins non-registering/registering implicitly/registering explicitly
  • add deprecations/warnings in RequiredPlugin
  • add a function registerPlugin in PluginManager. This function is simply an alias for loadPlugin() because loadPlugin() does much more than just loading a plugin by itself. In an eventual future, PluginManager should be refactored in a way that loadPlugin calls registerPlugin()

By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

fredroy avatar Jan 12 '24 07:01 fredroy

[ci-build][with-all-tests]

fredroy avatar Jan 15 '24 04:01 fredroy

[ci-build][with-all-tests][force-full-build]

fredroy avatar Jan 15 '24 07:01 fredroy

[ci-build][with-all-tests][force-full-build]

fredroy avatar Jan 16 '24 08:01 fredroy

Maybe some ideas here: https://github.com/sofa-framework/sofa/pull/2712

damienmarchal avatar Jan 17 '24 08:01 damienmarchal

[ci-build][with-all-tests][force-full-build]

fredroy avatar Feb 20 '24 06:02 fredroy

[ci-build][with-all-tests][force-full-build]

fredroy avatar Feb 20 '24 15:02 fredroy

Closing (postponing), several issues detected in this PR

  • PluginManager is not satisfactory
  • meta-modules are not well designed so induced too much complexities

fredroy avatar Feb 28 '24 09:02 fredroy

[ci-build][with-all-tests]

fredroy avatar Jun 12 '24 14:06 fredroy

For @sofa-framework/reviewers : this PR is now ready but it will have a massive impact on all the code base.

Any feedback is more than welcome. A compatibility layer is obviously implemented

We suggest to merge this PR but temporarily de-activating all the warnings (compilation-time and runtime). Another PR will start the cleaning within SOFA and its official plugins. When the main part will be done, warnings will be re-activated so that plugin authors can be informed.

hugtalbot avatar Jul 03 '24 09:07 hugtalbot

[ci-build][with-all-tests][force-full-build]

fredroy avatar Jul 15 '24 01:07 fredroy