CELIX-417: Initial refactoring for CMake usage
Project: http://git-wip-us.apache.org/repos/asf/celix/repo Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/a1c30887 Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/a1c30887 Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/a1c30887 Branch: refs/heads/feature/CELIX-417-cmake-refactor Commit: a1c308879bb4f2834334f120ca6d5d6dabecc4d4 Parents: 78e435b Author: Pepijn Noltes <[email protected]> Authored: Mon Nov 20 21:40:38 2017 +0100 Committer: Pepijn Noltes <[email protected]> Committed: Mon Nov 20 21:40:38 2017 +0100 ---------------------------------------------------------------------- CMakeLists.txt | 31 +- cmake/CMakeCelix-local.cmake | 31 + cmake/CMakeCelix.cmake | 32 - cmake/FindCELIX.cmake | 44 +- cmake/cmake_celix/BundlePackaging.cmake | 53 +- cmake/cmake_celix/DeployPackaging.cmake | 43 +- cmake/cmake_celix/UseCelix.cmake | 22 + config_admin/CMakeLists.txt | 7 +- config_admin/config_admin_tst/CMakeLists.txt | 2 +- .../example_test/CMakeLists.txt | 2 +- .../example_test2/CMakeLists.txt | 2 +- config_admin/example/CMakeLists.txt | 2 - config_admin/service/CMakeLists.txt | 3 - dependency_manager/CMakeLists.txt | 96 +- dependency_manager/api/dm_activator.h | 65 + dependency_manager/api/dm_component.h | 158 ++ dependency_manager/api/dm_dependency_manager.h | 79 + dependency_manager/api/dm_info.h | 81 + dependency_manager/api/dm_service_dependency.h | 171 ++ .../private/include/dm_component_impl.h | 48 - .../private/include/dm_dependency.h | 41 - .../include/dm_dependency_manager_impl.h | 45 - dependency_manager/private/include/dm_event.h | 72 - .../include/dm_service_dependency_impl.h | 104 - .../private/include/dm_shell_list_command.h | 42 - dependency_manager/private/src/dm_activator.c | 119 - .../private/src/dm_component_impl.c | 1442 ---------- .../private/src/dm_dependency_manager_impl.c | 129 - dependency_manager/private/src/dm_event.c | 105 - .../private/src/dm_service_dependency.c | 811 ------ .../private/src/dm_shell_activator.c | 94 - .../private/src/dm_shell_list_command.c | 126 - .../public/include/dm_activator.h | 65 - .../public/include/dm_component.h | 158 -- .../public/include/dm_dependency_manager.h | 79 - dependency_manager/public/include/dm_info.h | 81 - .../public/include/dm_service_dependency.h | 171 -- dependency_manager/readme.md | 18 +- dependency_manager/src/dm_activator.c | 119 + dependency_manager/src/dm_component_impl.c | 1442 ++++++++++ dependency_manager/src/dm_component_impl.h | 48 + dependency_manager/src/dm_dependency.h | 41 + .../src/dm_dependency_manager_impl.c | 129 + .../src/dm_dependency_manager_impl.h | 45 + dependency_manager/src/dm_event.c | 105 + dependency_manager/src/dm_event.h | 72 + dependency_manager/src/dm_service_dependency.c | 811 ++++++ .../src/dm_service_dependency_impl.h | 104 + dependency_manager/src/dm_shell_activator.c | 94 + dependency_manager/src/dm_shell_list_command.c | 126 + dependency_manager/src/dm_shell_list_command.h | 42 + dependency_manager_cxx/CMakeLists.txt | 32 +- dependency_manager_cxx/readme.md | 6 + deployment_admin/CMakeLists.txt | 59 +- deployment_admin/README.md | 20 +- deployment_admin/api/resource_processor.h | 54 + .../private/include/deployment_admin.h | 57 - .../private/include/deployment_package.h | 76 - deployment_admin/private/include/ioapi.h | 200 -- deployment_admin/private/include/log.h | 44 - deployment_admin/private/include/log_event.h | 43 - deployment_admin/private/include/log_store.h | 45 - deployment_admin/private/include/log_sync.h | 36 - deployment_admin/private/include/miniunz.h | 34 - deployment_admin/private/include/unzip.h | 437 --- deployment_admin/private/src/deployment_admin.c | 809 ------ .../private/src/deployment_admin_activator.c | 78 - .../private/src/deployment_package.c | 219 -- deployment_admin/private/src/ioapi.c | 235 -- deployment_admin/private/src/log.c | 73 - deployment_admin/private/src/log_store.c | 94 - deployment_admin/private/src/log_sync.c | 209 -- deployment_admin/private/src/miniunz.c | 402 --- deployment_admin/private/src/unzip.c | 2128 -------------- .../public/include/resource_processor.h | 54 - deployment_admin/src/deployment_admin.c | 809 ++++++ deployment_admin/src/deployment_admin.h | 57 + .../src/deployment_admin_activator.c | 78 + deployment_admin/src/deployment_package.c | 219 ++ deployment_admin/src/deployment_package.h | 76 + deployment_admin/src/ioapi.c | 235 ++ deployment_admin/src/ioapi.h | 200 ++ deployment_admin/src/log.c | 73 + deployment_admin/src/log.h | 44 + deployment_admin/src/log_event.h | 43 + deployment_admin/src/log_store.c | 94 + deployment_admin/src/log_store.h | 45 + deployment_admin/src/log_sync.c | 209 ++ deployment_admin/src/log_sync.h | 36 + deployment_admin/src/miniunz.c | 402 +++ deployment_admin/src/miniunz.h | 34 + deployment_admin/src/unzip.c | 2128 ++++++++++++++ deployment_admin/src/unzip.h | 437 +++ device_access/README.md | 11 +- device_access/device_access/CMakeLists.txt | 42 +- device_access/device_access/include/device.h | 47 + device_access/device_access/include/driver.h | 45 + .../device_access/include/driver_locator.h | 46 + .../device_access/include/driver_selector.h | 41 + device_access/device_access/include/match.h | 38 + .../private/include/device_manager.h | 56 - .../private/include/driver_attributes.h | 46 - .../private/include/driver_loader.h | 48 - .../private/include/driver_matcher.h | 42 - .../device_access/private/src/activator.c | 194 -- .../device_access/private/src/device_manager.c | 570 ---- .../private/src/driver_attributes.c | 169 -- .../device_access/private/src/driver_loader.c | 185 -- .../device_access/private/src/driver_matcher.c | 274 -- .../device_access/public/include/device.h | 47 - .../device_access/public/include/driver.h | 45 - .../public/include/driver_locator.h | 46 - .../public/include/driver_selector.h | 41 - .../device_access/public/include/match.h | 38 - device_access/device_access/src/activator.c | 194 ++ .../device_access/src/device_manager.c | 570 ++++ .../device_access/src/device_manager.h | 56 + .../device_access/src/driver_attributes.c | 169 ++ .../device_access/src/driver_attributes.h | 46 + device_access/device_access/src/driver_loader.c | 185 ++ device_access/device_access/src/driver_loader.h | 48 + .../device_access/src/driver_matcher.c | 274 ++ .../device_access/src/driver_matcher.h | 42 + device_access/driver_locator/CMakeLists.txt | 14 +- .../private/include/driver_locator_private.h | 39 - .../driver_locator/private/src/activator.c | 89 - .../driver_locator/private/src/driver_locator.c | 91 - device_access/driver_locator/src/activator.c | 89 + .../driver_locator/src/driver_locator.c | 91 + .../driver_locator/src/driver_locator_private.h | 39 + device_access/example/CMakeLists.txt | 2 +- .../example/base_driver/CMakeLists.txt | 15 +- .../base_driver/include/base_driver_device.h | 44 + .../private/include/base_driver_private.h | 41 - .../example/base_driver/private/src/activator.c | 140 - .../base_driver/private/src/base_driver.c | 111 - .../public/include/base_driver_device.h | 44 - .../example/base_driver/src/activator.c | 140 + .../example/base_driver/src/base_driver.c | 111 + .../base_driver/src/base_driver_private.h | 41 + .../example/consuming_driver/CMakeLists.txt | 12 +- .../private/include/consuming_driver_private.h | 43 - .../consuming_driver/private/src/activator.c | 104 - .../private/src/consuming_driver.c | 125 - .../example/consuming_driver/src/activator.c | 104 + .../consuming_driver/src/consuming_driver.c | 125 + .../src/consuming_driver_private.h | 43 + .../example/refining_driver/CMakeLists.txt | 15 +- .../include/refining_driver_device.h | 45 + .../private/include/refining_driver_private.h | 58 - .../refining_driver/private/src/activator.c | 104 - .../private/src/refining_driver.c | 281 -- .../public/include/refining_driver_device.h | 45 - .../example/refining_driver/src/activator.c | 104 + .../refining_driver/src/refining_driver.c | 281 ++ .../src/refining_driver_private.h | 58 + dfi/CMakeLists.txt | 88 +- dfi/include/dfi_log_util.h | 63 + dfi/include/dyn_common.h | 47 + dfi/include/dyn_function.h | 60 + dfi/include/dyn_interface.h | 66 + dfi/include/dyn_message.h | 56 + dfi/include/dyn_type.h | 155 ++ dfi/include/json_rpc.h | 37 + dfi/include/json_serializer.h | 37 + dfi/private/src/dyn_common.c | 151 - dfi/private/src/dyn_function.c | 331 --- dfi/private/src/dyn_interface.c | 444 --- dfi/private/src/dyn_message.c | 358 --- dfi/private/src/dyn_type.c | 1160 -------- dfi/private/src/json_rpc.c | 341 --- dfi/private/src/json_serializer.c | 484 ---- .../test/avro_descriptor_translator_tests.cpp | 180 -- .../test/descriptors/example1.descriptor | 13 - .../test/descriptors/example2.descriptor | 9 - .../test/descriptors/example3.descriptor | 11 - .../test/descriptors/example4.descriptor | 8 - .../descriptors/invalids/invalid.descriptor | 13 - .../invalids/invalidMetaType.descriptor | 8 - .../invalids/invalidMethod.descriptor | 8 - .../invalids/invalidMethodReturnType.descriptor | 8 - .../invalids/invalidMsgHdr.descriptor | 9 - .../invalids/invalidMsgInvalidName.descriptor | 9 - .../invalidMsgInvalidSection.descriptor | 10 - .../invalids/invalidMsgInvalidType.descriptor | 9 - .../invalidMsgInvalidVersion.descriptor | 10 - .../invalidMsgMissingVersion.descriptor | 10 - .../invalids/invalidSection.descriptor | 6 - .../descriptors/invalids/invalidType.descriptor | 10 - .../invalids/invalidVersion.descriptor | 9 - .../descriptors/invalids/noVersion.descriptor | 12 - .../test/descriptors/msg_example1.descriptor | 10 - .../test/descriptors/msg_example2.descriptor | 12 - .../test/descriptors/msg_example3.descriptor | 10 - .../test/descriptors/msg_example4.descriptor | 10 - dfi/private/test/dyn_closure_tests.cpp | 162 -- dfi/private/test/dyn_function_tests.cpp | 274 -- dfi/private/test/dyn_interface_tests.cpp | 207 -- dfi/private/test/dyn_message_tests.cpp | 253 -- dfi/private/test/dyn_type_tests.cpp | 297 -- dfi/private/test/json_rpc_tests.cpp | 433 --- dfi/private/test/json_serializer_tests.cpp | 558 ---- dfi/private/test/run_tests.cpp | 24 - dfi/private/test/schemas/complex.avdl | 30 - dfi/private/test/schemas/complex.avpr | 55 - dfi/private/test/schemas/invalid1.avpr | 47 - dfi/private/test/schemas/invalid2.avpr | 49 - dfi/private/test/schemas/simple.avdl | 24 - dfi/private/test/schemas/simple.avpr | 51 - dfi/private/test/schemas/simple_min.avpr | 19 - dfi/public/include/dfi_log_util.h | 63 - dfi/public/include/dyn_common.h | 47 - dfi/public/include/dyn_function.h | 60 - dfi/public/include/dyn_interface.h | 66 - dfi/public/include/dyn_message.h | 56 - dfi/public/include/dyn_type.h | 155 -- dfi/public/include/json_rpc.h | 37 - dfi/public/include/json_serializer.h | 37 - dfi/src/dyn_common.c | 151 + dfi/src/dyn_function.c | 331 +++ dfi/src/dyn_interface.c | 444 +++ dfi/src/dyn_message.c | 358 +++ dfi/src/dyn_type.c | 1160 ++++++++ dfi/src/json_rpc.c | 341 +++ dfi/src/json_serializer.c | 484 ++++ dfi/test/avro_descriptor_translator_tests.cpp | 180 ++ dfi/test/descriptors/example1.descriptor | 13 + dfi/test/descriptors/example2.descriptor | 9 + dfi/test/descriptors/example3.descriptor | 11 + dfi/test/descriptors/example4.descriptor | 8 + .../descriptors/invalids/invalid.descriptor | 13 + .../invalids/invalidMetaType.descriptor | 8 + .../invalids/invalidMethod.descriptor | 8 + .../invalids/invalidMethodReturnType.descriptor | 8 + .../invalids/invalidMsgHdr.descriptor | 9 + .../invalids/invalidMsgInvalidName.descriptor | 9 + .../invalidMsgInvalidSection.descriptor | 10 + .../invalids/invalidMsgInvalidType.descriptor | 9 + .../invalidMsgInvalidVersion.descriptor | 10 + .../invalidMsgMissingVersion.descriptor | 10 + .../invalids/invalidSection.descriptor | 6 + .../descriptors/invalids/invalidType.descriptor | 10 + .../invalids/invalidVersion.descriptor | 9 + .../descriptors/invalids/noVersion.descriptor | 12 + dfi/test/descriptors/msg_example1.descriptor | 10 + dfi/test/descriptors/msg_example2.descriptor | 12 + dfi/test/descriptors/msg_example3.descriptor | 10 + dfi/test/descriptors/msg_example4.descriptor | 10 + dfi/test/dyn_closure_tests.cpp | 162 ++ dfi/test/dyn_function_tests.cpp | 274 ++ dfi/test/dyn_interface_tests.cpp | 207 ++ dfi/test/dyn_message_tests.cpp | 253 ++ dfi/test/dyn_type_tests.cpp | 297 ++ dfi/test/json_rpc_tests.cpp | 433 +++ dfi/test/json_serializer_tests.cpp | 558 ++++ dfi/test/run_tests.cpp | 24 + dfi/test/schemas/complex.avdl | 30 + dfi/test/schemas/complex.avpr | 55 + dfi/test/schemas/invalid1.avpr | 47 + dfi/test/schemas/invalid2.avpr | 49 + dfi/test/schemas/simple.avdl | 24 + dfi/test/schemas/simple.avpr | 51 + dfi/test/schemas/simple_min.avpr | 19 + doap/doap_Celix.rdf | 2 +- etcdlib/CMakeLists.txt | 30 +- etcdlib/api/etcd.h | 110 + etcdlib/private/src/etcd.c | 487 ---- etcdlib/public/include/etcd.h | 110 - etcdlib/src/etcd.c | 487 ++++ event_admin/event_admin/CMakeLists.txt | 2 +- event_admin/event_handler/CMakeLists.txt | 2 +- event_admin/event_publisher/CMakeLists.txt | 2 +- examples/CMakeLists.txt | 1 - examples/dm_example/CMakeLists.txt | 8 +- examples/dm_example/phase1/CMakeLists.txt | 9 +- examples/dm_example/phase2a/CMakeLists.txt | 6 +- examples/dm_example/phase2b/CMakeLists.txt | 6 +- examples/dm_example/phase3/CMakeLists.txt | 6 +- examples/dm_example_cxx/CMakeLists.txt | 9 +- examples/dm_example_cxx/phase1/CMakeLists.txt | 6 +- examples/dm_example_cxx/phase2a/CMakeLists.txt | 19 +- examples/dm_example_cxx/phase2b/CMakeLists.txt | 16 +- examples/dm_example_cxx/phase3/CMakeLists.txt | 6 +- .../phase3_locking/CMakeLists.txt | 6 +- examples/embedding/CMakeLists.txt | 2 +- examples/hello_world/CMakeLists.txt | 4 +- examples/hello_world_test/CMakeLists.txt | 10 +- examples/log_service_example/CMakeLists.txt | 15 +- .../log_service_example/private/src/activator.c | 85 - examples/log_service_example/src/activator.c | 85 + examples/mongoose/CMakeLists.txt | 4 +- examples/service_hook_example/CMakeLists.txt | 27 +- .../private/src/activator.c | 137 - examples/service_hook_example/src/activator.c | 137 + examples/services_example_c/CMakeLists.txt | 4 +- examples/services_example_c/bar/CMakeLists.txt | 6 +- examples/services_example_c/foo1/CMakeLists.txt | 6 +- examples/services_example_c/foo2/CMakeLists.txt | 6 +- examples/services_example_cxx/CMakeLists.txt | 4 +- .../services_example_cxx/bar/CMakeLists.txt | 6 +- .../services_example_cxx/baz/CMakeLists.txt | 6 +- .../services_example_cxx/foo/CMakeLists.txt | 6 +- examples/whiteboard/CMakeLists.txt | 24 - examples/whiteboard/publisherA/CMakeLists.txt | 23 - .../publisherA/private/src/activator.c | 83 - .../publisherA/private/src/publisher.c | 33 - examples/whiteboard/publisherB/CMakeLists.txt | 22 - .../publisherB/private/src/activator.c | 77 - .../publisherB/private/src/publisher.c | 33 - .../private/include/publisher_private.h | 38 - .../publisherService/public/include/publisher.h | 42 - examples/whiteboard/tracker/CMakeLists.txt | 21 - .../whiteboard/tracker/private/src/activator.c | 126 - .../whiteboard/tracker_depman/CMakeLists.txt | 36 - .../tracker_depman/private/include/tracker.h | 63 - .../private/src/dependency_activator.c | 116 - .../tracker_depman/private/src/tracker.c | 142 - framework/CMakeLists.txt | 628 ++--- framework/include/archive.h | 58 + framework/include/bundle.h | 139 + framework/include/bundle_activator.h | 126 + framework/include/bundle_archive.h | 93 + framework/include/bundle_context.h | 175 ++ framework/include/bundle_event.h | 63 + framework/include/bundle_listener.h | 57 + framework/include/bundle_revision.h | 142 + framework/include/bundle_state.h | 49 + framework/include/capability.h | 54 + framework/include/celix_launcher.h | 55 + framework/include/celix_log.h | 85 + framework/include/constants.h | 67 + framework/include/filter.h | 55 + framework/include/framework.h | 57 + framework/include/framework_event.h | 71 + framework/include/framework_exports.h | 65 + framework/include/framework_listener.h | 55 + framework/include/listener_hook_service.h | 60 + framework/include/manifest.h | 67 + framework/include/module.h | 94 + framework/include/requirement.h | 53 + framework/include/service_event.h | 68 + framework/include/service_factory.h | 60 + framework/include/service_listener.h | 55 + framework/include/service_reference.h | 72 + framework/include/service_registration.h | 58 + framework/include/service_registry.h | 103 + framework/include/service_tracker.h | 72 + framework/include/service_tracker_customizer.h | 78 + framework/include/wire.h | 120 + framework/private/include/attribute.h | 39 - framework/private/include/attribute_private.h | 39 - framework/private/include/bundle_cache.h | 115 - .../private/include/bundle_cache_private.h | 39 - .../private/include/bundle_context_private.h | 43 - framework/private/include/bundle_private.h | 48 - .../private/include/bundle_revision_private.h | 42 - framework/private/include/capability_private.h | 41 - framework/private/include/filter_private.h | 57 - framework/private/include/framework_private.h | 145 - framework/private/include/ioapi.h | 200 -- framework/private/include/iowin32.h | 28 - .../private/include/listener_hook_info_impl.h | 34 - framework/private/include/manifest_parser.h | 45 - .../private/include/registry_callback_private.h | 42 - framework/private/include/requirement_private.h | 40 - framework/private/include/resolver.h | 45 - .../private/include/service_reference_private.h | 69 - .../include/service_registration_private.h | 71 - .../private/include/service_registry_private.h | 67 - .../service_tracker_customizer_private.h | 49 - .../private/include/service_tracker_private.h | 52 - framework/private/include/unzip.h | 437 --- framework/private/src/attribute.c | 71 - framework/private/src/bundle.c | 695 ----- framework/private/src/bundle_archive.c | 792 ------ framework/private/src/bundle_cache.c | 218 -- framework/private/src/bundle_context.c | 384 --- framework/private/src/bundle_revision.c | 153 - framework/private/src/capability.c | 100 - framework/private/src/celix_errorcodes.c | 64 - framework/private/src/celix_launcher.c | 242 -- framework/private/src/celix_log.c | 83 - framework/private/src/filter.c | 687 ----- framework/private/src/framework.c | 2620 ------------------ framework/private/src/ioapi.c | 235 -- framework/private/src/iowin32.c | 389 --- framework/private/src/manifest.c | 271 -- framework/private/src/manifest_parser.c | 490 ---- framework/private/src/miniunz.c | 382 --- framework/private/src/module.c | 281 -- framework/private/src/requirement.c | 114 - framework/private/src/resolver.c | 495 ---- framework/private/src/service_reference.c | 378 --- framework/private/src/service_registration.c | 291 -- framework/private/src/service_registry.c | 800 ------ framework/private/src/service_tracker.c | 449 --- .../private/src/service_tracker_customizer.c | 107 - framework/private/src/unzip.c | 2128 -------------- framework/private/src/wire.c | 87 - framework/public/include/archive.h | 58 - framework/public/include/bundle.h | 139 - framework/public/include/bundle_activator.h | 126 - framework/public/include/bundle_archive.h | 93 - framework/public/include/bundle_context.h | 159 -- framework/public/include/bundle_event.h | 63 - framework/public/include/bundle_listener.h | 57 - framework/public/include/bundle_revision.h | 142 - framework/public/include/bundle_state.h | 49 - framework/public/include/capability.h | 54 - framework/public/include/celix_launcher.h | 55 - framework/public/include/celix_log.h | 85 - framework/public/include/constants.h | 67 - framework/public/include/filter.h | 55 - framework/public/include/framework.h | 57 - framework/public/include/framework_event.h | 71 - framework/public/include/framework_exports.h | 65 - framework/public/include/framework_listener.h | 55 - .../public/include/listener_hook_service.h | 60 - framework/public/include/manifest.h | 67 - framework/public/include/module.h | 94 - framework/public/include/requirement.h | 53 - framework/public/include/service_event.h | 68 - framework/public/include/service_factory.h | 60 - framework/public/include/service_listener.h | 55 - framework/public/include/service_reference.h | 72 - framework/public/include/service_registration.h | 58 - framework/public/include/service_registry.h | 103 - framework/public/include/service_tracker.h | 72 - .../public/include/service_tracker_customizer.h | 78 - framework/public/include/wire.h | 120 - framework/src/attribute.c | 71 + framework/src/attribute.h | 39 + framework/src/attribute_private.h | 39 + framework/src/bundle.c | 695 +++++ framework/src/bundle_archive.c | 792 ++++++ framework/src/bundle_cache.c | 218 ++ framework/src/bundle_cache.h | 115 + framework/src/bundle_cache_private.h | 39 + framework/src/bundle_context.c | 384 +++ framework/src/bundle_context_private.h | 43 + framework/src/bundle_private.h | 48 + framework/src/bundle_revision.c | 153 + framework/src/bundle_revision_private.h | 42 + framework/src/capability.c | 100 + framework/src/capability_private.h | 41 + framework/src/celix_errorcodes.c | 64 + framework/src/celix_launcher.c | 242 ++ framework/src/celix_log.c | 83 + framework/src/filter.c | 687 +++++ framework/src/filter_private.h | 57 + framework/src/framework.c | 2620 ++++++++++++++++++ framework/src/framework_private.h | 145 + framework/src/ioapi.c | 235 ++ framework/src/ioapi.h | 200 ++ framework/src/iowin32.c | 389 +++ framework/src/iowin32.h | 28 + framework/src/listener_hook_info_impl.h | 34 + framework/src/manifest.c | 271 ++ framework/src/manifest_parser.c | 490 ++++ framework/src/manifest_parser.h | 45 + framework/src/miniunz.c | 382 +++ framework/src/module.c | 281 ++ framework/src/registry_callback_private.h | 42 + framework/src/requirement.c | 114 + framework/src/requirement_private.h | 40 + framework/src/resolver.c | 495 ++++ framework/src/resolver.h | 45 + framework/src/service_reference.c | 378 +++ framework/src/service_reference_private.h | 69 + framework/src/service_registration.c | 291 ++ framework/src/service_registration_private.h | 71 + framework/src/service_registry.c | 800 ++++++ framework/src/service_registry_private.h | 67 + framework/src/service_tracker.c | 449 +++ framework/src/service_tracker_customizer.c | 107 + .../src/service_tracker_customizer_private.h | 49 + framework/src/service_tracker_private.h | 52 + framework/src/unzip.c | 2128 ++++++++++++++ framework/src/unzip.h | 437 +++ framework/src/wire.c | 87 + framework/tst/CMakeLists.txt | 12 +- launcher/CMakeLists.txt | 33 +- launcher/private/src/celix_test_runner.cpp | 73 - launcher/private/src/main.c | 24 - launcher/src/celix_test_runner.cpp | 73 + launcher/src/main.c | 24 + log_service/CMakeLists.txt | 49 +- log_service/README.md | 13 +- log_service/include/log_entry.h | 55 + log_service/include/log_listener.h | 43 + log_service/include/log_reader_service.h | 50 + log_service/include/log_service.h | 58 + log_service/loghelper_include/log_helper.h | 35 + log_service/private/include/log.h | 48 - log_service/private/include/log_factory.h | 40 - .../private/include/log_reader_service_impl.h | 43 - log_service/private/include/log_service_impl.h | 39 - log_service/private/src/log.c | 375 --- log_service/private/src/log_entry.c | 94 - log_service/private/src/log_factory.c | 100 - .../private/src/log_reader_service_impl.c | 82 - log_service/private/src/log_service_activator.c | 198 -- log_service/private/src/log_service_impl.c | 96 - log_service/public/include/log_entry.h | 55 - log_service/public/include/log_helper.h | 35 - log_service/public/include/log_listener.h | 43 - log_service/public/include/log_reader_service.h | 50 - log_service/public/include/log_service.h | 58 - log_service/public/src/log_helper.c | 211 -- log_service/src/log.c | 375 +++ log_service/src/log.h | 48 + log_service/src/log_entry.c | 94 + log_service/src/log_factory.c | 100 + log_service/src/log_factory.h | 40 + log_service/src/log_helper.c | 211 ++ log_service/src/log_reader_service_impl.c | 82 + log_service/src/log_reader_service_impl.h | 43 + log_service/src/log_service_activator.c | 198 ++ log_service/src/log_service_impl.c | 96 + log_service/src/log_service_impl.h | 39 + log_writer/CMakeLists.txt | 1 + log_writer/log_writer/CMakeLists.txt | 24 + log_writer/log_writer/include/log_writer.h | 53 + .../log_writer/private/include/log_writer.h | 54 - log_writer/log_writer/private/src/log_writer.c | 122 - .../private/src/log_writer_activator.c | 57 - log_writer/log_writer/src/log_writer.c | 122 + .../log_writer/src/log_writer_activator.c | 57 + log_writer/log_writer_stdout/CMakeLists.txt | 16 +- .../private/src/log_writer_stdout.c | 49 - .../log_writer_stdout/src/log_writer_stdout.c | 49 + log_writer/log_writer_syslog/CMakeLists.txt | 16 +- pubsub/CMakeLists.txt | 11 +- pubsub/deploy/CMakeLists.txt | 176 +- remote_services/CMakeLists.txt | 15 +- .../discovery_configured/CMakeLists.txt | 5 +- remote_services/discovery_etcd/CMakeLists.txt | 10 +- .../private/include/discovery_impl.h | 66 - .../private/include/etcd_watcher.h | 40 - .../discovery_etcd/private/src/discovery_impl.c | 183 -- .../discovery_etcd/private/src/etcd_watcher.c | 397 --- .../discovery_etcd/src/discovery_impl.c | 183 ++ .../discovery_etcd/src/discovery_impl.h | 66 + .../discovery_etcd/src/etcd_watcher.c | 397 +++ .../discovery_etcd/src/etcd_watcher.h | 40 + remote_services/examples/CMakeLists.txt | 99 +- .../examples/calculator_endpoint/CMakeLists.txt | 35 - .../private/include/calculator_endpoint_impl.h | 46 - .../private/src/calculator_endpoint_activator.c | 96 - .../private/src/calculator_endpoint_impl.c | 184 -- .../calculator_endpoint2/CMakeLists.txt | 35 - .../private/include/calculator_endpoint_impl.h | 46 - .../private/src/calculator_endpoint_activator.c | 96 - .../private/src/calculator_endpoint_impl.c | 184 -- .../examples/calculator_proxy/CMakeLists.txt | 37 - .../private/include/calculator_proxy_impl.h | 59 - .../private/src/calculator_proxy_activator.c | 124 - .../private/src/calculator_proxy_impl.c | 173 -- .../examples/calculator_proxy2/CMakeLists.txt | 37 - .../private/include/calculator_proxy_impl.h | 59 - .../private/src/calculator_proxy_activator.c | 124 - .../private/src/calculator_proxy_impl.c | 173 -- .../examples/calculator_service/CMakeLists.txt | 2 - .../examples/calculator_shell/CMakeLists.txt | 3 +- .../remote_service_admin_dfi/rsa/CMakeLists.txt | 3 +- .../rsa_tst/CMakeLists.txt | 5 +- .../rsa_tst/bundle/CMakeLists.txt | 2 +- .../remote_service_admin_http/CMakeLists.txt | 55 - .../include/remote_service_admin_http_impl.h | 52 - .../src/remote_service_admin_activator.c | 123 - .../private/src/remote_service_admin_impl.c | 822 ------ .../private/test/CMakeLists.txt | 58 - .../private/test/client.properties.in | 26 - .../private/test/rsa_client_server_tests.cpp | 495 ---- .../private/test/run_tests.cpp | 24 - .../private/test/server.properties.in | 25 - remote_services/topology_manager/CMakeLists.txt | 5 +- .../topology_manager/tms_tst/CMakeLists.txt | 2 +- .../tms_tst/bundle/CMakeLists.txt | 2 +- .../tms_tst/disc_mock/CMakeLists.txt | 2 +- remote_shell/CMakeLists.txt | 28 +- .../private/include/connection_listener.h | 42 - remote_shell/private/include/remote_shell.h | 50 - remote_shell/private/include/shell_mediator.h | 54 - remote_shell/private/src/activator.c | 153 - remote_shell/private/src/connection_listener.c | 221 -- remote_shell/private/src/remote_shell.c | 242 -- remote_shell/private/src/shell_mediator.c | 139 - remote_shell/src/activator.c | 153 + remote_shell/src/connection_listener.c | 221 ++ remote_shell/src/connection_listener.h | 42 + remote_shell/src/remote_shell.c | 242 ++ remote_shell/src/remote_shell.h | 50 + remote_shell/src/shell_mediator.c | 139 + remote_shell/src/shell_mediator.h | 54 + shell/CMakeLists.txt | 49 +- shell/README.md | 11 +- shell/include/command.h | 57 + shell/include/shell.h | 51 + shell/include/shell_constants.h | 27 + shell/private/include/shell_private.h | 51 - shell/private/include/std_commands.h | 44 - shell/private/src/activator.c | 269 -- shell/private/src/help_command.c | 112 - shell/private/src/inspect_command.c | 277 -- shell/private/src/install_command.c | 76 - shell/private/src/lb_command.c | 205 -- shell/private/src/log_command.c | 94 - shell/private/src/shell.c | 305 -- shell/private/src/start_command.c | 84 - shell/private/src/stop_command.c | 82 - shell/private/src/uninstall_command.c | 58 - shell/private/src/update_command.c | 117 - shell/public/include/command.h | 57 - shell/public/include/shell.h | 51 - shell/public/include/shell_constants.h | 27 - shell/src/activator.c | 269 ++ shell/src/help_command.c | 112 + shell/src/inspect_command.c | 277 ++ shell/src/install_command.c | 76 + shell/src/lb_command.c | 205 ++ shell/src/log_command.c | 94 + shell/src/shell.c | 305 ++ shell/src/shell_private.h | 51 + shell/src/start_command.c | 84 + shell/src/std_commands.h | 44 + shell/src/stop_command.c | 82 + shell/src/uninstall_command.c | 58 + shell/src/update_command.c | 117 + shell_bonjour/CMakeLists.txt | 26 +- shell_tui/CMakeLists.txt | 14 +- shell_tui/README.md | 5 + utils/CMakeLists.txt | 179 +- utils/include/array_list.h | 99 + utils/include/celix_errno.h | 119 + utils/include/celix_threads.h | 135 + utils/include/celixbool.h | 61 + utils/include/exports.h | 49 + utils/include/hash_map.h | 161 ++ utils/include/linked_list.h | 91 + utils/include/linked_list_iterator.h | 66 + utils/include/memstream/README.md | 49 + utils/include/memstream/fmemopen.h | 52 + utils/include/memstream/open_memstream.h | 15 + utils/include/properties.h | 66 + utils/include/thpool.h | 168 ++ utils/include/utils.h | 61 + utils/include/version.h | 186 ++ utils/include/version_range.h | 160 ++ utils/private/include/array_list_private.h | 52 - utils/private/include/hash_map_private.h | 74 - utils/private/include/linked_list_private.h | 44 - utils/private/include/version_private.h | 41 - utils/private/include/version_range_private.h | 41 - utils/private/src/array_list.c | 337 --- utils/private/src/celix_threads.c | 184 -- utils/private/src/hash_map.c | 607 ---- utils/private/src/linked_list.c | 268 -- utils/private/src/linked_list_iterator.c | 153 - utils/private/src/memstream/fmemopen.c | 76 - utils/private/src/memstream/open_memstream.c | 130 - utils/private/src/properties.c | 302 -- utils/private/src/thpool.c | 535 ---- utils/private/src/utils.c | 141 - utils/private/src/version.c | 264 -- utils/private/src/version_range.c | 233 -- utils/public/include/array_list.h | 99 - utils/public/include/celix_errno.h | 119 - utils/public/include/celix_threads.h | 135 - utils/public/include/celixbool.h | 61 - utils/public/include/exports.h | 49 - utils/public/include/hash_map.h | 161 -- utils/public/include/linked_list.h | 91 - utils/public/include/linked_list_iterator.h | 66 - utils/public/include/memstream/README.md | 49 - utils/public/include/memstream/fmemopen.h | 52 - utils/public/include/memstream/open_memstream.h | 15 - utils/public/include/properties.h | 66 - utils/public/include/thpool.h | 168 -- utils/public/include/utils.h | 61 - utils/public/include/version.h | 186 -- utils/public/include/version_range.h | 160 -- utils/src/array_list.c | 337 +++ utils/src/array_list_private.h | 52 + utils/src/celix_threads.c | 184 ++ utils/src/hash_map.c | 607 ++++ utils/src/hash_map_private.h | 74 + utils/src/linked_list.c | 268 ++ utils/src/linked_list_iterator.c | 153 + utils/src/linked_list_private.h | 44 + utils/src/memstream/fmemopen.c | 76 + utils/src/memstream/open_memstream.c | 130 + utils/src/properties.c | 302 ++ utils/src/thpool.c | 535 ++++ utils/src/utils.c | 141 + utils/src/version.c | 264 ++ utils/src/version_private.h | 41 + utils/src/version_range.c | 233 ++ utils/src/version_range_private.h | 41 + 699 files changed, 48465 insertions(+), 52553 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index dec1dff..9697da9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,27 +21,11 @@ cmake_policy(SET CMP0042 NEW) project (Celix C CXX) -include(GNUInstallDirs) - +include(GNUInstallDirs) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") - -#Setup vars conform the FindCelix setup, so that examples and supporting cmake command can assume these variables are set -#TODO move this to a seperate cmake file or integrate in the FindCelix.cmake file -set(CELIX_FOUND true) -set(CELIX_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/framework/public/include ${CMAKE_SOURCE_DIR}/utils/public/include) -set(CELIX_LIBRARIES celix_framework celix_utils celix_dfi) -set(CELIX_LAUNCHER celix) -set(CELIX_FRAMEWORK_LIBRARY celix_framework) -set(CELIX_UTILS_LIBRARY celix_utils) -set(CELIX_DFI_LIBRARY celix_dfi) -#TODO CELIX_BUNDLES_DIR this will not work, maybe only use var (e.g. ${CELIX_SHELL_BUNDLE}) for bundles -set(CELIX_DM_LIB dependency_manager_so) -set(CELIX_DM_STATIC_LIB dependency_manager_static) -set(CELIX_DM_STATIC_CXX_LIB dependency_manager_cxx_static) -set(CELIX_PROJECT true) #Note this var is not set by FindCelix and can be used to test if this is the celix project or a project using celix - set(CMAKE_BUILD_TYPE "Debug") + # see https://public.kitware.com/Bug/view.php?id=15696 IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} EQUAL 3.3 AND ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles") message( FATAL_ERROR "Building Celix using CMake 3.3 and makefiles is not supported due to a bug in the Makefile Generator (see Bug 15696). Please change the used CMake version - both, CMake 3.2 and CMake 3.4 are working fine. Or use a different generator (e.g. Ninja)." ) @@ -77,22 +61,25 @@ if (ENABLE_TESTING) endif() -include(CMakeCelix) +include(CMakeCelix-local) include(UseDoxygen) # Default bundle version set(DEFAULT_VERSION 1.0.0) +#libraries #utils, dfi and etcdlib are standalone #(e.g. no dependency on celix framework add_subdirectory(utils) add_subdirectory(dfi) add_subdirectory(etcdlib) - add_subdirectory(framework) - include_directories(framework/public/include) + +#launcher add_subdirectory(launcher) + +#Bundles add_subdirectory(config_admin) add_subdirectory(device_access) add_subdirectory(deployment_admin) @@ -104,8 +91,8 @@ add_subdirectory(shell) add_subdirectory(log_writer) add_subdirectory(log_service) add_subdirectory(pubsub) - #add_subdirectory(event_admin)# event_admin is unstable + add_subdirectory(dependency_manager) add_subdirectory(dependency_manager_cxx) http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/cmake/CMakeCelix-local.cmake ---------------------------------------------------------------------- diff --git a/cmake/CMakeCelix-local.cmake b/cmake/CMakeCelix-local.cmake new file mode 100644 index 0000000..f67648b --- /dev/null +++ b/cmake/CMakeCelix-local.cmake @@ -0,0 +1,31 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +set(CELIX_CMAKE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) + +include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/Dependencies.cmake) +include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/ApacheRat.cmake) +include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/CodeCoverage.cmake) +include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/BuildOptions.cmake) + +include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/UseCelix.cmake) + +#UseCelix includes: +#include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/BundlePackaging.cmake) +#include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/DeployPackaging.cmake) +#include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/DockerPackaging.cmake) +#include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/Runtimes.cmake) http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/cmake/CMakeCelix.cmake ---------------------------------------------------------------------- diff --git a/cmake/CMakeCelix.cmake b/cmake/CMakeCelix.cmake deleted file mode 100644 index 8c14577..0000000 --- a/cmake/CMakeCelix.cmake +++ /dev/null @@ -1,32 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - - -set(CELIX_CMAKE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) - -if (ANDROID) - add_definitions( -DANDROID ) -endif () - -include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/Dependencies.cmake) -include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/BundlePackaging.cmake) -include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/DeployPackaging.cmake) -include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/DockerPackaging.cmake) -include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/Runtimes.cmake) -include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/ApacheRat.cmake) -include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/CodeCoverage.cmake) -include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/BuildOptions.cmake) http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/cmake/FindCELIX.cmake ---------------------------------------------------------------------- diff --git a/cmake/FindCELIX.cmake b/cmake/FindCELIX.cmake index 3f67c50..ce31bc9 100644 --- a/cmake/FindCELIX.cmake +++ b/cmake/FindCELIX.cmake @@ -37,6 +37,8 @@ set(CELIX_DIR_FROM_FINDCELIX "${CMAKE_CURRENT_LIST_DIR}/../../../..") +#Find libraries celix_framework, celix_utils, etcdlib and celix_dfi +#Find celix launcher find_path(CELIX_INCLUDE_DIR NAMES celix_errno.h PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local PATH_SUFFIXES include include/celix @@ -67,37 +69,53 @@ find_program(CELIX_LAUNCHER NAMES celix PATH_SUFFIXES bin ) -find_file(CELIX_CMAKECELIX_FILE NAMES CMakeCelix.cmake +find_file(CELIX_USECELIX_FILE NAMES UseCelix.cmake PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local - PATH_SUFFIXES share/celix/cmake/modules + PATH_SUFFIXES share/celix/cmake/modules/cmake_celix ) -#NOTE assuming shell.zip is always installed. -find_path(CELIX_BUNDLES_DIR shell.zip - PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local - PATH_SUFFIXES share/celix/bundles -) + + +#Finding dependency manager libraries for C and C++ find_library(CELIX_DM_LIB NAMES dependency_manager_so PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local PATH_SUFFIXES lib lib64 -) + ) find_library(CELIX_DM_STATIC_LIB NAMES dependency_manager_static PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local PATH_SUFFIXES lib lib64 -) + ) find_library(CELIX_DM_STATIC_CXX_LIB NAMES dependency_manager_cxx_static PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local PATH_SUFFIXES lib lib64 -) + ) find_library(CELIX_ETCD_LIB NAMES etcdlib PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local PATH_SUFFIXES lib lib64 ) + +#Finding bundles dir. +find_path(CELIX_BUNDLES_DIR shell.zip #NOTE assuming shell.zip is always installed. + PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local + PATH_SUFFIXES share/celix/bundles +) + +#Finding bundles. If not found the <BUNDLEVAR>_BUNDLE var will be set to <BUNDLEVAR>-NOTFOUND +find_file(CELIX_SHELL_BUNDLE shell.zip + PATHS ${CELIX_BUNDLES_DIR} + NO_DEFAULT_PATH + ) +find_file(CELIX_SHELL_TUI_BUNDLE shell_tui.zip + PATHS ${CELIX_BUNDLES_DIR} + NO_DEFAULT_PATH + ) + + if (CELIX_DM_STATIC_LIB) set(CELIX_DM_INCLUDE_DIR ${CELIX_INCLUDE_DIR}/dependency_manager) endif() @@ -114,12 +132,12 @@ include(FindPackageHandleStandardArgs) # if all listed variables are TRUE find_package_handle_standard_args(CELIX DEFAULT_MSG CELIX_FRAMEWORK_LIBRARY CELIX_UTILS_LIBRARY CELIX_DFI_LIBRARY CELIX_DM_LIB CELIX_DM_STATIC_LIB CELIX_DM_STATIC_CXX_LIB CELIX_INCLUDE_DIR CELIX_LAUNCHER CELIX_CMAKECELIX_FILE) -mark_as_advanced(CELIX_INCLUDE_DIR CELIX_ETCD_INCLUDE_DIR CELIX_CMAKECELIX_FILE) +mark_as_advanced(CELIX_INCLUDE_DIR CELIX_ETCD_INCLUDE_DIR CELIX_USECELIX_FILE) if(CELIX_FOUND) set(CELIX_LIBRARIES ${CELIX_FRAMEWORK_LIBRARY} ${CELIX_UTILS_LIBRARY} ${CELIX_DFI_LIBRARY}) set(CELIX_INCLUDE_DIRS ${CELIX_INCLUDE_DIR} ${CELIX_ETCD_INCLUDE_DIR} ${CELIX_DM_INCLUDE_DIR} ${CELIX_DM_CXX_INCLUDE_DIR}) - include(${CELIX_CMAKECELIX_FILE}) - include_directories(${CELIX_INCLUDE_DIRS}) + + include(${CELIX_USECELIX_FILE}) endif() http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/cmake/cmake_celix/BundlePackaging.cmake ---------------------------------------------------------------------- diff --git a/cmake/cmake_celix/BundlePackaging.cmake b/cmake/cmake_celix/BundlePackaging.cmake index 7eb42fa..2071fca 100644 --- a/cmake/cmake_celix/BundlePackaging.cmake +++ b/cmake/cmake_celix/BundlePackaging.cmake @@ -94,36 +94,40 @@ function(add_bundle) list(REMOVE_AT ARGN 0) set(OPTIONS NO_ACTIVATOR) - set(ONE_VAL_ARGS VERSION ACTIVATOR SYMBOLIC_NAME NAME DESCRIPTION) + set(ONE_VAL_ARGS VERSION ACTIVATOR SYMBOLIC_NAME NAME DESCRIPTION FILENAME) set(MULTI_VAL_ARGS SOURCES PRIVATE_LIBRARIES EXPORT_LIBRARIES IMPORT_LIBRARIES HEADERS) cmake_parse_arguments(BUNDLE "${OPTIONS}" "${ONE_VAL_ARGS}" "${MULTI_VAL_ARGS}" ${ARGN}) ##check arguments - if(NOT BUNDLE_TARGET_NAME) + if (NOT BUNDLE_TARGET_NAME) message(FATAL_ERROR "add_bunde function requires first target name argument") - endif() - if((NOT (BUNDLE_SOURCES OR BUNDLE_ACTIVATOR)) AND (NOT BUNDLE_NO_ACTIVATOR)) + endif () + if ((NOT (BUNDLE_SOURCES OR BUNDLE_ACTIVATOR)) AND (NOT BUNDLE_NO_ACTIVATOR)) message(FATAL_ERROR "Bundle contain no SOURCES or ACTIVATOR target and the option NO_ACTIVATOR is not set") - endif() - if(BUNDLE_SOURCES AND BUNDLE_ACTIVATOR) + endif () + if (BUNDLE_SOURCES AND BUNDLE_ACTIVATOR) message(FATAL_ERROR "add_bundle function requires a value for SOURCES or ACTIVATOR not both") - endif() - if(BUNDLE_ACTIVATOR) + endif () + if (BUNDLE_ACTIVATOR) check_lib(${BUNDLE_ACTIVATOR}) - endif() + endif () #setting defaults if(NOT BUNDLE_VERSION) set(BUNDLE_VERSION "0.0.0") message(WARNING "Bundle version for ${BUNDLE_NAME} not provided. Using 0.0.0") - endif() + endif () if (NOT BUNDLE_NAME) set(BUNDLE_NAME ${BUNDLE_TARGET_NAME}) - endif() + endif () if (NOT BUNDLE_SYMBOLIC_NAME) set(BUNDLE_SYMBOLIC_NAME ${BUNDLE_TARGET_NAME}) - endif() - set(BUNDLE_FILE "${CMAKE_CURRENT_BINARY_DIR}/${BUNDLE_TARGET_NAME}.zip") + endif () + if (NOT BUNDLE_FILENAME) + set(BUNDLE_FILENAME ${BUNDLE_TARGET_NAME}.zip) + endif () + + set(BUNDLE_FILE "${CMAKE_CURRENT_BINARY_DIR}/${BUNDLE_FILENAME}") set(BUNDLE_CONTENT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${BUNDLE_TARGET_NAME}_content") set(BUNDLE_GEN_DIR "${CMAKE_CURRENT_BINARY_DIR}/${BUNDLE_TARGET_NAME}_gen") @@ -139,12 +143,20 @@ function(add_bundle) #create lib from sources add_library(${BUNDLE_TARGET_NAME} SHARED ${BUNDLE_SOURCES}) set_library_version(${BUNDLE_TARGET_NAME} ${BUNDLE_VERSION}) - set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_TARGET_IS_LIB" TRUE) + set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES + "BUNDLE_TARGET_IS_LIB" TRUE + "BUNDLE_BUILD_BUNDLE_TARGET" "${BUNDLE_TARGET_NAME}_bundle" + ) + target_link_libraries(${BUNDLE_TARGET_NAME} PRIVATE Celix::framework) else() add_custom_target(${BUNDLE_TARGET_NAME}) + set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES + "BUNDLE_TARGET_IS_LIB" FALSE + "BUNDLE_BUILD_BUNDLE_TARGET" "${BUNDLE_TARGET_NAME}_bundle" + ) endif() add_custom_target(${BUNDLE_TARGET_NAME}_bundle - DEPENDS "$<TARGET_PROPERTY:${BUNDLE_TARGET_NAME},BUNDLE_FILE>" + DEPENDS ${BUNDLE_TARGET_NAME} "$<TARGET_PROPERTY:${BUNDLE_TARGET_NAME},BUNDLE_FILE>" ) add_dependencies(bundles ${BUNDLE_TARGET_NAME}_bundle) ####################################################################### @@ -199,13 +211,18 @@ function(add_bundle) ############################# ### BUNDLE TARGET PROPERTIES ############################# + #alreadyer set + # BUNDLE_TARGET_IS_LIB -> true (can be use to test if target is bundle target + # BUNDLE_BUILD_BUNDLE_TARGET -> refers to the _bundle target which is responsible for building the zip file #internal use + set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_IS_BUNDLE_TARGET" TRUE) #indicate that this is a bundle target set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_DEPEND_TARGETS" "") #bundle target dependencies. Note can be extended after the add_bundle call set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_GEN_DIR" ${BUNDLE_GEN_DIR}) #location for generated output. #bundle specific - set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_CONTENT_DIR" ${BUNDLE_CONTENT_DIR}) #location where the content to be jar/zipped. - set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_FILE" ${BUNDLE_FILE}) #target bundle file (.zip) + set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_CONTENT_DIR" ${BUNDLE_CONTENT_DIR}) #location where the content to be jar/zipped. + set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_FILENAME" ${BUNDLE_FILENAME}) #target bundle filename (.zip) + set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_FILE" ${BUNDLE_FILE}) #target bundle abs file path (.zip) #name and version set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_NAME" ${BUNDLE_NAME}) #The bundle name default target name @@ -326,7 +343,7 @@ function(bundle_libs) if ("${LIB}" STREQUAL "${BUNDLE}") #ignore. Do not have to link agaist own lib elseif(IS_LIB) - target_link_libraries(${BUNDLE} ${LIB}) + target_link_libraries(${BUNDLE} PRIVATE ${LIB}) endif() endforeach() http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/cmake/cmake_celix/DeployPackaging.cmake ---------------------------------------------------------------------- diff --git a/cmake/cmake_celix/DeployPackaging.cmake b/cmake/cmake_celix/DeployPackaging.cmake index 21944c9..e7f8dc6 100644 --- a/cmake/cmake_celix/DeployPackaging.cmake +++ b/cmake/cmake_celix/DeployPackaging.cmake @@ -102,7 +102,7 @@ function(add_celix_container) include_directories(${CELIX_INCLUDE_DIRS}) add_executable(${CONTAINER_TARGET} ${LAUNCHER_SRC}) set_target_properties(${CONTAINER_TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CONTAINER_LOC}) - target_link_libraries(${CONTAINER_TARGET} ${CELIX_FRAMEWORK_LIBRARY} ${CELIX_UTILS_LIBRARY}) + target_link_libraries(${CONTAINER_TARGET} PRIVATE Celix::framework) set(LAUNCHER "$<TARGET_FILE:${CONTAINER_TARGET}>") endif () @@ -122,10 +122,10 @@ $<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_PROPERTIES>, #needed in the release.sh & run.sh files #Setting CELIX_LIB_DIRS, CELIX_BIN_DIR and CELIX_LAUNCHER - if (TARGET celix_framework) + if (TARGET framework) #Celix Main Project - set(CELIX_LIB_DIRS "$<TARGET_FILE_DIR:celix_framework>:$<TARGET_FILE_DIR:celix_utils>:$<TARGET_FILE_DIR:celix_dfi>") - set(CELIX_BIN_DIR "$<TARGET_FILE_DIR:celix>") + set(CELIX_LIB_DIRS "$<TARGET_FILE_DIR:Celix::framework>:$<TARGET_FILE_DIR:Celix::utils>:$<TARGET_FILE_DIR:Celix::dfi>") + set(CELIX_BIN_DIR "$<TARGET_FILE_DIR:Celix::launcher>") else () #CELIX_FRAMEWORK_LIBRARY and CELIX_LAUNCHER set by FindCelix.cmake -> Celix Based Project get_filename_component(CELIX_LIB_DIR ${CELIX_FRAMEWORK_LIBRARY} DIRECTORY) #Note assuming all celix libs are in the same dir @@ -214,17 +214,21 @@ function(celix_container_bundles_dir) set(OUT "${CONTAINER_LOC}/${BD_DIR_NAME}/${BUNDLE_FILENAME}") add_custom_command(OUTPUT ${OUT} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${BUNDLE} ${OUT} - COMMENT "Copying bundle '${BUNDLE}' to '${CONTAINER_LOC}/${BD_DIR_NAME}'" + COMMENT "Copying bundle '${BUNDLE}' to '${CONTAINER_LOC}/${BD_DIR_NAME}'" DEPENDS ${BUNDLE} ) else() - set(OUT "${CONTAINER_LOC}/${BD_DIR_NAME}/${BUNDLE}.zip") + string(MAKE_C_IDENTIFIER ${BUNDLE} BUNDLE_ID) #Create id with no special chars (e.g. for target like Celix::shell) + set(OUT "${CMAKE_BINARY_DIR}/celix/gen/${CONTAINER_TARGET}-copy-bundle-for-target-${BUNDLE_ID}.timestamp") + set(DEST "${CONTAINER_LOC}/${BD_DIR_NAME}/$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILENAME>") add_custom_command(OUTPUT ${OUT} - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILE>" ${OUT} + COMMAND ${CMAKE_COMMAND} -E touch ${OUT} + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILE>" ${DEST} COMMENT "Copying bundle '${BUNDLE}' to '${CONTAINER_LOC}/${BD_DIR_NAME}'" - DEPENDS ${BUNDLE} + DEPENDS $<TARGET_PROPERTY:${BUNDLE},BUNDLE_BUILD_BUNDLE_TARGET> ) - add_dependencies(${CONTAINER_TARGET} ${BUNDLE}_bundle) #ensure the the deploy depends on the _bundle target, custom_command depends on add_library + get_target_property(BUILD_BUNDLE_TARGET ${BUNDLE} BUNDLE_BUILD_BUNDLE_TARGET) + add_dependencies(${CONTAINER_TARGET} ${BUILD_BUNDLE_TARGET}) #ensure the the deploy depends on the _bundle target, custom_command depends on add_library endif() list(APPEND DEPS "${OUT}") @@ -247,19 +251,18 @@ function(celix_container_bundles) get_target_property(COPY ${CONTAINER_TARGET} "CONTAINER_COPY_BUNDLES") foreach(BUNDLE IN ITEMS ${ARGN}) + if (IS_ABSOLUTE ${BUNDLE} AND EXISTS ${BUNDLE}) + get_filename_component(BUNDLE_FILENAME ${BUNDLE} NAME) + set(COPY_LOC "bundles/${BUNDLE_FILENAME}") + set(ABS_LOC "${BUNDLE}") + else () #assume target (could be a future target -> if (TARGET ...) not possible + set(COPY_LOC "bundles/$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILENAME>") + set(ABS_LOC "$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILE>") + endif () if(COPY) - if(IS_ABSOLUTE ${BUNDLE} AND EXISTS ${BUNDLE}) - get_filename_component(BUNDLE_FILENAME ${BUNDLE} NAME) - list(APPEND BUNDLES "bundles/${BUNDLE_FILENAME}") - else() #assuming target - list(APPEND BUNDLES "bundles/${BUNDLE}.zip") - endif() + list(APPEND BUNDLES ${COPY_LOC}) else() - if(IS_ABSOLUTE ${BUNDLE} AND EXISTS ${BUNDLE}) - list(APPEND BUNDLES ${BUNDLE}) - else() #assuming target - list(APPEND BUNDLES "$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILE>") - endif() + list(APPEND BUNDLES ${ABS_LOC}) endif() endforeach() http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/cmake/cmake_celix/UseCelix.cmake ---------------------------------------------------------------------- diff --git a/cmake/cmake_celix/UseCelix.cmake b/cmake/cmake_celix/UseCelix.cmake new file mode 100644 index 0000000..db3f109 --- /dev/null +++ b/cmake/cmake_celix/UseCelix.cmake @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +set(CELIX_CMAKE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/..) +include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/BundlePackaging.cmake) +include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/DeployPackaging.cmake) +include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/DockerPackaging.cmake) +include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/Runtimes.cmake) http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/config_admin/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/config_admin/CMakeLists.txt b/config_admin/CMakeLists.txt index 8087662..e1db68e 100644 --- a/config_admin/CMakeLists.txt +++ b/config_admin/CMakeLists.txt @@ -16,7 +16,9 @@ # under the License. -celix_subproject(CONFIG_ADMIN "Option to enable building the Config Admin Service bundle and its examples" OFF DEPS framework launcher shell_tui log_writer) +#TODO refactor and improve impl +#celix_subproject(CONFIG_ADMIN "Option to enable building the Config Admin Service bundle and its examples" OFF DEPS framework launcher shell_tui log_writer) +set(CONFIG_AMDIN FALSE) if (CONFIG_ADMIN) add_subdirectory(service) @@ -49,7 +51,8 @@ if (CONFIG_ADMIN) NAME "config_admin" BUNDLES config_admin - shell shell_tui + Celix::shell + Celix::shell_tui log_service log_writer config_admin_example http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/config_admin/config_admin_tst/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/config_admin/config_admin_tst/CMakeLists.txt b/config_admin/config_admin_tst/CMakeLists.txt index e74e7bd..f0abb8c 100644 --- a/config_admin/config_admin_tst/CMakeLists.txt +++ b/config_admin/config_admin_tst/CMakeLists.txt @@ -32,7 +32,7 @@ SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) #TODO needed? SET(CMAKE_INSTALL_RPATH "${PROJECT_BINARY_DIR}/framework" "${PROJECT_BINARY_DIR}/utils" ) add_executable(config_admin_test config_admin_test.cpp) -target_link_libraries(config_admin_test celix_framework ${CELIX_LIBRARIES} ${CPPUTEST_LIBRARY} pthread) +target_link_libraries(config_admin_test Celix::framework ${CELIX_LIBRARIES} ${CPPUTEST_LIBRARY} pthread) get_property(config_admin_bundle_file TARGET config_admin PROPERTY BUNDLE_FILE) http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/config_admin/config_admin_tst/example_test/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/config_admin/config_admin_tst/example_test/CMakeLists.txt b/config_admin/config_admin_tst/example_test/CMakeLists.txt index d4c4b3d..2f87ca3 100644 --- a/config_admin/config_admin_tst/example_test/CMakeLists.txt +++ b/config_admin/config_admin_tst/example_test/CMakeLists.txt @@ -28,4 +28,4 @@ add_bundle(example_test private/src/example_managed_service_impl ) -target_link_libraries(example_test celix_framework celix_utils config_admin) +target_link_libraries(example_test PRIVATE Celix::framework celix_utils config_admin) http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/config_admin/config_admin_tst/example_test2/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/config_admin/config_admin_tst/example_test2/CMakeLists.txt b/config_admin/config_admin_tst/example_test2/CMakeLists.txt index d312673..25bc27a 100644 --- a/config_admin/config_admin_tst/example_test2/CMakeLists.txt +++ b/config_admin/config_admin_tst/example_test2/CMakeLists.txt @@ -27,4 +27,4 @@ add_bundle(example_test2 SOURCES VERSION 0.1.0 ) -target_link_libraries(example_test2 celix_framework celix_utils config_admin) +target_link_libraries(example_test2 Celix::framework celix_utils config_admin) http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/config_admin/example/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/config_admin/example/CMakeLists.txt b/config_admin/example/CMakeLists.txt index c1c80bd..6848073 100644 --- a/config_admin/example/CMakeLists.txt +++ b/config_admin/example/CMakeLists.txt @@ -23,5 +23,3 @@ add_bundle(config_admin_example private/src/bundle_activator private/src/example ) - -target_link_libraries(config_admin_example ${CELIX_FRAMEWORK_LIBRARY} ${CELIX_UTILS_LIBRARY}) http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/config_admin/service/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/config_admin/service/CMakeLists.txt b/config_admin/service/CMakeLists.txt index e194081..ba119e4 100644 --- a/config_admin/service/CMakeLists.txt +++ b/config_admin/service/CMakeLists.txt @@ -34,6 +34,3 @@ add_bundle(config_admin private/src/updated_thread_pool.c ) -target_link_libraries(config_admin celix_framework celix_utils ${APR_LIBRARY} ${APRUTIL_LIBRARY}) - - http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/dependency_manager/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/dependency_manager/CMakeLists.txt b/dependency_manager/CMakeLists.txt index 842f608..477a163 100644 --- a/dependency_manager/CMakeLists.txt +++ b/dependency_manager/CMakeLists.txt @@ -25,67 +25,75 @@ if (DEPENDENCY_MANAGER) exec_program(uname ARGS -m OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR) set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR} CACHE INTERNAL "processor type (i386 and x86_64)") if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") - add_definitions(-fPIC) + set(DM_COMP_OPT "-fPIC") endif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") endif(CMAKE_UNAME) endif(UNIX AND NOT WIN32) - add_bundle(dm_shell - SYMBOLIC_NAME "apache_celix_dm_shell" - VERSION "1.0.0" - NAME "Apache Celix DM Shell Commands" - SOURCES - private/src/dm_shell_activator - private/src/dm_shell_list_command - ) - target_link_libraries(dm_shell celix_framework celix_utils) - - add_library(dependency_manager_static STATIC - private/src/dm_component_impl - private/src/dm_service_dependency - private/src/dm_event - private/src/dm_dependency_manager_impl - private/src/dm_activator + src/dm_component_impl + src/dm_service_dependency + src/dm_event + src/dm_dependency_manager_impl + src/dm_activator ) - set_target_properties(dependency_manager_static PROPERTIES SOVERSION 1) + target_link_libraries(dependency_manager_static Celix::framework) + target_compile_options(dependency_manager_static PRIVATE ${DM_COMP_OPT}) add_library(dependency_manager_so SHARED - private/src/dm_component_impl - private/src/dm_service_dependency - private/src/dm_event - private/src/dm_dependency_manager_impl - private/src/dm_activator + src/dm_component_impl + src/dm_service_dependency + src/dm_event + src/dm_dependency_manager_impl + src/dm_activator ) set_target_properties(dependency_manager_so PROPERTIES SOVERSION 1) if (APPLE) - target_link_libraries(dependency_manager_so celix_framework "-undefined dynamic_lookup") + target_link_libraries(dependency_manager_so Celix::framework "-undefined dynamic_lookup") else() - target_link_libraries(dependency_manager_so celix_framework) + target_link_libraries(dependency_manager_so Celix::framework) endif() - include_directories("public/include") - include_directories("private/include") - include_directories("${PROJECT_SOURCE_DIR}/shell/public/include") - include_directories("${PROJECT_SOURCE_DIR}/utils/public/include") - target_link_libraries(dependency_manager_static celix_framework) - - install( - FILES - public/include/dm_activator.h - private/src/dm_activator.c - public/include/dm_component.h - public/include/dm_dependency_manager.h - public/include/dm_service_dependency.h - public/include/dm_info.h - DESTINATION - include/celix/dependency_manager - COMPONENT - dependency_manager - ) + target_include_directories(dependency_manager_static PUBLIC api) + target_include_directories(dependency_manager_static PRIVATE src) + target_include_directories(dependency_manager_so PUBLIC api) + target_include_directories(dependency_manager_so PRIVATE src) + + add_bundle(dm_shell + SYMBOLIC_NAME "apache_celix_dm_shell" + VERSION "1.0.0" + NAME "Apache Celix DM Shell Commands" + SOURCES + src/dm_shell_activator + src/dm_shell_list_command + ) + target_include_directories(dm_shell PRIVATE api src) + target_link_libraries(dm_shell PRIVATE Celix::shell_api) + +#TODO check +# install( +# FILES +# api/dm_activator.h +# src/dm_activator.c +# api/dm_component.h +# api/dm_dependency_manager.h +# apidm_service_dependency.h +# apidm_info.h +# DESTINATION +# include/celix/dependency_manager +# COMPONENT +# dependency_manager +# ) install_bundle(dm_shell) install(TARGETS dependency_manager_static DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT dependency_manager) install(TARGETS dependency_manager_so DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT dependency_manager) + unset(DM_COMP_OPT) + + + #Setup target aliases to match external usage + add_library(Celix::dm_shell ALIAS dm_shell) + add_library(Celix::dependency_manager_static ALIAS dependency_manager_static) + add_library(Celix::dependency_manager_so ALIAS dependency_manager_so) endif (DEPENDENCY_MANAGER) http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/dependency_manager/api/dm_activator.h ---------------------------------------------------------------------- diff --git a/dependency_manager/api/dm_activator.h b/dependency_manager/api/dm_activator.h new file mode 100644 index 0000000..bba62e6 --- /dev/null +++ b/dependency_manager/api/dm_activator.h @@ -0,0 +1,65 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * dm_activator_base.h + * + * \date 26 Jul 2014 + * \author <a href="mailto:[email protected]">Apache Celix Project Team</a> + * \copyright Apache License, Version 2.0 + */ + + +#ifndef DM_ACTIVATOR_BASE_H_ +#define DM_ACTIVATOR_BASE_H_ + + +#include "bundle_context.h" +#include "celix_errno.h" +#include "dm_dependency_manager.h" +#include "bundle_activator.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Should be implemented by a bundle specific DM activator. + * Should allocate and initialize a bundle specific activator struct. + */ +celix_status_t dm_create(bundle_context_pt context, void ** userData); + +/** + * Should be implemented by a bundle specific DM activator. + * Will be called after the dm_create function. + * Can be used to specify with use of the provided dependency manager the bundle specific components. + */ +celix_status_t dm_init(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager); + +/** + * Should be implemented by a bundle specific DM activator. + * Should deinitialize and deallocate the undle specific activator struct. + */ +celix_status_t dm_destroy(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager); + +#ifdef __cplusplus +} +#endif + +#endif /* DM_ACTIVATOR_BASE_H_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/dependency_manager/api/dm_component.h ---------------------------------------------------------------------- diff --git a/dependency_manager/api/dm_component.h b/dependency_manager/api/dm_component.h new file mode 100644 index 0000000..2cdad6d --- /dev/null +++ b/dependency_manager/api/dm_component.h @@ -0,0 +1,158 @@ +/** + *Licensed to the Apache Software Foundation (ASF) under one + *or more contributor license agreements. See the NOTICE file + *distributed with this work for additional information + *regarding copyright ownership. The ASF licenses this file + *to you under the Apache License, Version 2.0 (the + *"License"); you may not use this file except in compliance + *with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + *Unless required by applicable law or agreed to in writing, + *software distributed under the License is distributed on an + *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + *specific language governing permissions and limitations + *under the License. + */ +/* + * dm_component.h + * + * \date 8 Oct 2014 + * \author <a href="mailto:[email protected]">Apache Celix Project Team</a> + * \copyright Apache License, Version 2.0 + */ + +#ifndef COMPONENT_H_ +#define COMPONENT_H_ + + +#include <bundle_context.h> +#include <celix_errno.h> + +#include "dm_service_dependency.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct dm_component_struct *dm_component_pt; + +typedef enum dm_component_state_enum { + DM_CMP_STATE_INACTIVE = 1, + DM_CMP_STATE_WAITING_FOR_REQUIRED = 2, + DM_CMP_STATE_INSTANTIATED_AND_WAITING_FOR_REQUIRED = 3, + DM_CMP_STATE_TRACKING_OPTIONAL = 4, +} dm_component_state_t; + +#define DM_COMPONENT_MAX_ID_LENGTH 64 +#define DM_COMPONENT_MAX_NAME_LENGTH 128 + +typedef int (*init_fpt)(void *userData); +typedef int (*start_fpt)(void *userData); +typedef int (*stop_fpt)(void *userData); +typedef int (*deinit_fpt)(void *userData); + +/** + * Creates a DM Component + * Caller has ownership. + */ +celix_status_t component_create(bundle_context_pt context, const char* name, dm_component_pt *component); + +/** + * Destroys a DM Component + */ +void component_destroy(dm_component_pt component); + + +/** + * Specify if a default 'service.lang=C' should be added to the properties of interfaces if no 'service.lang' has been + * provided. Default is false. Note that this should be set before using component_addInterface. + */ +celix_status_t component_setCLanguageProperty(dm_component_pt component, bool setCLangProp); + + +/** + * Adds a C interface to provide as service to the Celix framework. + * + * @param serviceName the service name. + * @param version The version of the interface (e.g. "1.0.0"), Can be a NULL pointer. + * @param properties To (meta) properties to provide with the service. Can be a NULL pointer. + */ +celix_status_t component_addInterface(dm_component_pt component, const char* serviceName, const char* serviceVersion, const void* service, properties_pt properties); + +/** + * Sets the implementation of the component. e.g. the component handle/self/this pointer. + */ +celix_status_t component_setImplementation(dm_component_pt component, void* implementation); + +/** + * Returns an arraylist of service names. The caller owns the arraylist and strings (char *) + */ +celix_status_t component_getInterfaces(dm_component_pt component, array_list_pt *servicesNames); + +/** + * Adds a C service dependency to the component + */ +celix_status_t component_addServiceDependency(dm_component_pt component, dm_service_dependency_pt dep); + +/** + * Removes a C service dependency to the component + */ +celix_status_t component_removeServiceDependency(dm_component_pt component, dm_service_dependency_pt dependency); + +/** + * Returns the current state of the component. + */ +dm_component_state_t component_currentState(dm_component_pt cmp); + +/** + * Returns the implementation of the component. e.g. the component handle/self/this pointer. + */ +void * component_getImplementation(dm_component_pt cmp); + +/** + * Returns the DM component name. This is used when printing information about the component. + */ +const char * component_getName(dm_component_pt cmp); + +/** + * Returns bundle context for the bundle where this DM component is part of. + */ +celix_status_t component_getBundleContext(dm_component_pt component, bundle_context_pt *out); + +/** + * Set the component life cycle callbacks. + * The first argument will be the component implementation (@see component_getImplementation) + */ +celix_status_t component_setCallbacks(dm_component_pt component, init_fpt init, start_fpt start, stop_fpt stop, deinit_fpt deinit); + +/** + * Set the component life cycle callbacks using a MACRO for improving the type safety. + */ +#define component_setCallbacksSafe(dmCmp, type, init, start, stop, deinit) \ + do { \ + int (*tmp_init)(type) = (init); \ + int (*tmp_start)(type) = (start); \ + int (*tmp_stop)(type) = (stop); \ + int (*tmp_deinit)(type) = (deinit); \ + component_setCallbacks((dmCmp), (init_fpt)tmp_init, (start_fpt)tmp_start, (stop_fpt)tmp_stop, (deinit_fpt)tmp_deinit); \ + } while(0) + +/** + * Create a DM Component info struct. Containing information about the component. + * Caller has ownership. + */ +celix_status_t component_getComponentInfo(dm_component_pt component, dm_component_info_pt *info); + +/** + * Destroys a DM Component info struct. + */ +void component_destroyComponentInfo(dm_component_info_pt info); + +#ifdef __cplusplus +} +#endif + +#endif /* COMPONENT_H_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/dependency_manager/api/dm_dependency_manager.h ---------------------------------------------------------------------- diff --git a/dependency_manager/api/dm_dependency_manager.h b/dependency_manager/api/dm_dependency_manager.h new file mode 100644 index 0000000..89fe51d --- /dev/null +++ b/dependency_manager/api/dm_dependency_manager.h @@ -0,0 +1,79 @@ +/** + *Licensed to the Apache Software Foundation (ASF) under one + *or more contributor license agreements. See the NOTICE file + *distributed with this work for additional information + *regarding copyright ownership. The ASF licenses this file + *to you under the Apache License, Version 2.0 (the + *"License"); you may not use this file except in compliance + *with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + *Unless required by applicable law or agreed to in writing, + *software distributed under the License is distributed on an + *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + *specific language governing permissions and limitations + *under the License. + */ +/* + * dm_dependency_manager.h + * + * \date 22 Feb 2014 + * \author <a href="mailto:[email protected]">Apache Celix Project Team</a> + * \copyright Apache License, Version 2.0 + */ + +#ifndef DM_DEPENDENCY_MANAGER_H_ +#define DM_DEPENDENCY_MANAGER_H_ + + +#include "bundle_context.h" +#include "celix_errno.h" +#include "array_list.h" +#include "dm_info.h" +#include "dm_component.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct dm_dependency_manager *dm_dependency_manager_pt; + +/** + * Creates a dependency manager. + * Caller has ownership. + */ +celix_status_t dependencyManager_create(bundle_context_pt context, dm_dependency_manager_pt *manager); + +/** + * Destroys the provided dependency manager + */ +void dependencyManager_destroy(dm_dependency_manager_pt manager); + +/** + * Adds a DM component to the dependency manager + */ +celix_status_t dependencyManager_add(dm_dependency_manager_pt manager, dm_component_pt component); + +/** + * Removes all DM components from the dependency manager + */ +celix_status_t dependencyManager_removeAllComponents(dm_dependency_manager_pt manager); + +/** + * Create and returns a DM Info struct. Which contains information about the state of the DM components + * Caller has ownership. + */ +celix_status_t dependencyManager_getInfo(dm_dependency_manager_pt manager, dm_dependency_manager_info_pt *info); + +/** + * Destroys a DM info struct. + */ +void dependencyManager_destroyInfo(dm_dependency_manager_pt manager, dm_dependency_manager_info_pt info); + +#ifdef __cplusplus +} +#endif + +#endif /* DM_DEPENDENCY_MANAGER_H_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/dependency_manager/api/dm_info.h ---------------------------------------------------------------------- diff --git a/dependency_manager/api/dm_info.h b/dependency_manager/api/dm_info.h new file mode 100644 index 0000000..f5e6b47 --- /dev/null +++ b/dependency_manager/api/dm_info.h @@ -0,0 +1,81 @@ +/** + *Licensed to the Apache Software Foundation (ASF) under one + *or more contributor license agreements. See the NOTICE file + *distributed with this work for additional information + *regarding copyright ownership. The ASF licenses this file + *to you under the Apache License, Version 2.0 (the + *"License"); you may not use this file except in compliance + *with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + *Unless required by applicable law or agreed to in writing, + *software distributed under the License is distributed on an + *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + *specific language governing permissions and limitations + *under the License. + */ +/* + * dm_server.h + * + * \date 15 Oct 2015 + * \author <a href="mailto:[email protected]">Apache Celix Project Team</a> + * \copyright Apache License, Version 2.0 + */ +#ifndef CELIX_DM_INFO_SERVICE_H +#define CELIX_DM_INFO_SERVICE_H + + + +#include <stdbool.h> +#include "array_list.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define DM_INFO_SERVICE_NAME "dm_info" + + +typedef struct dm_interface_info_struct { + char* name; + properties_pt properties; +} * dm_interface_info_pt; + +typedef struct dm_service_dependency_info_struct { + char *filter; + bool available; + bool required; + size_t count; +} * dm_service_dependency_info_pt; + +typedef struct dm_component_info_struct { + char id[64]; + char name[128]; + bool active; + char * state; + array_list_pt interfaces; // type dm_interface_info_pt + array_list_pt dependency_list; // type dm_service_dependency_info_pt +} * dm_component_info_pt; + +typedef struct dm_dependency_manager_info_struct { + array_list_pt components; // type dm_component_info +} * dm_dependency_manager_info_pt; + +struct dm_info_service_struct { + void *handle; + + /*Note: dm_caller has the ownership of the result.*/ + celix_status_t (*getInfo)(void *handle, dm_dependency_manager_info_pt *info); + void (*destroyInfo)(void *handle, dm_dependency_manager_info_pt info); +}; + +typedef struct dm_info_service_struct dm_info_service_t; +typedef dm_info_service_t* dm_info_service_pt; + +#ifdef __cplusplus +} +#endif + +#endif //CELIX_DM_INFO_SERVICE_H
