Skip to content

Commit 4de66c3

Browse files
committed
Merge branch 'master' into feature/509-remove-cpputests
# Conflicts: # CHANGES.md
2 parents 1a67dab + 8f5a4e6 commit 4de66c3

File tree

23 files changed

+52
-941
lines changed

23 files changed

+52
-941
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ limitations under the License.
5353
- C Properties are no longer a direct typedef of `hashmap`.
5454
- celix_string/long_hashmap put functions now return a celix_status_t instead of bool (value replaced).
5555
THe celix_status_t is used to indicate an ENOMEM error.
56+
- Embedded bundles are no longer supported.
5657
- linked_list.h is removed and no longer supported. Use celix_array_list.h instead.
5758
- IP utils is refactored and the API is changed and all IP utils functions are now prefixed with `celix_utils_`.
5859
- array_list.h is removed and no longer supported. Use celix_array_list.h instead.

bundles/http_admin/http_admin/src/websocket_admin.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "websocket_admin.h"
2828

2929
#include "celix_compiler.h"
30+
#include "celix_stdlib_cleanup.h"
3031
#include "celix_utils_api.h"
3132

3233
struct websocket_admin_manager {
@@ -41,7 +42,7 @@ struct websocket_admin_manager {
4142
websocket_admin_manager_t *websocketAdmin_create(celix_bundle_context_t *context, struct mg_context *svr_ctx) {
4243
celix_status_t status;
4344

44-
websocket_admin_manager_t *admin = (websocket_admin_manager_t *) calloc(1, sizeof(websocket_admin_manager_t));
45+
celix_autofree websocket_admin_manager_t *admin = (websocket_admin_manager_t *) calloc(1, sizeof(websocket_admin_manager_t));
4546

4647
if (admin == NULL) {
4748
return NULL;
@@ -53,10 +54,10 @@ websocket_admin_manager_t *websocketAdmin_create(celix_bundle_context_t *context
5354

5455
if(status != CELIX_SUCCESS) {
5556
//No need to destroy other things
56-
free(admin);
57+
return NULL;
5758
}
5859

59-
return admin;
60+
return celix_steal_ptr(admin);
6061
}
6162

6263
void websocketAdmin_destroy(websocket_admin_manager_t *admin) {

cmake/celix_project/WarningTests.cmake

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,4 @@ if (ENABLE_CMAKE_WARNING_TESTS AND TARGET Celix::shell AND TARGET Celix::shell_t
3636
#Adding a bundle twice on different run levels should result in an warning
3737
celix_container_bundles(example_with_duplicate_bundles_1 LEVEL 4 Celix::shell_tui)
3838
celix_container_bundles(example_with_duplicate_bundles_1 LEVEL 4 Celix::shell)
39-
40-
add_celix_container(example_with_duplicate_bundles_2
41-
BUNDLES Celix::shell_tui #add bundles with run level 3
42-
)
43-
44-
#Adding an embedded bundle as install and later with a run level which is already added as a normal bundle
45-
#will not lead to a warning because multiple bundles are checked based on path and not based on the bundle
46-
#symbolic name.
47-
celix_container_embedded_bundles(example_with_duplicate_bundles_2 INSTALL Celix::shell_tui)
48-
celix_container_embedded_bundles(example_with_duplicate_bundles_2 LEVEL 3 Celix::shell_tui)
49-
50-
#Adding an embedded again will not lead to an warning (ignored)
51-
celix_container_embedded_bundles(example_with_duplicate_bundles_2 LEVEL 3 Celix::shell_tui)
52-
53-
#But adding an embedded bundle with a different run level will lead to an warning
54-
celix_container_embedded_bundles(example_with_duplicate_bundles_2 LEVEL 4 Celix::shell_tui)
5539
endif ()

cmake/cmake_celix/ContainerPackaging.cmake

Lines changed: 2 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ Optional Arguments:
6666
- C: With this option the generated Celix launcher (if used) will be a C source. Only one of the C or CXX options can
6767
be provided.
6868
Default is CXX
69-
- FAT: With this option only embedded bundles are allowed to be added to the container. Ensuring a container executable
70-
this is not dependent on external bundle zip files.
71-
Note that this option does not change anything to the container, it just ensure that all added bundles are embedded
72-
bundles.
7369
- USE_CONFIG: With this option the config properties are generated in a 'config.properties' instead of embedded in
7470
the Celix launcher.
7571
- GROUP: If configured the build location will be prefixed the GROUP. Default is empty.
@@ -79,14 +75,8 @@ Optional Arguments:
7975
- BUNDLES: A list of bundles for the Celix container to install and start.
8076
These bundle will be configured for run level 3. See 'celix_container_bundles' for more info.
8177
- INSTALL_BUNDLES: A list of bundles for the Celix container to install (but not start).
82-
- EMBEDDED_BUNDLES: A list of bundles to embed in the Celix container (inject as binary in the executable) and
83-
to install and start for the Celix container.
84-
See `celix_target_embedded_bundle` for more info about embedded bundles.
85-
- INSTALL_EMBEDDED_BUNDLES: A list of bundles to embed in the Celix container (inject as binary in the executable) and
86-
to install (but not start) for the Celix container.
87-
See `celix_target_embedded_bundle` for more info about embedded bundles.
8878
- PROPERTIES: A list of configuration properties, these can be used to configure the Celix framework and/or bundles.
89-
Normally this will be EMBEDED_PROPERTIES, but if the USE_CONFIG option is used this will be RUNTIME_PROPERTIES.
79+
Normally this will be EMBEDDED_PROPERTIES, but if the USE_CONFIG option is used this will be RUNTIME_PROPERTIES.
9080
See the framework library or bundles documentation about the available configuration options.
9181
- EMBEDDED_PROPERTIES: A list of configuration properties which will be used in the generated Celix launcher.
9282
- RUNTIME_PROPERTIES: A list of configuration properties which will be used in the generated config.properties file.
@@ -97,15 +87,12 @@ add_celix_container(<celix_container_name>
9787
[NO_COPY]
9888
[CXX]
9989
[C]
100-
[FAT]
10190
[USE_CONFIG]
10291
[GROUP group_name]
10392
[NAME celix_container_name]
10493
[DIR dir]
10594
[BUNDLES <bundle1> <bundle2> ...]
10695
[INSTALL_BUNDLES <bundle1> <bundle2> ...]
107-
[EMBEDDED_BUNDLES <bundle1> <bundle2> ...]
108-
[INSTALL_EMBEDDED_BUNDLES <bundle1> <bundle2> ...]
10996
[PROPERTIES "prop1=val1" "prop2=val2" ...]
11097
[EMBEDDED_PROPERTIES "prop1=val1" "prop2=val2" ...]
11198
[RUNTIME_PROPERTIES "prop1=val1" "prop2=val2" ...]
@@ -119,15 +106,12 @@ add_celix_container(<celix_container_name>
119106
[NO_COPY]
120107
[CXX]
121108
[C]
122-
[FAT]
123109
[USE_CONFIG]
124110
[GROUP group_name]
125111
[NAME celix_container_name]
126112
[DIR dir]
127113
[BUNDLES <bundle1> <bundle2> ...]
128114
[INSTALL_BUNDLES <bundle1> <bundle2> ...]
129-
[EMBEDDED_BUNDLES <bundle1> <bundle2> ...]
130-
[INSTALL_EMBEDDED_BUNDLES <bundle1> <bundle2> ...]
131115
[PROPERTIES "prop1=val1" "prop2=val2" ...]
132116
[EMBEDDED_PROPERTIES "prop1=val1" "prop2=val2" ...]
133117
[RUNTIME_PROPERTIES "prop1=val1" "prop2=val2" ...]
@@ -141,15 +125,12 @@ add_celix_container(<celix_container_name>
141125
[NO_COPY]
142126
[CXX]
143127
[C]
144-
[FAT]
145128
[USE_CONFIG]
146129
[GROUP group_name]
147130
[NAME celix_container_name]
148131
[DIR dir]
149132
[BUNDLES <bundle1> <bundle2> ...]
150133
[INSTALL_BUNDLES <bundle1> <bundle2> ...]
151-
[EMBEDDED_BUNDLES <bundle1> <bundle2> ...]
152-
[INSTALL_EMBEDDED_BUNDLES <bundle1> <bundle2> ...]
153134
[PROPERTIES "prop1=val1" "prop2=val2" ...]
154135
[EMBEDDED_PROPERTIES "prop1=val1" "prop2=val2" ...]
155136
[RUNTIME_PROPERTIES "prop1=val1" "prop2=val2" ...]
@@ -169,28 +150,14 @@ add_celix_container(simple_container
169150
CELIX_LOGGING_DEFAULT_ACTIVE_LOG_LEVEL=debug
170151
)
171152
```
172-
173-
```CMake
174-
#Creates a "fat" Celix container in ${CMAKE_BINARY_DIR}/deploy/simple_fat_container which starts 3 bundles embedded
175-
#in the container executable.
176-
add_celix_container(simple_fat_container
177-
FAT
178-
EMBEDDED_BUNDLES
179-
Celix::shell
180-
Celix::shell_tui
181-
Celix::log_admin
182-
PROPERTIES
183-
CELIX_LOGGING_DEFAULT_ACTIVE_LOG_LEVEL=debug
184-
)
185-
```
186153
]]
187154
function(add_celix_container)
188155
list(GET ARGN 0 CONTAINER_TARGET)
189156
list(REMOVE_AT ARGN 0)
190157

191158
set(OPTIONS COPY NO_COPY C CXX FAT USE_CONFIG)
192159
set(ONE_VAL_ARGS GROUP NAME LAUNCHER LAUNCHER_SRC DIR)
193-
set(MULTI_VAL_ARGS BUNDLES INSTALL_BUNDLES EMBEDDED_BUNDLES INSTALL_EMBEDDED_BUNDLES PROPERTIES EMBEDDED_PROPERTIES RUNTIME_PROPERTIES)
160+
set(MULTI_VAL_ARGS BUNDLES INSTALL_BUNDLES PROPERTIES EMBEDDED_PROPERTIES RUNTIME_PROPERTIES)
194161
cmake_parse_arguments(CONTAINER "${OPTIONS}" "${ONE_VAL_ARGS}" "${MULTI_VAL_ARGS}" ${ARGN})
195162

196163
##### Check arguments #####
@@ -370,7 +337,6 @@ $<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_RUNTIME_PROPERTIES>,
370337
set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_BUNDLES_LEVEL_6" "") #bundles to deploy for the container for startup level 6
371338
set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_BUNDLES_INSTALL" "") #bundles to install for the container
372339
set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_COPY_BUNDLES" ${CONTAINER_COPY}) #copy bundles in bundle dir or link using abs paths. NOTE this cannot be changed after a add_deploy command
373-
set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_IS_FAT" ${CONTAINER_FAT}) #Whether this is a fat container, so a container with only embedded bundles.
374340

375341
#deploy specific
376342
set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_NAME" "${CONTAINER_NAME}")
@@ -382,9 +348,7 @@ $<JOIN:$<TARGET_PROPERTY:${CONTAINER_TARGET},CONTAINER_RUNTIME_PROPERTIES>,
382348
#####
383349

384350
celix_container_bundles(${CONTAINER_TARGET} LEVEL 3 ${CONTAINER_BUNDLES})
385-
celix_container_embedded_bundles(${CONTAINER_TARGET} LEVEL 3 ${CONTAINER_EMBEDDED_BUNDLES})
386351
celix_container_bundles(${CONTAINER_TARGET} INSTALL ${CONTAINER_INSTALL_BUNDLES})
387-
celix_container_embedded_bundles(${CONTAINER_TARGET} INSTALL ${CONTAINER_INSTALL_EMBEDDED_BUNDLES})
388352
if (CONTAINER_USE_CONFIG)
389353
celix_container_runtime_properties(${CONTAINER_TARGET} ${CONTAINER_PROPERTIES})
390354
else ()
@@ -560,7 +524,6 @@ function(celix_container_bundles)
560524
get_target_property(BUNDLES ${CONTAINER_TARGET} "CONTAINER_BUNDLES_LEVEL_${BUNDLES_LEVEL}")
561525
endif ()
562526
get_target_property(COPY ${CONTAINER_TARGET} "CONTAINER_COPY_BUNDLES")
563-
get_target_property(IS_FAT ${CONTAINER_TARGET} "CONTAINER_IS_FAT")
564527

565528
if (BUNDLES_COPY)
566529
set(COPY TRUE)
@@ -569,10 +532,6 @@ function(celix_container_bundles)
569532
endif ()
570533

571534
foreach(BUNDLE IN ITEMS ${BUNDLES_LIST})
572-
if (IS_FAT)
573-
message(FATAL_ERROR "Cannot add bundle ${BUNDLE} to Celix container ${CONTAINER_TARGET}. ${CONTAINER_TARGET} is configured as a fat container, so only embedded bundles are allowed. Use EMBEDDED_BUNDLES instead of BUNDLES in the add_celix_container CMake command.")
574-
endif ()
575-
576535
if (TARGET ${BUNDLE})
577536
get_target_property(TARGET_TYPE ${BUNDLE} TYPE)
578537
if (TARGET_TYPE STREQUAL "INTERFACE_LIBRARY")
@@ -643,90 +602,6 @@ function(_celix_container_check_duplicate_bundles)
643602
endforeach()
644603
endfunction()
645604

646-
#[[
647-
Embed a selection of bundles to the Celix container.
648-
649-
```CMake
650-
celix_container_embedded_bundles(<celix_container_target_name>
651-
[LEVEL (0..6)]
652-
[INSTALL]
653-
bundle1
654-
bundle2
655-
...
656-
)
657-
```
658-
659-
Example:
660-
```CMake
661-
celix_container_embedded_bundles(my_container Celix::shell Celix::shell_tui)
662-
```
663-
664-
The selection of bundles are embedded in the container executable using the
665-
`celix_target_embedded_bundle` Celix CMake command and are added to the configuration properties so that they are
666-
installed and started when the Celix container is executed.
667-
668-
See `celix_target_embedded_bundle` for how bundle is embedded in a executable.
669-
670-
The Celix framework supports 7 (0 - 6) run levels. Run levels can be used to control the start and stop order of bundles.
671-
Bundles in run level 0 are started first and bundles in run level 6 are started last.
672-
When stopping bundles in run level 6 are stopped first and bundles in run level 0 are stopped last.
673-
Within a run level the order of configured decides the start order; bundles added earlier are started first.
674-
675-
Optional Arguments:
676-
- LEVEL: The run level for the added bundles. Default is 3.
677-
- INSTALL: If this option is present, the bundles will only be installed instead of the default install and start.
678-
The bundles will be installed after all bundle in LEVEL 0..6 are installed and started.
679-
]]
680-
function(celix_container_embedded_bundles)
681-
#0 is container TARGET
682-
list(GET ARGN 0 CONTAINER_TARGET)
683-
list(REMOVE_AT ARGN 0)
684-
685-
set(OPTIONS INSTALL)
686-
set(ONE_VAL_ARGS LEVEL)
687-
set(MULTI_VAL_ARGS )
688-
cmake_parse_arguments(BUNDLES "${OPTIONS}" "${ONE_VAL_ARGS}" "${MULTI_VAL_ARGS}" ${ARGN})
689-
set(BUNDLES_LIST ${BUNDLES_UNPARSED_ARGUMENTS})
690-
691-
if (NOT DEFINED BUNDLES_LEVEL)
692-
set(BUNDLES_LEVEL 3)
693-
endif ()
694-
695-
if (BUNDLES_INSTALL)
696-
get_target_property(BUNDLES ${CONTAINER_TARGET} "CONTAINER_BUNDLES_INSTALL")
697-
else () #bundle level 0,1,2,3,4,5 or 6
698-
get_target_property(BUNDLES ${CONTAINER_TARGET} "CONTAINER_BUNDLES_LEVEL_${BUNDLES_LEVEL}")
699-
endif ()
700-
701-
foreach(BUNDLE IN ITEMS ${BUNDLES_LIST})
702-
if (TARGET ${BUNDLE})
703-
celix_get_bundle_symbolic_name(${BUNDLE} NAME)
704-
add_celix_bundle_dependencies(${CONTAINER_TARGET} ${BUNDLE})
705-
elseif (IS_ABSOLUTE ${BUNDLE} AND EXISTS ${BUNDLE})
706-
get_filename_component(RAW_NAME ${BUNDLE} NAME_WE)
707-
string(MAKE_C_IDENTIFIER ${RAW_NAME} NAME)
708-
else()
709-
message(FATAL_ERROR "Cannot add bundle `${BUNDLE}` to container target ${CONTAINER_TARGET}. Argument is not a path or cmake target")
710-
endif ()
711-
celix_target_embedded_bundle(${CONTAINER_TARGET} BUNDLE ${BUNDLE} NAME ${NAME})
712-
set(BUNDLE_TO_ADD "embedded://${NAME}")
713-
714-
list(FIND BUNDLES ${BUNDLE_TO_ADD} INDEX)
715-
if (INDEX EQUAL -1) #Note this ignores the same bundle for the same level
716-
_celix_container_check_duplicate_bundles(${CONTAINER_TARGET} ${BUNDLE_TO_ADD} ${BUNDLES_LEVEL})
717-
list(APPEND BUNDLES ${BUNDLE_TO_ADD})
718-
endif ()
719-
endforeach()
720-
721-
722-
723-
if (BUNDLES_INSTALL)
724-
set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_BUNDLES_INSTALL" "${BUNDLES}")
725-
else () #bundle level 0,1,2,3,4,5 or 6
726-
set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_BUNDLES_LEVEL_${BUNDLES_LEVEL}" "${BUNDLES}")
727-
endif ()
728-
endfunction()
729-
730605
function(deploy_properties)
731606
celix_container_runtime_properties(${ARGN})
732607
endfunction()

0 commit comments

Comments
 (0)