Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core, Simulation.Core] Registration: (re)enable deprecation warnings #5155

Merged

Conversation

fredroy
Copy link
Contributor

@fredroy fredroy commented Dec 10, 2024

To enforce the new registration mechanism (#4429 )
This PR:

  • adds compilation deprecation warnings when using RegisterObject
  • adds runtime (user) messages when using deprecated registration mechanism

⚠️ This will throw a lot of warnings on the CI (because of the plugins) so I think the log file will increase dramatically 😅

[ci-depends-on https://github.com/sofa-framework/BeamAdapter/pull/158]
[ci-depends-on https://github.com/sofa-framework/CGALPlugin/pull/20]


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 fredroy added pr: status to review To notify reviewers to review this pull-request pr: clean Cleaning the code deprecated About a deprecated code labels Dec 10, 2024
@fredroy fredroy added this to the v24.12 milestone Dec 10, 2024
@fredroy
Copy link
Contributor Author

fredroy commented Dec 10, 2024

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

@fredroy fredroy added pr: status wip Development in the pull-request is still in progress and removed pr: status to review To notify reviewers to review this pull-request labels Dec 10, 2024
@fredroy fredroy force-pushed the registration_enable_deprecation_warnings branch from b34767b to 4338187 Compare December 10, 2024 03:50
@fredroy fredroy added pr: status to review To notify reviewers to review this pull-request and removed pr: status wip Development in the pull-request is still in progress labels Dec 10, 2024
@fredroy
Copy link
Contributor Author

fredroy commented Dec 10, 2024

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

@sofabot
Copy link
Collaborator

sofabot commented Dec 10, 2024

[ci-depends-on] detected during build #4.

To unlock the merge button, you must

@fredroy fredroy added the pr: based on previous PR PR based on a previous PR, therefore to be merged ONLY subsequently label Dec 10, 2024
@sofa-framework sofa-framework deleted a comment from sofabot Dec 10, 2024
@sofabot
Copy link
Collaborator

sofabot commented Dec 10, 2024

[ci-depends-on] detected during build #5.

To unlock the merge button, you must

@fredroy fredroy force-pushed the registration_enable_deprecation_warnings branch from adffeea to 346459f Compare December 11, 2024 00:37
@sofabot
Copy link
Collaborator

sofabot commented Dec 11, 2024

[ci-depends-on] detected during build #6.

To unlock the merge button, you must

@fredroy fredroy removed the pr: based on previous PR PR based on a previous PR, therefore to be merged ONLY subsequently label Dec 11, 2024
@@ -775,7 +775,7 @@ bool ObjectFactory::registerObjectsFromPlugin(const std::string& pluginName)
// do not register if it was already done before
if(m_registeredPluginSet.count(pluginName) > 0)
{
// msg_warning("ObjectFactory") << pluginName << " has already registered its components.";
msg_warning("ObjectFactory") << pluginName << " has already registered its components.";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This warning is a bit problematic.
It will be displayed if a plugin registers twice (or more) so I felt it could be nice to warn the user somehow.
But in effect, if runSofa uses the "autoloadplugin" feature and the requiredPlugin in the scene, it will try to register twice the components (thus spamming).
Quite problematic as it is quite the default behavior with runSofa...

Should it be removed ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe to keep it commented indeed with an additional comment:

Suggested change
msg_warning("ObjectFactory") << pluginName << " has already registered its components.";
// msg_warning("ObjectFactory") << pluginName << " has already registered its components."; // Warning to re-activate when runSofa will not auto-load modules/plugins anymore

@sofa-framework sofa-framework deleted a comment from sofabot Dec 11, 2024
@fredroy
Copy link
Contributor Author

fredroy commented Dec 11, 2024

The fact that no plugin has been ported is also problematic. Just running runSofa with default flags would already throws some warnings:

...
[INFO]    [PluginManager] Loaded plugin: /Users/fred/Work/sofa/build/sandbox-ninja/lib/libSofa.GUI.Qt.dylib
[INFO]    [PluginManager] Loaded plugin: /Users/fred/Work/sofa/build/sandbox-ninja/lib/libSceneCreator.dylib
[WARNING] [RegisterObject] ArticulatedHierarchyContainer: Implicit object registration is deprecated since v24.12. Check #4429 for more information.
[WARNING] [RegisterObject] ArticulationCenter: Implicit object registration is deprecated since v24.12. Check #4429 for more information.
[WARNING] [RegisterObject] Articulation: Implicit object registration is deprecated since v24.12. Check #4429 for more information.
[WARNING] [RegisterObject] ArticulatedSystemMapping: Implicit object registration is deprecated since v24.12. Check #4429 for more information.
[WARNING] [RegisterObject] ArticulatedHierarchyController: Implicit object registration is deprecated since v24.12. Check #4429 for more information.
[WARNING] [RegisterObject] ArticulatedHierarchyBVHController: Implicit object registration is deprecated since v24.12. Check #4429 for more information.
[INFO]    [PluginManager] Loaded plugin: /Users/fred/Work/sofa/build/sandbox-ninja/lib/libArticulatedSystemPlugin.dylib
[WARNING] [RegisterObject] DataExchange: Implicit object registration is deprecated since v24.12. Check #4429 for more information.
[WARNING] [RegisterObject] MeanComputation: Implicit object registration is deprecated since v24.12. Check #4429 for more information.
[WARNING] [RegisterObject] AnimationLoopParallelScheduler: Implicit object registration is deprecated since v24.12. Check #4429 for more information.
[WARNING] [RegisterObject] ParallelBVHNarrowPhase: Implicit object registration is deprecated since v24.12. Check #4429 for more information.
[WARNING] [RegisterObject] ParallelBruteForceBroadPhase: Implicit object registration is deprecated since v24.12. Check #4429 for more information.
[WARNING] [RegisterObject] ParallelCGLinearSolver: Implicit object registration is deprecated since v24.12. Check #4429 for more information.
[WARNING] [RegisterObject] BeamLinearMapping_mt: Implicit object registration is deprecated since v24.12. Check #4429 for more information.
[WARNING] [RegisterObject] ParallelHexahedronFEMForceField: Implicit object registration is deprecated since v24.12. Check #4429 for more information.
[WARNING] [RegisterObject] ParallelTetrahedronFEMForceField: Implicit object registration is deprecated since v24.12. Check #4429 for more information.
[WARNING] [RegisterObject] ParallelSpringForceField: Implicit object registration is deprecated since v24.12. Check #4429 for more information.
[WARNING] [RegisterObject] ParallelMeshSpringForceField: Implicit object registration is deprecated since v24.12. Check #4429 for more information.
[INFO]    [PluginManager] Loaded plugin: /Users/fred/Work/sofa/build/sandbox-ninja/lib/libMultiThreading.dylib
[WARNING] [RegisterObject] ComplianceMatrixExporter: Implicit object registration is deprecated since v24.12. Check #4429 for more information.
[WARNING] [RegisterObject] GlobalSystemMatrixExporter: Implicit object registration is deprecated since v24.12. Check #4429 for more information.
[WARNING] [RegisterObject] FillReducingOrdering: Implicit object registration is deprecated since v24.12. Check #4429 for more information.
[WARNING] [RegisterObject] ComplianceMatrixImage: Implicit object registration is deprecated since v24.12. Check #4429 for more information.
[WARNING] [RegisterObject] GlobalSystemMatrixImage: Implicit object registration is deprecated since v24.12. Check #4429 for more information.
[INFO]    [PluginManager] Loaded plugin: /Users/fred/Work/sofa/build/sandbox-ninja/lib/libSofaMatrix.dylib
[INFO]    [PluginManager] 72 plugins have been loaded from /Users/fred/Work/sofa/build/sandbox-ninja/lib/plugin_list.conf.default
[INFO]    [SofaPluginManager] Loading automatically plugin list in /Users/fred/Work/sofa/build/sandbox-ninja/config/loadedPlugins.ini
[INFO]    [PluginManager] 0 plugins have been loaded from /Users/fred/Work/sofa/build/sandbox-ninja/config/loadedPlugins.ini

Moreover we have to think that the install version comes with much more plugins as well.... There will be quite a lot of warnings.
And it seems weird to me to ship a version where we allow (lots of) warnings to be thrown 🤔

I guess we should ignore outputting warnings for the moment... (or only in dev mode maybe ?)

@fredroy fredroy added the pr: dev meeting topic PR to be discussed in sofa-dev meeting label Dec 11, 2024
@bakpaul
Copy link
Contributor

bakpaul commented Dec 11, 2024

Messages should be addressed to developer only (using dmsg based on the CMake flag SOFA_WITH_DEVTOOLS)

@sofabot
Copy link
Collaborator

sofabot commented Dec 12, 2024

[ci-depends-on] detected during build #8.

To unlock the merge button, you must

@fredroy fredroy force-pushed the registration_enable_deprecation_warnings branch from a09d4d3 to a822c44 Compare December 17, 2024 07:49
@sofabot
Copy link
Collaborator

sofabot commented Dec 17, 2024

[ci-depends-on] detected during build #9.

To unlock the merge button, you must

@bakpaul
Copy link
Contributor

bakpaul commented Dec 17, 2024

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

@sofabot
Copy link
Collaborator

sofabot commented Dec 17, 2024

[ci-depends-on] detected during build #10.

To unlock the merge button, you must

@hugtalbot hugtalbot added the pr: backport todo This PR will be backported into the release preceeding its milestone. label Dec 17, 2024
@fredroy
Copy link
Contributor Author

fredroy commented Dec 17, 2024

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

@sofabot
Copy link
Collaborator

sofabot commented Dec 17, 2024

[ci-depends-on] detected during build #11.

To unlock the merge button, you must

@hugtalbot hugtalbot removed the pr: dev meeting topic PR to be discussed in sofa-dev meeting label Dec 18, 2024
@fredroy fredroy force-pushed the registration_enable_deprecation_warnings branch from a822c44 to adcd311 Compare December 18, 2024 09:53
@sofabot
Copy link
Collaborator

sofabot commented Dec 18, 2024

[ci-depends-on] detected during build #12.

To unlock the merge button, you must

@bakpaul bakpaul merged commit 4aca268 into sofa-framework:master Dec 18, 2024
10 of 11 checks passed
bakpaul pushed a commit that referenced this pull request Dec 18, 2024
…#5155)

* enable deprecation warnings for RegisterObject

* enable runtime deprecation warnings

* re enable disabled tests

* fix typo

* fix units tests

* expect a warning when loading pluginA

* load plugins once (avoiding registering several times)

* add more info when warning the user of a deprecated registration

* set warnings only if dev mode is enabled (SOFA_WITH_DEVTOOLS enabled)

* apply new mechanism registration to AugmentedLagrangianConstraint
@bakpaul bakpaul added pr: backport done This PR has been backported into the release before its milestone. and removed pr: backport todo This PR will be backported into the release preceeding its milestone. labels Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecated About a deprecated code pr: backport done This PR has been backported into the release before its milestone. pr: clean Cleaning the code pr: status to review To notify reviewers to review this pull-request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants