This is an automated email from the ASF dual-hosted git repository. pnoltes pushed a commit to branch feature/685-refactor-manifest-format in repository https://gitbox.apache.org/repos/asf/celix.git
commit 28ee4a11c428d35a67cbfd5372fdae718a22a1cb Author: Pepijn Noltes <pnol...@apache.org> AuthorDate: Fri Jul 26 18:54:01 2024 +0200 gh-685: Add celix_bundle_getVersion error injection wrapper --- cmake/cmake_celix/templates/MANIFEST.json.in | 2 +- .../error_injector/celix_bundle/CMakeLists.txt | 1 + .../celix_bundle/include/celix_bundle_ei.h | 3 +++ .../celix_bundle/src/celix_bundle_ei.cc | 15 ++++++++++---- libs/utils/include/celix_errno.h | 23 ---------------------- 5 files changed, 16 insertions(+), 28 deletions(-) diff --git a/cmake/cmake_celix/templates/MANIFEST.json.in b/cmake/cmake_celix/templates/MANIFEST.json.in index 8abe223a1..1ebec9df2 100644 --- a/cmake/cmake_celix/templates/MANIFEST.json.in +++ b/cmake/cmake_celix/templates/MANIFEST.json.in @@ -11,4 +11,4 @@ "CELIX_BUNDLE_GROUP" : "$<TARGET_PROPERTY:${BUNDLE_TARGET_NAME},BUNDLE_GROUP>", "CELIX_BUNDLE_IMPORT_LIBRARIES" : "$<JOIN:$<TARGET_PROPERTY:${BUNDLE_TARGET_NAME},BUNDLE_IMPORT_LIBS>,$<COMMA>>", "CELIX_BUNDLE_EXPORT_LIBRARIES" : "$<JOIN:$<TARGET_PROPERTY:${BUNDLE_TARGET_NAME},BUNDLE_EXPORT_LIBS>,$<COMMA>>" -} \ No newline at end of file +} diff --git a/libs/framework/error_injector/celix_bundle/CMakeLists.txt b/libs/framework/error_injector/celix_bundle/CMakeLists.txt index 97eb8e2cb..3b921b210 100644 --- a/libs/framework/error_injector/celix_bundle/CMakeLists.txt +++ b/libs/framework/error_injector/celix_bundle/CMakeLists.txt @@ -24,5 +24,6 @@ target_link_libraries(bundle_ei PRIVATE Celix::framework) target_link_options(bundle_ei INTERFACE LINKER:--wrap,celix_bundle_getSymbolicName LINKER:--wrap,celix_bundle_getManifestValue + LINKER:--wrap,celix_bundle_getVersion ) add_library(Celix::bundle_ei ALIAS bundle_ei) diff --git a/libs/framework/error_injector/celix_bundle/include/celix_bundle_ei.h b/libs/framework/error_injector/celix_bundle/include/celix_bundle_ei.h index 5f8d00710..eac78c27e 100644 --- a/libs/framework/error_injector/celix_bundle/include/celix_bundle_ei.h +++ b/libs/framework/error_injector/celix_bundle/include/celix_bundle_ei.h @@ -23,11 +23,14 @@ extern "C" { #endif #include "celix_error_injector.h" +#include "celix_version_type.h" CELIX_EI_DECLARE(celix_bundle_getSymbolicName, const char*); CELIX_EI_DECLARE(celix_bundle_getManifestValue, const char*); +CELIX_EI_DECLARE(celix_bundle_getVersion, const celix_version_t*); + #ifdef __cplusplus } #endif diff --git a/libs/framework/error_injector/celix_bundle/src/celix_bundle_ei.cc b/libs/framework/error_injector/celix_bundle/src/celix_bundle_ei.cc index e2e04cf89..1aab86c42 100644 --- a/libs/framework/error_injector/celix_bundle/src/celix_bundle_ei.cc +++ b/libs/framework/error_injector/celix_bundle/src/celix_bundle_ei.cc @@ -21,18 +21,25 @@ extern "C" { -const char *__real_celix_bundle_getSymbolicName(const celix_bundle_t *bnd); +const char* __real_celix_bundle_getSymbolicName(const celix_bundle_t* bnd); CELIX_EI_DEFINE(celix_bundle_getSymbolicName, const char*) -const char *__wrap_celix_bundle_getSymbolicName(const celix_bundle_t *bnd) { +const char* __wrap_celix_bundle_getSymbolicName(const celix_bundle_t* bnd) { CELIX_EI_IMPL(celix_bundle_getSymbolicName); return __real_celix_bundle_getSymbolicName(bnd); } -const char *__real_celix_bundle_getManifestValue(const celix_bundle_t *bnd, const char *attribute); +const char* __real_celix_bundle_getManifestValue(const celix_bundle_t* bnd, const char* attribute); CELIX_EI_DEFINE(celix_bundle_getManifestValue, const char*) -const char *__wrap_celix_bundle_getManifestValue(const celix_bundle_t *bnd, const char *attribute) { +const char* __wrap_celix_bundle_getManifestValue(const celix_bundle_t* bnd, const char* attribute) { CELIX_EI_IMPL(celix_bundle_getManifestValue); return __real_celix_bundle_getManifestValue(bnd, attribute); } +const celix_version_t* __real_celix_bundle_getVersion(const celix_bundle_t* bnd); +CELIX_EI_DEFINE(celix_bundle_getVersion, const celix_version_t*) +const celix_version_t* __wrap_celix_bundle_getVersion(const celix_bundle_t* bnd) { + CELIX_EI_IMPL(celix_bundle_getVersion); + return __real_celix_bundle_getVersion(bnd); +} + } diff --git a/libs/utils/include/celix_errno.h b/libs/utils/include/celix_errno.h index dcab62801..15937fc36 100644 --- a/libs/utils/include/celix_errno.h +++ b/libs/utils/include/celix_errno.h @@ -56,18 +56,6 @@ extern "C" { */ #define CELIX_DO_IF(status, expr) ((status) == CELIX_SUCCESS) ? (expr) : (status) -/*! - * Helper macro which helps with error propagation. It evaluates the provided expression that returns a status and - * returns the status if the status is not CELIX_SUCCESS (0). If the status is CELIX_SUCCESS (0) nothing is done. - */ -#define CELIX_EPROP(expr) \ - do { \ - celix_status_t __status = expr; \ - if (__status != CELIX_SUCCESS) { \ - return __status; \ - } \ - } while (0) - /*! * Helper macro which check the current status and executes a goto the provided label if the * status is not CELIX_SUCCESS (0) @@ -79,17 +67,6 @@ extern "C" { } \ } while (0) -/*! - * \defgroup celix_errno Error Codes - * \ingroup framework - * \{ - */ - -struct __attribute__((deprecated("use celix_status_t instead"))) celix_status { - int code; - char *error; -}; - /*! * Status type returned by all functions in Celix */