-
Notifications
You must be signed in to change notification settings - Fork 89
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
Feature/685 refactor manifest format #765
base: master
Are you sure you want to change the base?
Conversation
… some usage of deprecated api
…r-manifest-format
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #765 +/- ##
==========================================
+ Coverage 90.27% 90.77% +0.50%
==========================================
Files 226 226
Lines 26323 26604 +281
==========================================
+ Hits 23762 24149 +387
+ Misses 2561 2455 -106 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another nice cleanup of the module layer! I am glab to see the reduction of LOC.
Overall LGTM. There are only some minor issues that need fixing.
I also left some remarks about some further cleanup, which may or may not happen within this PR.
libs/utils/include/celix_err.h
Outdated
@@ -94,6 +94,28 @@ CELIX_UTILS_EXPORT void celix_err_printErrors(FILE* stream, const char* prefix, | |||
*/ | |||
CELIX_UTILS_EXPORT int celix_err_dump(char* buf, size_t size, const char* prefix, const char* postfix); | |||
|
|||
/*! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the two macros, which represent a very specific error handling style, does not belong to celix_err.h
. Moreover, including them makes celix_err.h
not self-contained any longer (missing errno.h
).
Or we include celix_errno.h
, or we have a dedicate header including all these error handling macros.
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed that all usages of these macro are within celix_bundle_manifest.c. If we remove unnecessary duplication of manifest information (see below for more detail), then all these usages are not needed any more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The marcro were in the wrong header, but will now be removed with the changes for #765 (comment)
libs/utils/include/celix_err.h
Outdated
do { \ | ||
if ((arg) == NULL) { \ | ||
celix_err_pushf("%s: Out of memory", __func__); \ | ||
return status; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return status; \ | |
return ENOMEM; \ |
Otherwise, all usages of this macros are incorrect.
@@ -450,7 +450,8 @@ CELIX_UTILS_EXPORT const celix_version_t* celix_properties_getVersion(const celi | |||
* @brief Get a value of a property as a copied Celix version. | |||
* | |||
* If the property value is a Celix version, a copy of the found version will be returned. | |||
* If the property value is a string, this function will attempt to convert it to a new Celix version. | |||
* If the property value is present, but not a Celix version, this function will attempt to convert the property value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a test case for non-string value type.
|
||
#include "bundle_context.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why include itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed self include
libs/framework/src/bundle.c
Outdated
} | ||
celix_status_t bundle_createModule(bundle_pt bundle, celix_module_t** moduleOut) { | ||
celix_status_t status = CELIX_SUCCESS; | ||
long bundleId = celix_bundle_getId(bundle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice cleanup
char* symbolicName; | ||
char* group; | ||
char* name; | ||
char* description; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice cleanup.
libs/framework/src/module.c
Outdated
|
||
manifestParser_destroy(mp); | ||
} | ||
celix_module_t* module_createFrameworkModule(celix_framework_t* fw, bundle_pt bundle) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems identical to module_create
so that we can combine them into one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nicely spotted, I had not yet noticed that. Removed createFrameworkModule
.
activator = manifest_getValue(manifest, CELIX_FRAMEWORK_BUNDLE_ACTIVATOR); | ||
|
||
if (exportLibraries != NULL) { | ||
status = CELIX_DO_IF(status, celix_module_loadLibrariesInManifestEntry(module, exportLibraries, activator, archive, &activatorHandle)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we remove this and that we have already concluded export library does not work for C/C++, shall we remove it together with corresponding documentation and cmake commands?
>$<$<BOOL:$<TARGET_PROPERTY:${BUNDLE_TARGET_NAME},BUNDLE_HEADERS>>:$<COMMA>> | ||
"CELIX_BUNDLE_MANIFEST_VERSION" : "2.0.0", | ||
"CELIX_BUNDLE_SYMBOLIC_NAME" : "$<TARGET_PROPERTY:${BUNDLE_TARGET_NAME},BUNDLE_SYMBOLIC_NAME>", | ||
"CELIX_BUNDLE_VERSION" : "$<TARGET_PROPERTY:${BUNDLE_TARGET_NAME},BUNDLE_VERSION>", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make strict typing work, this need to be a version string (celix_properties_isVersionString
).
{ | ||
$<JOIN:$<TARGET_PROPERTY:${BUNDLE_TARGET_NAME},BUNDLE_HEADERS>,$<COMMA> | ||
>$<$<BOOL:$<TARGET_PROPERTY:${BUNDLE_TARGET_NAME},BUNDLE_HEADERS>>:$<COMMA>> | ||
"CELIX_BUNDLE_MANIFEST_VERSION" : "2.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to be a version string.
I’ve been busy with other commitments, but I plan to pick this up again in the coming weeks. Thanks for the patience! |
I updated the PR and processed al comments, except the remark that the revision can be removed. That last one I would like to do in separate PR. |
Refactor Manifest Format to JSON
This PR refactors the MANIFEST format to JSON. Consequently, the custom manifest parsing is removed, and the properties JSON format is now used.
Additional Changes
This PR has grown considerably larger than initially intended due to the following additional changes:
src
directory, and deprecated code that was no longer used has been removed. This cleanup primarily focused on bundle and module api.Manifest Attribute Definitions
celix_constants.h
. Instead, they are private defines within the bundle manifest source file.CMake Function Names
The CMake function
celix_bundle_headers
remains unchanged, ensuring no breaking changes. i.e.:still works.
This is the same approach was done for the container config properties (e.g.,
celix_container_runtime_properties
andcelix_container_embedded_properties
are backwards compatible). However, becausecelix_bundle_headers
is not as heavily used, it might be beneficial to introduce a new CMake function that accepts separated arguments for attribute names and values, such as:Bundle Packaging
jar
if thejar
executable is available. This was beneficial for ensuring the MANIFEST.MF file was the first file in the zip.jar
to package a bundle, but we could also drop jar support.Future Work
After this PR is merged, my plan is to continue with #509 by:
src
directory.In a subsequent pull request, the remote services implementation will be refactored to remove the usage of the remaining deprecated APIs.