apache / celix

Apache Celix is a framework for C and C++14 to develop dynamic modular software applications using component and in-process service-oriented programming.
https://celix.apache.org/
Apache License 2.0
158 stars 84 forks source link

Feature/87 refactor use services #741

Closed pnoltes closed 3 months ago

pnoltes commented 3 months ago

This PR simplifies the implementation of celix_bundleContext_useService* functions to somewhat reduce the complexity of the framework library.

The updated celix_bundleContext_useService* functions now reuse the celix_bundleContext_trackServices function and celix_bundleContext_useTrackedService* functions, which has several consequences:

In my opinion, these changes are acceptable because the primary, and in my opinion only, use case for the useService* functions/methods is in test code. As a result, this PR also updates the useService* functions/methods documentation to clarify their intended use case. I also think that we do not need to deprecate the useService* functions/methods, ideally they should be moved to a "test-code-only" header but for now I think this is good enough.

Additionally, the usage of celix_bundleContext_useService in the help shell command has been refactored to direct service tracker usage.

codecov-commenter commented 3 months ago

Codecov Report

Attention: Patch coverage is 93.61702% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 89.52%. Comparing base (d46d983) to head (1c4b4de).

Files Patch % Lines
bundles/shell/shell/src/help_command.c 88.88% 2 Missing :warning:
libs/framework/src/bundle_context.c 96.55% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #741 +/- ## ========================================== - Coverage 89.58% 89.52% -0.06% ========================================== Files 216 216 Lines 25413 25379 -34 ========================================== - Hits 22765 22720 -45 - Misses 2648 2659 +11 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.