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

Remove static globals #31

Conversation

jeffdiclemente
Copy link
Member

This addresses jeffdiclemente#2, which is concerned with removal of static globals and other related code changes.

This pull request obsoletes #28, which was primarily focused on the review of the high level design.

Important Notes:

  • Auto-loading and ModuleSettings are in a state of transition. I am leaving it unfinished for now. Currently, bundles are auto-installed (i.e.auto-installed bundles have to be explicitly started/stopped), instead of auto-loaded. Requirements and/or guidance on how to transition this would be great.
  • All new code uses OSGi nomenclature where applicable in anticipation of submitting code for Switch to using OSGi nomenclature jeffdiclemente/CppMicroServices#1.

jeffdiclemente and others added 2 commits July 1, 2015 14:14
Added disclaimer describing the purpose of this repository.

Signed-off-by: The MathWorks, Inc. Roy.Lurie@mathworks.com
This includes a few other changes required to be able to remove static globals:

- "Framework" and "Framework Factory" classes as a single entry point for clients to initialize CppMicroServices.
- A minimal lifecycle for bundles, consisting solely of "install", "start", "stop" and "uninstall".
- Bundles are installed first and then loaded into the process only on bundle activation.
- Transition to declaring the bundle name in the bundle's manifest file.
- Auto-loading needs to be either factored out into a service or modified to allow auto-installing of bundles.

Closes #2

Signed-off-by: The MathWorks, Inc. Roy.Lurie@mathworks.com
@jeffdiclemente
Copy link
Member Author

I'm not sure why the AppVeyor build fails. It has consistently done so with the following output:

Build started
git clone -q https://github.com/saschazelzer/CppMicroServices.git C:\projects\cppmicroservices
git fetch -q origin +refs/pull/31/merge:
git checkout -qf FETCH_HEAD
Specify a project or solution file. The directory does not contain a project or solution file.

Is this an issue on the AppVeyor side or an issue on my end?

@@ -16,9 +16,7 @@ void RetrieveModuleContext()
//! [GetModuleContext]

//! [InitializeModule]

Choose a reason for hiding this comment

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

Remove comment

@saschazelzer saschazelzer self-assigned this Sep 8, 2015
@saschazelzer
Copy link
Member

Concerning the AppVeyor issue, I am not sure what's going on. Lets ignore this for now, we can fix the build later.

@@ -7,15 +7,22 @@ The following properties are always set by the C++ Micro Services library and ca
the module author:

* `module.id` - The unique id of the module (type `long`)
* `module.name` - The human readable name of the module (type `std::string`)
Copy link
Member

Choose a reason for hiding this comment

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

I believe I understand why you made this change. Still, I would like to see the module.name property added by the framework, such that for basic bundles no custom manifest.json file is required.

We should be able to use the US_MODULE_INITIALIZATION macro to inject a string field into the custom section we were talking about in the General Discussion document. The existing object format parsers in branch 25-module-lifecycle-enhancements can then extract that information. Because this requires some more coding, I suggest to keep your changes for the sake of merging them rather sooner than later. I will create a separate issue to investigate this after the merge.

*
* @return A new, configured Framework instance.
*/
Framework* newFramework(std::map<std::string, std::string> configuration);
Copy link
Member

Choose a reason for hiding this comment

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

Camel case method naming NewFramework.

Please add an overload taking no arguments.

Copy link
Member

Choose a reason for hiding this comment

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

We probably should use unique / shared pointer for the framework and module instances. Previously, the Module pointers lived as long as the program, but with the new life cycle they should be managed. I will create a new issue for that.

All issues in the code review should be addressed, excluding those that have circle back issues associated with them.

In addition, other issues were fixed:
1. removed more unnecessary #includes.
2. fixed the usCoreExamplesDriver to work with static modules.
3. Removed references in the documentation and CMakeLists.txt files to the US_STATIC_MODULE preprocessor.

Signed-off-by: The MathWorks, Inc. Roy.Lurie@mathworks.com
An incorrect build option was being used in the test.

Signed-off-by: The MathWorks, Inc. Roy.Lurie@mathworks.com
@jeffdiclemente
Copy link
Member Author

@saschazelzer, please let me know if there is anything else which requires immediate attention before it can be merged into the development branch. Thanks.

@saschazelzer
Copy link
Member

Strange, I didn't get any notification about your new changes but maybe I just missed it. I will have a final look and merge it asap. Thanks!

saschazelzer added a commit that referenced this pull request Sep 22, 2015
@saschazelzer saschazelzer merged commit 6be85bd into CppMicroServices:development Sep 22, 2015
@saschazelzer
Copy link
Member

All right, thanks a lot for this massive contribution. I will add the discussed todos as new issues.

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.

3 participants