From f05cda2eff7376ce1d4d92181b42d8df898386e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Ag=C3=BCero?= Date: Thu, 19 Dec 2024 20:43:39 +0100 Subject: [PATCH] Remove deprecations: tock (#2703) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove deprecations: tock Signed-off-by: Carlos Agüero --- Migration.md | 31 ++++++++++++++ include/gz/sim/components/Factory.hh | 55 ------------------------ include/gz/sim/config.hh.in | 6 --- python/src/gz/sim/Joint.cc | 15 ------- src/ComponentFactory_TEST.cc | 63 ---------------------------- 5 files changed, 31 insertions(+), 139 deletions(-) diff --git a/Migration.md b/Migration.md index 4f6632b474..cde80dcc3b 100644 --- a/Migration.md +++ b/Migration.md @@ -5,6 +5,37 @@ Deprecated code produces compile-time warnings. These warning serve as notification to users that their code should be upgraded. The next major release will remove the deprecated code. +## Gazebo Sim 9.x to 10.0 + +### Removals + +- **config.hh**: + + The macro `GZ_SIM_GUI_CONFIG_PATH` has been removed. + Please use `gz::sim::getGUIConfigPath()` instead. + + + The macro `GZ_SIM_SYSTEM_CONFIG_PATH` has been removed. + Please use `gz::sim::getSystemConfigPath()` instead. + + + The macro `GZ_SIM_SERVER_CONFIG_PATH` has been removed. + Please use `gz::sim::getServerConfigPath()` instead. + + + The macro `GZ_SIM_PLUGIN_INSTALL_DIR` has been removed. + Please use `gz::sim::getPluginInstallDir()` instead. + + + The macro `GZ_SIM_GUI_PLUGIN_INSTALL_DIR` has been removed. + Please use `gz::sim::getGUIPluginInstallDir()` instead. + + + The macro `GZ_SIM_WORLD_INSTALL_DIR` has been removed. + Please use `gz::sim::getWorldInstallDir()` instead. + + **components/Factory.hh**: + + `gz::sim::components::Factory::Register(const std::string &_type, ComponentDescriptorBase *_compDesc)` and + `gz::sim::components::Factory::Register(const std::string &_type, ComponentDescriptorBase *_compDesc, RegistrationObjectId _regObjId)` + have been removed. Instead, please use + `gz::sim::components::Factory::Register(const char *_type, ComponentDescriptorBase *_compDesc, RegistrationObjectId _regObjId)` + + `gz::sim::components::Factory::Unregister()` has been removed. Instead, please use + `gz::sim::components::Factory::Unregister(RegistrationObjectId _regObjId)`. + ## Gazebo Sim 8.x to 9.0 * **Modified**: diff --git a/include/gz/sim/components/Factory.hh b/include/gz/sim/components/Factory.hh index afe139f33d..85a5bf62a0 100644 --- a/include/gz/sim/components/Factory.hh +++ b/include/gz/sim/components/Factory.hh @@ -205,39 +205,6 @@ namespace components /// \brief Get an instance of the singleton public: GZ_SIM_VISIBLE static Factory *Instance(); - /// \brief Register a component so that the factory can create instances - /// of the component based on an ID. - /// \param[in] _type Type of component to register. - /// \param[in] _compDesc Object to manage the creation of ComponentTypeT - /// objects. - /// \tparam ComponentTypeT Type of component to register. - // Deprecated in favor of overload that takes _regObjId - public: template - void GZ_DEPRECATED(8) Register(const std::string &_type, - ComponentDescriptorBase *_compDesc) - { - const char* typeDup = strdup(_type.c_str()); - this->Register(typeDup, _compDesc, - RegistrationObjectId{nullptr}); - } - /// \brief Register a component so that the factory can create instances - /// of the component based on an ID. - /// \param[in] _type Type of component to register. - /// \param[in] _compDesc Object to manage the creation of ComponentTypeT - /// objects. - /// \param[in] _regObjId An ID that identifies the registration object. This - /// is generally derived from the `this` pointer of the static component - /// registration object created when calling GZ_SIM_REGISTER_COMPONENT. - /// \tparam ComponentTypeT Type of component to register. - // Deprecated in favor of overload that takes `const char *_type` - public: template - void GZ_DEPRECATED(8) Register(const std::string &_type, - ComponentDescriptorBase *_compDesc, RegistrationObjectId _regObjId) - { - const char* typeDup = strdup(_type.c_str()); - this->Register(typeDup, _compDesc, _regObjId); - } - /// \brief Register a component so that the factory can create instances /// of the component based on an ID. /// \param[in] _type Type of component to register. @@ -295,16 +262,6 @@ namespace components runtimeNamesById[ComponentTypeT::typeId] = runtimeName; } - /// \brief Unregister a component so that the factory can't create instances - /// of the component anymore. - /// \tparam ComponentTypeT Type of component to unregister. - // Deprecated in favor of overload that takes _regObjId - public: template - void GZ_DEPRECATED(8) Unregister() - { - this->Unregister(RegistrationObjectId{nullptr}); - } - /// \brief Unregister a component so that the factory can't create instances /// of the component anymore. /// \tparam ComponentTypeT Type of component to unregister. @@ -317,18 +274,6 @@ namespace components this->Unregister(ComponentTypeT::typeId, _regObjId); } - /// \brief Unregister a component so that the factory can't create instances - /// of the component anymore. - /// \details This function will not reset the `typeId` static variable - /// within the component type itself. Prefer using the templated - /// `Unregister` function when possible. - /// \param[in] _typeId Type of component to unregister. - // Deprecated in favor of overload that takes _regObjId - public: void GZ_DEPRECATED(8) Unregister(ComponentTypeId _typeId) - { - this->Unregister(_typeId, RegistrationObjectId{nullptr}); - } - /// \brief Unregister a component so that the factory can't create instances /// of the component anymore. /// \details This function will not reset the `typeId` static variable diff --git a/include/gz/sim/config.hh.in b/include/gz/sim/config.hh.in index a13b62aa1e..87cca7d178 100644 --- a/include/gz/sim/config.hh.in +++ b/include/gz/sim/config.hh.in @@ -33,12 +33,6 @@ #define GZ_SIM_VERSION_HEADER "Gazebo Sim, version ${PROJECT_VERSION_FULL}\nCopyright (C) 2018 Open Source Robotics Foundation.\nReleased under the Apache 2.0 License.\n\n" -#define GZ_SIM_GUI_CONFIG_PATH _Pragma ("GCC warning \"'GZ_SIM_GUI_CONFIG_PATH' macro is deprecated, use gz::sim::getGUIConfigPath() function instead. \"") "${CMAKE_INSTALL_PREFIX}/${GZ_DATA_INSTALL_DIR}/gui" -#define GZ_SIM_SYSTEM_CONFIG_PATH _Pragma ("GCC warning \"'GZ_SIM_SYSTEM_CONFIG_PATH' macro is deprecated, use gz::sim::getSystemConfigPath() function instead. \"") "${CMAKE_INSTALL_PREFIX}/${GZ_DATA_INSTALL_DIR}/systems" -#define GZ_SIM_SERVER_CONFIG_PATH _Pragma ("GCC warning \"'GZ_SIM_SERVER_CONFIG_PATH' macro is deprecated, use gz::sim::getServerConfigPath() function instead. \"") "${CMAKE_INSTALL_PREFIX}/${GZ_DATA_INSTALL_DIR}" -#define GZ_SIM_PLUGIN_INSTALL_DIR _Pragma ("GCC warning \"'GZ_SIM_PLUGIN_INSTALL_DIR' macro is deprecated, use gz::sim::getPluginInstallDir() function instead. \"") "${CMAKE_INSTALL_PREFIX}/${GZ_LIB_INSTALL_DIR}/gz-${GZ_DESIGNATION}-${PROJECT_VERSION_MAJOR}/plugins" -#define GZ_SIM_GUI_PLUGIN_INSTALL_DIR _Pragma ("GCC warning \"'GZ_SIM_GUI_PLUGIN_INSTALL_DIR' macro is deprecated, use gz::sim::getGUIPluginInstallDir() function instead. \"") "${CMAKE_INSTALL_PREFIX}/${GZ_LIB_INSTALL_DIR}/gz-${GZ_DESIGNATION}-${PROJECT_VERSION_MAJOR}/plugins/gui" -#define GZ_SIM_WORLD_INSTALL_DIR _Pragma ("GCC warning \"'GZ_SIM_WORLD_INSTALL_DIR' macro is deprecated, use gz::sim::getWorldInstallDir() function instead. \"") "${CMAKE_INSTALL_PREFIX}/${GZ_DATA_INSTALL_DIR}/worlds" #define GZ_DISTRIBUTION "${GZ_DISTRIBUTION}" #endif diff --git a/python/src/gz/sim/Joint.cc b/python/src/gz/sim/Joint.cc index 328e4d51cf..88c8f95860 100644 --- a/python/src/gz/sim/Joint.cc +++ b/python/src/gz/sim/Joint.cc @@ -94,21 +94,6 @@ void defineSimJoint(py::object module) py::arg("ecm"), py::arg("limits"), "Set the effort limits on a joint axis.") - .def("set_position_imits", - [](pybind11::object &self, EntityComponentManager &_ecm, - const std::vector &_limits) - { - auto warnings = pybind11::module::import("warnings"); - auto builtins = pybind11::module::import("builtins"); - warnings.attr("warn")( - "set_position_imits() is deprecated, use set_position_limits() instead.", - builtins.attr("DeprecationWarning")); - - return self.attr("set_position_limits")(_ecm, _limits); - }, - py::arg("ecm"), - py::arg("limits"), - "Set the position limits on a joint axis.") .def("set_position_limits", &gz::sim::Joint::SetPositionLimits, py::arg("ecm"), py::arg("limits"), diff --git a/src/ComponentFactory_TEST.cc b/src/ComponentFactory_TEST.cc index a08d1a88c2..c36cabedda 100644 --- a/src/ComponentFactory_TEST.cc +++ b/src/ComponentFactory_TEST.cc @@ -94,69 +94,6 @@ TEST_F(ComponentFactoryTest, Register) EXPECT_EQ(registeredCount + 1, ids.size()); } -///////////////////////////////////////////////// -TEST_F(ComponentFactoryTest, DeprecatedRegister) -{ - auto factory = components::Factory::Instance(); - - // Create a custom component. - using MyDeprecatedCustom = - components::Component; - - // Check it has no type id yet - EXPECT_EQ(0u, MyDeprecatedCustom::typeId); - EXPECT_EQ(nullptr, MyDeprecatedCustom::typeName); - EXPECT_EQ("", factory->Name(MyDeprecatedCustom::typeId)); - - // Store number of registered component types - auto registeredCount = factory->TypeIds().size(); - -GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION - factory->Register("gz_sim_components.MyDeprecatedCustom", - new components::ComponentDescriptor()); -GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION - - // Check now it has type id - EXPECT_NE(0u, MyDeprecatedCustom::typeId); - EXPECT_STREQ("gz_sim_components.MyDeprecatedCustom", - MyDeprecatedCustom::typeName); - EXPECT_EQ("gz_sim_components.MyDeprecatedCustom", - factory->Name(MyDeprecatedCustom::typeId)); - - // Check factory knows id - auto ids = factory->TypeIds(); - EXPECT_EQ(registeredCount + 1, ids.size()); - EXPECT_NE(ids.end(), - std::find(ids.begin(), ids.end(), MyDeprecatedCustom::typeId)); - - // Registering the component twice doesn't change the number of type ids. -GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION - factory->Register("gz_sim_components.MyDeprecatedCustom", - new components::ComponentDescriptor()); -GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION - - EXPECT_EQ(registeredCount + 1, factory->TypeIds().size()); - - // Fail to register 2 components with same name - using Duplicate = components::Component; - -GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION - factory->Register("gz_sim_components.MyDeprecatedCustom", - new components::ComponentDescriptor()); -GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION - - EXPECT_EQ(registeredCount + 1, factory->TypeIds().size()); - - // Unregister -GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION - factory->Unregister(); -GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION - - ids = factory->TypeIds(); - EXPECT_EQ(registeredCount + 1, ids.size()); -} - ///////////////////////////////////////////////// TEST_F(ComponentFactoryTest, New) {