rdkcentral / rdkservices

RDK Services
Apache License 2.0
35 stars 389 forks source link

utils.cpp #2319

Closed npoltorapavlo closed 1 year ago

npoltorapavlo commented 2 years ago

Utils violate single responsibility: https://github.com/rdkcentral/rdkservices/blob/sprint/2201/helpers/utils.h https://github.com/rdkcentral/rdkservices/blob/sprint/2201/helpers/utils.cpp

and utils.cpp is built more than once (28 times): https://github.com/rdkcentral/rdkservices/blob/sprint/2201/FrameRate/CMakeLists.txt#L27 https://github.com/rdkcentral/rdkservices/blob/sprint/2201/DataCapture/CMakeLists.txt#L27 ...

To address these issues I've started replacing utils with single purpose headers like: https://github.com/rdkcentral/rdkservices/blob/sprint/2203/helpers/UtilsIarm.h https://github.com/rdkcentral/rdkservices/blob/sprint/2203/helpers/UtilsLogging.h

For example, DataCapture shared object size was reduced from 200036 to 109188 bytes.

There are still 37 rdkservices that use utils.h (28 build utils.cpp).

npoltorapavlo commented 2 years ago

Still tptimer.cpp is built more than once - 6 times, utils.cpp is built more than once - 9 times, powerstate.cpp is built more than once - 4 times, frontpanel.cpp - 2 times, cSettings.cpp - 2 times. cSettings.cpp references utils and needs utils.cpp. frontpanel.cpp references utils and needs utils.cpp. frontpanel.cpp references powerstate and needs powerstate.cpp. utils references many unrelated or uncategorized dependencies: rfcapi, rdk_logger_milestone, telemetry, securityagent, curl. The issue is still not fixed.