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
162 stars 86 forks source link

Hotfix/The Correct Bundle Update behavior #602

Closed PengZheng closed 1 year ago

PengZheng commented 1 year ago

This PR implements the correct bundle update behavior when updating from a different bundle location. Previously if the bundle at that location is older than the bundle in cache, bundle extraction will be skipped, which will fail the newly added TEST_F(CelixBundleContextBundlesTestSuite, ForceUpdateUsingBundleFromDifferentLocation). This PR will always update the bundle cache if the external bundle comes from a different location, which is the behavior we advertise in the API documentation.

 * This will do the following:
 *  - unload the bundle with the specified bundle id;
 *  - reload the bundle from the specified location with the specified bundle id;
 *  - start the bundle, if it was previously active.

This PR also improves startup speed when starting with a clean cache. Previously the framework will traverse the cache directory once for each newly installed bundles (with unknown bundle id). celix_bundleCache_updateIdForLocationLookupMap could be invoked by celix_bundleCache_create. But that would lead to unnecessary disk load when the launcher is just used to create bundle cache.

codecov-commenter commented 1 year ago

Codecov Report

Merging #602 (1f68bad) into master (072cba2) will increase coverage by 0.02%. The diff coverage is 96.66%.

:exclamation: Current head 1f68bad differs from pull request most recent head 9a0709b. Consider uploading reports for the commit 9a0709b to get more accurate results

@@            Coverage Diff             @@
##           master     #602      +/-   ##
==========================================
+ Coverage   79.68%   79.70%   +0.02%     
==========================================
  Files         256      256              
  Lines       34686    34686              
==========================================
+ Hits        27640    27647       +7     
+ Misses       7046     7039       -7     
Files Changed Coverage Δ
libs/framework/src/bundle.c 71.94% <0.00%> (+1.17%) :arrow_up:
libs/framework/src/bundle_archive.c 100.00% <100.00%> (ø)
libs/framework/src/celix_bundle_cache.c 98.46% <100.00%> (+0.46%) :arrow_up:
libs/framework/src/framework.c 84.89% <100.00%> (+0.02%) :arrow_up:

... and 2 files with indirect coverage changes

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more