Skip to content
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

Bundle resource bug fixes #1026

Closed

Conversation

al-sabr
Copy link

@al-sabr al-sabr commented Jul 22, 2024

Due to this thread I corrected the code so that it works.

#1025

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@@ -159,20 +159,20 @@ namespace cppmicroservices
return;
}

for (++iter; iter != m_SortedEntries.end(); ++iter)
for (iter=iter; iter != m_SortedEntries.end(); iter++)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: explicitly assigning value of variable of type 'iterator' (aka '_Rb_tree_const_iterator<std::pair<std::basic_string, int>>') to itself [clang-diagnostic-self-assign-overloaded]

        for (iter=iter; iter != m_SortedEntries.end(); iter++)
                 ^

@jeffdiclemente
Copy link
Member

These changes appear to be trying to work around a problem with a malformed or incorrectly built bundle.

@al-sabr
Copy link
Author

al-sabr commented Jul 24, 2024

These changes appear to be trying to work around a problem with a malformed or incorrectly built bundle.

The resource compile creates a default folder named resources-plugin and puts in it the manifest.json file. which is not made by me. I found it weird that the manifest.json is not in the root path of the zip file. And because of that the whole code with normalization is broken due to the path never found inside of the zip file

@al-sabr
Copy link
Author

al-sabr commented Jul 24, 2024

These changes appear to be trying to work around a problem with a malformed or incorrectly built bundle.

The resource compile creates a default folder named resources-plugin and puts in it the manifest.json file. which is not made by me. I found it weird that the manifest.json is not in the root path of the zip file. And because of that the whole code with normalization is broken due to the path never found inside of the zip file

[build] using compression level 6
[build] Initializing zip archive /mnt/dev/c++/bismika/bundles/resources-plugin/manifest.zip ...
[build] concatenated (pre-validated) json:
[build] {
[build] 	"bundle.activator" : true,
[build] 	"bundle.description" : "This bundle is a dummy resources container.",
[build] 	"bundle.name" : "Service Time SystemClock",
[build] 	"bundle.symbolic_name" : "resources-plugin",
[build] 	"bundle.version" : "1.0.0",
[build] 	"service-component" : true
[build] }
[build] 
[build] final (validated) manifest.json:
[build] {
[build] 	"bundle.activator" : true,
[build] 	"bundle.description" : "This bundle is a dummy resources container.",
[build] 	"bundle.name" : "Service Time SystemClock",
[build] 	"bundle.symbolic_name" : "resources-plugin",
[build] 	"bundle.version" : "1.0.0",
[build] 	"service-component" : true
[build] }
[build] 
[build] Adding file resources_plugin/manifest.json ...
[build] 	 new dir entry resources_plugin/
[build] Merging zip file /mnt/dev/c++/bismika/index.zip ... 
[build] 	merging: assets/ (from /mnt/dev/c++/bismika/index.zip) 
[build] 	 new dir entry assets/
[build] 	merging: assets/logo.png (from /mnt/dev/c++/bismika/index.zip) 
[build] 	merging: src/ (from /mnt/dev/c++/bismika/index.zip) 
[build] 	 new dir entry src/
[build] 	merging: src/index.html (from /mnt/dev/c++/bismika/index.zip) 
[build] 	merging: src/index.js (from /mnt/dev/c++/bismika/index.zip) 
[build] 	merging: style/ (from /mnt/dev/c++/bismika/index.zip) 
[build] 	 new dir entry style/
[build] 	merging: style/style.css (from /mnt/dev/c++/bismika/index.zip) 
[build] Finished merging files from /mnt/dev/c++/bismika/index.zip
[build] Finalizing the zip archive ...
[build] Archive has the following files
[build] 	 assets/logo.png
[build] 	 resources_plugin/manifest.json
[build] 	 src/index.html
[build] 	 src/index.js
[build] 	 style/style.css
[build] and directory entries
[build] 	 assets/
[build] 	 resources_plugin/
[build] 	 src/
[build] 	 style/
[build] using compression level 6
[build] Validating manifests in /mnt/dev/c++/bismika/bundles/resources-plugin/manifest.zip ... 
[build] 	Validating: resources_plugin/manifest.json (from /mnt/dev/c++/bismika/bundles/resources-plugin/manifest.zip) 
[build] 	Validating: resources_plugin/ (from /mnt/dev/c++/bismika/bundles/resources-plugin/manifest.zip) 
[build] 	Validating: assets/ (from /mnt/dev/c++/bismika/bundles/resources-plugin/manifest.zip) 
[build] 	Validating: assets/logo.png (from /mnt/dev/c++/bismika/bundles/resources-plugin/manifest.zip) 
[build] 	Validating: src/ (from /mnt/dev/c++/bismika/bundles/resources-plugin/manifest.zip) 
[build] 	Validating: src/index.html (from /mnt/dev/c++/bismika/bundles/resources-plugin/manifest.zip) 
[build] 	Validating: src/index.js (from /mnt/dev/c++/bismika/bundles/resources-plugin/manifest.zip) 
[build] 	Validating: style/ (from /mnt/dev/c++/bismika/bundles/resources-plugin/manifest.zip) 
[build] 	Validating: style/style.css (from /mnt/dev/c++/bismika/bundles/resources-plugin/manifest.zip) 
[build] Finished validating manifest files from style/style.css
[build] Appending file /mnt/dev/c++/bismika/build/plugins/libresources-plugind.so with contents of resources zip file at /mnt/dev/c++/bismika/bundles/resources-plugin/manifest.zip
[build]   Initial file size : 0
[build]   Final file size : 129696
[build] [100%] Built target resources_plugin
[driver] Build completed: 00:00:00.433


@al-sabr
Copy link
Author

al-sabr commented Aug 24, 2024

If you use my project : https://github.com/al-sabr/bismika

The loading of resources which are embedded in the shared library are recognized by the framework but if you replace the PR version by the original version from your repo it will not work at this line : https://github.com/al-sabr/bismika/blob/114b63a38d19f0bef3af008525209643db14bba8/cmake/cppmicroservices.cmake#L7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants