This is an automated email from the ASF dual-hosted git repository. pnoltes pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/celix.git
commit 766d1de714c7ad502e37b401bb9af3df36d43d14 Author: Pepijn Noltes <[email protected]> AuthorDate: Fri Aug 16 14:07:43 2019 +0200 CELIX-464: Updates CMake command documentation. Also includes the CMake commands documentation as comments in the cmake files. --- cmake/cmake_celix/BundlePackaging.cmake | 180 +++++++++++++- cmake/cmake_celix/ContainerPackaging.cmake | 155 ++++++++++++ cmake/cmake_celix/DockerPackaging.cmake | 147 +++++++++++- documents/cmake_commands/README.md | 373 ++++++++++++++++++++--------- 4 files changed, 739 insertions(+), 116 deletions(-) diff --git a/cmake/cmake_celix/BundlePackaging.cmake b/cmake/cmake_celix/BundlePackaging.cmake index e67650b..4118847 100644 --- a/cmake/cmake_celix/BundlePackaging.cmake +++ b/cmake/cmake_celix/BundlePackaging.cmake @@ -52,8 +52,6 @@ macro(extract_version_parts VERSION MAJOR MINOR PATCH) if (CMAKE_MATCH_3) set(PATCH ${CMAKE_MATCH_3}) endif() - - #TODO add support qualifier endmacro() function(set_library_version TARGET VERSION) @@ -95,12 +93,71 @@ function(add_bundle) message(DEPRECATION "add_bundle is deprecated, use add_celix_bundle instead.") add_celix_bundle(${ARGN}) endfunction() + +#[[ +Add a Celix bundle to the project. There are three variants: +- With SOURCES the bundle will be created using a list of sources files as input for the bundle activator library. +- With ACTIVATOR the bundle will be created using the library target or absolute path to existing library as activator library. +- With the NO_ACTIVATOR option will create a bundle without a activator (i.e. a pure resource bundle). + +Optional arguments are: +- NAME: The (human readable) name of the bundle. This will be used as Bundle-Name manifest entry. Default is the <bundle_target_name>. +- SYMBOLIC_NAME: The symbolic name of the bundle. This will be used as Bundle-SymbolicName manifest entry. Default is the <bundle_target_name>. +- DESCRIPTION: The description of the bundle. This will be used as Bundle-Description manifest entry. Default this is empty. +- GROUP: The group the bundle is part of. This will be used as Bundle-Group manifest entry. Default this is empty (no group). +- VERSION: The bundle version. This will be used for the Bundle-Version manifest entry. In combination with SOURCES the version will also be used to set the activator library target property VERSION and SOVERSION. + For SOVERSION only the major part is used. Expected scheme is "<major>.<minor>.<path>". Default version is "0.0.0" +- FILENAME: The filename of the bundle file. Default is <bundle_target_name>.zip. +- PRIVATE_LIBRARIES: private libraries to be included in the bundle. Specified libraries are added to the "Private-Library" manifest statement and added in the root of the bundle. libraries can be cmake library targets or absolute paths to existing libraries. +- HEADERS: Additional headers values that are appended to the bundle manifest. + +```CMake +add_celix_bundle(<bundle_target_name> + SOURCES source1 source2 ... + [NAME bundle_name] + [SYMBOLIC_NAME bundle_symbolic_name] + [DESCRIPTION bundle_description] + [GROUP bundle_group] + [VERSION bundle_version] + [FILENAME bundle_filename] + [PRIVATE_LIBRARIES private_lib1 private_lib2 ...] + [HEADERS "header1: header1_value" "header2: header2_value" ...] +) +``` + +```CMake +add_celix_bundle(<bundle_target_name> + ACTIVATOR <activator_lib> + [NAME bundle_name] + [SYMBOLIC_NAME bundle_symbolic_name] + [DESCRIPTION bundle_description] + [GROUP bundle_group] + [VERSION bundle_version] + [FILENAME bundle_filename] + [PRIVATE_LIBRARIES private_lib1 private_lib2 ...] + [HEADERS "header1: header1_value" "header2: header2_value" ...] +) +``` + +```CMake +add_celix_bundle(<bundle_target_name> + NO_ACTIVATOR + [NAME bundle_name] + [SYMBOLIC_NAME bundle_symbolic_name] + [DESCRIPTION bundle_description] + [GROUP bundle_group] + [VERSION bundle_version] + [FILENAME bundle_filename] + [PRIVATE_LIBRARIES private_lib1 private_lib2 ...] + [HEADERS "header1: header1_value" "header2: header2_value" ...] +) +]] function(add_celix_bundle) list(GET ARGN 0 BUNDLE_TARGET_NAME) list(REMOVE_AT ARGN 0) set(OPTIONS NO_ACTIVATOR) - set(ONE_VAL_ARGS VERSION ACTIVATOR SYMBOLIC_NAME NAME DESCRIPTION FILE_NAME GROUP) + set(ONE_VAL_ARGS VERSION ACTIVATOR SYMBOLIC_NAME NAME DESCRIPTION FILENAME GROUP) set(MULTI_VAL_ARGS SOURCES PRIVATE_LIBRARIES EXPORT_LIBRARIES IMPORT_LIBRARIES HEADERS) cmake_parse_arguments(BUNDLE "${OPTIONS}" "${ONE_VAL_ARGS}" "${MULTI_VAL_ARGS}" ${ARGN}) @@ -300,6 +357,16 @@ function(bundle_private_libs) message(DEPRECATION "bundle_private_libs is deprecated, use celix_bundle_private_libs instead.") celix_bundle_private_libs(${ARGN}) endfunction() + +#[[ +Add libraries to a bundle. The libraries should be cmake library targets or an absolute path to an existing library. + +The libraries will be copied into the bundle zip and activator library will be linked (PRIVATE) against them. + +celix_bundle_private_libs(<bundle_target> + lib1 lib2 ... +) +]] function(celix_bundle_private_libs) list(GET ARGN 0 BUNDLE) list(REMOVE_AT ARGN 0) @@ -390,6 +457,7 @@ function(bundle_import_libs) message(DEPRECATION "bundle_import_libs is deprecated, use celix_bundle_import_libs instead.") celix_bundle_import_libs(${ARGN}) endfunction() + function(celix_bundle_import_libs) #0 is bundle TARGET #2..n is import libs @@ -420,7 +488,24 @@ function(bundle_files) message(DEPRECATION "bundle_files is deprecated, use celix_bundle_files instead.") celix_bundle_files(${ARGN}) endfunction() -#Note with celix_bundle_files, files are copied cmake generation time. Updates are not copied !! + +#[[ +Add files to the target bundle. DESTINATION is relative to the bundle archive root. +The rest of the command is conform file(COPY ...) cmake command. +See cmake file(COPY ...) command for more info. + +Note with celix_bundle_files, files are copied cmake generation time. Updates are not copied !! + +celix_bundle_files(<bundle_target> + files... DESTINATION <dir> + [FILE_PERMISSIONS permissions...] + [DIRECTORY_PERMISSIONS permissions...] + [NO_SOURCE_PERMISSIONS] [USE_SOURCE_PERMISSIONS] + [FILES_MATCHING] + [[PATTERN <pattern> | REGEX <regex>] + [EXCLUDE] [PERMISSIONS permissions...] [...] +) +]] function(celix_bundle_files) #0 is bundle TARGET list(GET ARGN 0 BUNDLE) @@ -529,8 +614,8 @@ function(celix_bundle_add_files) add_custom_command(OUTPUT ${TIMESTAMP} COMMAND ${CMAKE_COMMAND} -E touch ${TIMESTAMP} COMMAND ${CMAKE_COMMAND} -P ${COPY_CMAKE_SCRIPT} - DEPENDS ${COPY_FILES} - COMMENT "Copying files to ${DESTINATION}" + DEPENDS ${COPY_FILES} + COMMENT "Copying files to ${DESTINATION}" ) get_target_property(DEPS ${BUNDLE} "BUNDLE_DEPEND_TARGETS") @@ -542,6 +627,16 @@ function(bundle_headers) message(DEPRECATION "bundle_headers is deprecated, use celix_bundle_headers instead.") celix_bundle_headers(${ARGN}) endfunction() + +#[[ +Append the provided headers to the target bundle manifest. + +celix_bundle_headers(<bundle_target> + "header1: header1_value" + "header2: header2_value" + ... +) +]] function(celix_bundle_headers) #0 is bundle TARGET #1..n is header name / header value @@ -561,10 +656,19 @@ function(bundle_symbolic_name) message(DEPRECATION "bundle_symbolic_name is deprecated, use celix_bundle_symbolic_name instead.") celix_bundle_symbolic_name(${ARGN}) endfunction() + +#[[ +Set bundle symbolic name +celix_bundle_symbolic_name(<bundle_target> symbolic_name) +]] function(celix_bundle_symbolic_name BUNDLE SYMBOLIC_NAME) set_target_properties(${BUNDLE} PROPERTIES "BUNDLE_SYMBOLIC_NAME" ${SYMBOLIC_NAME}) endfunction() +#[[ +Set bundle group. +celix_bundle_group(<bundle_target> bundle group) +]] function(celix_bundle_group BUNDLE GROUP) set_target_properties(${BUNDLE} PROPERTIES "BUNDLE_GROUP" ${GROUP}) endfunction() @@ -573,6 +677,11 @@ function(bundle_name) message(DEPRECATION "bundle_name is deprecated, use celix_bundle_name instead.") celix_bundle_symbolic_name(${ARGN}) endfunction() + +#[[ +Set bundle name +celix_bundle_name(<bundle_target> name) +]] function(celix_bundle_name BUNDLE NAME) set_target_properties(${BUNDLE} PROPERTIES "BUNDLE_NAME" ${NAME}) endfunction() @@ -581,6 +690,11 @@ function(bundle_version) message(DEPRECATION "bundle_version is deprecated, use celix_bundle_version instead.") celix_bundle_symbolic_name(${ARGN}) endfunction() + +#[[ +Set bundle version +celix_bundle_version(<bundle_target> version) +]] function(celix_bundle_version BUNDLE VERSION) set_target_properties(${BUNDLE} PROPERTIES "BUNDLE_VERSION" ${VERSION}) endfunction() @@ -589,6 +703,11 @@ function(bundle_description) message(DEPRECATION "bundle_description is deprecated, use celix_bundle_description instead.") celix_bundle_symbolic_name(${ARGN}) endfunction() + +#[[ +Set bundle description +celix_bundle_description(<bundle_target> description) +]] function(celix_bundle_description BUNDLE DESC) set_target_properties(${BUNDLE} PROPERTIES "BUNDLE_DESCRIPTION" ${DESC}) endfunction() @@ -597,6 +716,29 @@ function(install_bundle) message(DEPRECATION "install_bundle is deprecated, use install_celix_bundle instead.") install_celix_bundle(${ARGN}) endfunction() + +#[[ +Install bundle when 'make install' is executed. +Bundles are installed at `<install-prefix>/share/<project_name>/bundles`. +Headers are installed at `<install-prefix>/include/<project_name>/<bundle_name>` +Resources are installed at `<install-prefix>/shared/<project_name>/<bundle_name>` + +Optional arguments: +- EXPORT: Associates the installed bundle with a export_name. + The export name can be used to generate a CelixTargets.cmake file (see install_celix_bundle_targets) +- PROJECT_NAME: The project name for installing. Default is the cmake project name. +- BUNDLE_NAME: The bundle name used when installing headers/resources. Default is the bundle target name. +- HEADERS: A list of headers to install for the bundle. +- RESOURCES: A list of resources to install for the bundle. + +install_celix_bundle(<bundle_target> + [EXPORT] export_name + [PROJECT_NAME] project_name + [BUNDLE_NAME] bundle_name + [HEADERS header_file1 header_file2 ...] + [RESOURCES resource1 resource2 ...] +) +]] function(install_celix_bundle) #0 is bundle TARGET list(GET ARGN 0 BUNDLE) @@ -641,6 +783,28 @@ function(install_celix_bundle) endfunction() + +#[[ +Generate and install a Celix Targets cmake file which contains CMake commands to create imported targets for the bundles +install using the provided <export_name>. These imported CMake targets can be used in in CMake project using the installed +bundles. + +Optional Arguments: +- FILE: The Celix Targets cmake filename to used. Default is <export_name>BundleTargets.cmake +- PROJECT_NAME: The project name to used for the share location. Default is the cmake project name. +- DESTINATION: The (relative) location to install the Celix Targets cmake file to. Default is share/<PROJECT_NAME>/cmake. + +install_celix_targets(<export_name> + NAMESPACE <namespace> + [FILE <celix_target_filename>] + [PROJECT_NAME <project_name>] + [DESTINATION <celix_targets_destination>] +) + +Example: +install_celix_targets(celix NAMESPACE Celix:: DESTINATION share/celix/cmake FILE CelixTargets.cmake) +]] + function(install_celix_bundle_targets) #0 is the export name list(GET ARGN 0 EXPORT_NAME) @@ -656,6 +820,10 @@ function(install_celix_bundle_targets) if (NOT DEFINED EXPORT_BUNDLES) message(FATAL_ERROR "Export ${EXPORT_NAME} not defined. Did you forgot to use a install_celix_bundle with the 'EXPORT ${EXPORT_NAME}' option?") endif () + if (NOT DEFINED EXPORT_NAMESPACE) + message(FATAL_ERROR "Please provide a namespace used for the generated cmake targets.") + endif () + if (NOT DEFINED EXPORT_FILE) set(EXPORT_FILE ${EXPORT_NAME}BundleTargets.cmake) diff --git a/cmake/cmake_celix/ContainerPackaging.cmake b/cmake/cmake_celix/ContainerPackaging.cmake index f0a464c..41d8e1e 100644 --- a/cmake/cmake_celix/ContainerPackaging.cmake +++ b/cmake/cmake_celix/ContainerPackaging.cmake @@ -33,6 +33,86 @@ function(add_deploy) message(DEPRECATION "deploy_bundles_dir is depecrated, use celix_container_bundles_dir instead.") add_celix_container(${ARGN}) endfunction() + +#[[ +Add a Celix container, consisting out of a selection of bundles and a Celix launcher. +Celix containers can be used to run/test a selection of bundles in the celix framework. +A Celix container will be build in `<cmake_build_dir>/deploy[/<group_name>]/<celix_container_name>`. +Use the `<celix_container_name>` executable to run the containers. + +There are three variants of 'add_celix_container': +- If no launcher is specified a custom Celix launcher will be generated. This launcher also contains the configured properties. +- If a LAUNCHER_SRC is provided a Celix launcher will be build using the provided sources. Additional sources can be added with the + CMake 'target_sources' command. +- If a LAUNCHER (absolute path to a executable of CMake `add_executable` target) is provided that will be used as Celix launcher. + +Creating a Celix containers using 'add_celix_container' will lead to a CMake executable target (expect if a LAUNCHER is used). +These targets can be used to run/debug Celix containers from a IDE (if the IDE supports CMake). + +Optional Arguments: +- COPY: With this option the used bundles are copied to the container build dir in the 'bundles' dir. + A additional result of this is that the configured references to the bundles are then relative instead of absolute. +- CXX: With this option the generated Celix launcher (if used) will be a C++ source instead of a C source. + A additional result of this is that Celix launcher is also linked against stdlibc++. +- USE_CONFIG: With this option config properties are generated in a 'config.properties' instead of embedded in the Celix launcher. +- GROUP: If configured the build location will be prefixed the GROUP. Default is empty. +- NAME: The name of the executable. Default is <celix_container_name>. Only useful for generated/LAUNCHER_SRC Celix launchers. +- DIR: The base build directory of the Celix container. Default is `<cmake_build_dir>/deploy`. +- BUNDLES: A list of bundles to configured for the Celix container to install and start. + These bundle will be configured for run level 3. See 'celix_container_bundles' for more info. +- PROPERTIES: A list of configuration properties, these can be used to configure the Celix framework and/or bundles. + Normally this will be EMBEDED_PROPERTIES, but if the USE_CONFIG option is used this will be RUNTIME_PROPERTIES. + See the framework library or bundles documentation about the available configuration options. +- EMBEDDED_PROPERTIES: A list of configuration properties which will be used in the generated Celix launcher. +- RUNTIME_PROPERTIES: A list of configuration properties which will be used in the generated config.properties file. + +```CMake +add_celix_container(<celix_container_name> + [COPY] + [CXX] + [USE_CONFIG] + [GROUP group_name] + [NAME celix_container_name] + [DIR dir] + [BUNDLES <bundle1> <bundle2> ...] + [PROPERTIES "prop1=val1" "prop2=val2" ...] + [EMBEDDED_PROPERTIES "prop1=val1" "prop2=val2" ...] + [RUNTIME_PROPERTIES "prop1=val1" "prop2=val2" ...] +) +``` + +```CMake +add_celix_container(<celix_container_name> + LAUNCHER launcher + [COPY] + [CXX] + [USE_CONFIG] + [GROUP group_name] + [NAME celix_container_name] + [DIR dir] + [BUNDLES <bundle1> <bundle2> ...] + [PROPERTIES "prop1=val1" "prop2=val2" ...] + [EMBEDDED_PROPERTIES "prop1=val1" "prop2=val2" ...] + [RUNTIME_PROPERTIES "prop1=val1" "prop2=val2" ...] +) +``` + +```CMake +add_celix_container(<celix_container_name> + LAUNCHER_SRC launcher_src + [COPY] + [CXX] + [USE_CONFIG] + [GROUP group_name] + [NAME celix_container_name] + [DIR dir] + [BUNDLES <bundle1> <bundle2> ...] + [PROPERTIES "prop1=val1" "prop2=val2" ...] + [EMBEDDED_PROPERTIES "prop1=val1" "prop2=val2" ...] + [RUNTIME_PROPERTIES "prop1=val1" "prop2=val2" ...] +) +``` +]] function(add_celix_container) list(GET ARGN 0 CONTAINER_TARGET) list(REMOVE_AT ARGN 0) @@ -232,6 +312,19 @@ function(deploy_bundles_dir) message(DEPRECATION "deploy_bundles_dir is depecrated, use celix_container_bundles_dir instead.") celix_container_bundles_dir(${ARGN}) endfunction() + +#[[ +Copy the specified bundles to a specified dir in the container build dir. + +```CMake +celix_container_bundles_dir(<celix_container_target_name> + DIR_NAME dir_name + BUNDLES + bundle1 + bundle2 + ... +) +]] function(celix_container_bundles_dir) list(GET ARGN 0 CONTAINER_TARGET) list(REMOVE_AT ARGN 0) @@ -305,6 +398,29 @@ function(deploy_bundles) message(DEPRECATION "deploy_bundles is depecrated, use celix_container_bundles instead.") celix_container_bundles(${ARGN}) endfunction() + +#[[ +Add the selected bundles to the Celix container. These bundles are (if configured) copied to the container build dir and +are added to the configuration properties so that they are installed and started when the Celix container executed. + +The Celix framework support 7 (0 - 6) run levels. Run levels can be used to control the start and stop order of bundles. +Bundles in run level 0 are started first and bundles in run level 6 are started last. +When stopping bundles in run level 6 are stopped first and bundles in run level 0 are stopped last. +Within a run level the order of configured decides the start order; bundles added earlier are started first. + + +Optional Arguments: +- LEVEL: The run level for the added bundles. Default is 3. + +```CMake +celix_container_bundles(<celix_container_target_name> + [LEVEL (0..5)] + bundle1 + bundle2 + ... +) +``` +]] function(celix_container_bundles) #0 is container TARGET #1..n is bundles @@ -379,6 +495,19 @@ endfunction() function(deploy_properties) celix_container_runtime_properties(${ARGN}) endfunction() + +#[[ +Add the provided properties to the target Celix container config properties. +These properties will be added to the config.properties in the container build dir. + +```CMake +celix_container_runtime_properties(<celix_container_target_name> + "prop1=val1" + "prop2=val2" + ... +) +``` +]] function(celix_container_runtime_properties) #0 is container TARGET #1..n is bundles @@ -398,6 +527,19 @@ function(deploy_embedded_properties) message(DEPRECATION "deploy_embedded_properties is depecrated, use celix_container_embedded_properties instead.") celix_container_embedded_properties(${ARGN}) endfunction() + +#[[ +Add the provided properties to the target Celix container config properties. +These properties will be embedded into the generated Celix launcher. + +```CMake +celix_container_embedded_properties(<celix_container_target_name> + "prop1=val1" + "prop2=val2" + ... +) +``` +]] function(celix_container_embedded_properties) #0 is container TARGET #1..n is bundles @@ -413,6 +555,19 @@ function(celix_container_embedded_properties) set_target_properties(${CONTAINER_TARGET} PROPERTIES "CONTAINER_EMBEDDED_PROPERTIES" "${PROPS}") endfunction() +#[[ +Add the provided properties to the target Celix container config properties. +If the USE_CONFIG option is used these configuration properties will be added to the 'config.properties' file else +these will be embedded into the generated Celix launcher. + +```CMake +celix_container_properties(<celix_container_target_name> + "prop1=val1" + "prop2=val2" + ... +) +``` +]] function(celix_container_properties) get_target_property(USE_CNF ${CONTAINER_TARGET} "CONTAINER_USE_CONFIG") if (USE_CNF) diff --git a/cmake/cmake_celix/DockerPackaging.cmake b/cmake/cmake_celix/DockerPackaging.cmake index 8556917..04217d3 100644 --- a/cmake/cmake_celix/DockerPackaging.cmake +++ b/cmake/cmake_celix/DockerPackaging.cmake @@ -40,12 +40,95 @@ if (NOT TARGET celix-build-docker-images) endif () ##### +#[[ +Adds a docker target dir, containing a all the required executables, +libraries, filesystem files and selected bundles needed to run a Apache Celix framework in a docker container. + +The 'add_celix_docker' target is a executable target and can be used to link libraries which are needed in the docker image. + +The docker dir can be found in `<cmake_build_dir>/docker[/<group_name>]/<docker_name>`. + +The docker directories are build with the target `celix-build-docker-dirs`, this does not create the +docker images and can also be executed on systems without docker. The `celix-build-docker-dirs` is trigger +with `make all`. + +The docker images are build with the target `celix-build-docker-images`. For this to work docker needs te installed +and the user executing the `celix-build-docker-images` should have right to create docker images. +The `celix-build-docker-images` is not triggered with `make all` + +There are three variants of 'add_celix_docker': +- If no launcher is specified a custom Celix launcher will be generated. This launcher also contains the configured properties. +- If a LAUNCHER_SRC is provided a Celix launcher will be build using the provided sources. Additional sources can be added with the + CMake 'target_sources' command. +- If a LAUNCHER (absolute path to a executable of CMake `add_executable` target) is provided that will be used as Celix launcher. + +Optional arguments: +- CXX: With this option the generated Celix launcher (if used) will be a C++ source instead of a C source. + A additional result of this is that Celix launcher is also linked against stdlibc++. +- GROUP: If configured the build location will be prefixed the GROUP. Default is empty. +- NAME: The name of the executable. Default is <docker_target_name>. Only useful for generated/LAUNCHER_SRC Celix launchers. +- FROM: Configured the docker image base. Default is scratch. + If configured a minimal filesystem will not be created! +- BUNDLES_DIR: Configures the directory where are all the bundles are copied. Default is /bundles. +- WORKDIR: Configures the workdir of the docker image. Default is /root. +- IMAGE_NAME: Configure the image name. Default is NAME. +- BUNDLES: Configures the used bundles. These bundles are configured for run level 3. see 'celix_docker_bundles' for more info. +- PROPERTIES: Configure configuration properties. +- INSTRUCTIONS: Additional dockker instruction to add the the generated Dockerfile. + +```CMake +add_celix_docker(<docker_target_name> + [CXX] + [GROUP group_name] + [NAME deploy_name] + [FROM docker_from_image] + [BUNDLES_DIR bundle_dir_in_docker_image] + [WORKDIR workdir_in_docker_image] + [IMAGE_NAME docker_image_name] + [BUNDLES <bundle1> <bundle2> ...] + [PROPERTIES "prop1=val1" "prop2=val2" ...] + [INSTRUCTIONS "instr1" "instr2" ...] +) +``` + +```CMake +add_celix_docker(<docker_target_name> + LAUNCHER_SRC launcher_src + [CXX] + [GROUP group_name] + [NAME deploy_name] + [FROM docker_from_image] + [BUNDLES_DIR bundle_dir_in_docker_image] + [WORKDIR workdir_in_docker_image] + [IMAGE_NAME docker_image_name] + [BUNDLES <bundle1> <bundle2> ...] + [PROPERTIES "prop1=val1" "prop2=val2" ...] + [INSTRUCTIONS "instr1" "instr2" ...] +) +``` + +```CMake +add_celix_docker(<docker_target_name> + LAUNCHER launcher + [CXX] + [GROUP group_name] + [NAME deploy_name] + [FROM docker_from_image] + [BUNDLES_DIR bundle_dir_in_docker_image] + [WORKDIR workdir_in_docker_image] + [IMAGE_NAME docker_image_name] + [BUNDLES <bundle1> <bundle2> ...] + [PROPERTIES "prop1=val1" "prop2=val2" ...] + [INSTRUCTIONS "instr1" "instr2" ...] +) +``` +]] function(add_celix_docker) list(GET ARGN 0 DOCKER_TARGET) list(REMOVE_AT ARGN 0) set(OPTIONS CXX) - set(ONE_VAL_ARGS GROUP NAME FROM BUNDLES_DIR WORKDIR IMAGE_NAME) + set(ONE_VAL_ARGS GROUP NAME FROM BUNDLES_DIR WORKDIR IMAGE_NAME LAUNCHER LAUNCHER_SRC) set(MULTI_VAL_ARGS BUNDLES PROPERTIES INSTRUCTIONS) cmake_parse_arguments(DOCKER "${OPTIONS}" "${ONE_VAL_ARGS}" "${MULTI_VAL_ARGS}" ${ARGN}) @@ -209,7 +292,7 @@ $<JOIN:$<TARGET_PROPERTY:${DOCKER_TARGET},DOCKER_PROPERTIES>, ) if (DOCKER_BUNDLES) - celix_docker_bundles(${DOCKER_TARGET} LEVEL 1 ${DOCKER_BUNDLES}) + celix_docker_bundles(${DOCKER_TARGET} LEVEL 3 ${DOCKER_BUNDLES}) endif() if (DOCKER_PROPERTIES) celix_docker_properties(${DOCKER_TARGET} ${DOCKER_PROPERTIES}) @@ -231,6 +314,28 @@ $<JOIN:$<TARGET_PROPERTY:${DOCKER_TARGET},DOCKER_PROPERTIES>, endfunction() +#[[ +Add the selected bundles to the Celix docker image. These bundles are copied to the docker build dir and +are added to the configuration properties so that they are installed and started when the Celix docker container is created and started. + +The Celix framework support 7 (0 - 6) run levels. Run levels can be used to control the start and stop order of bundles. +Bundles in run level 0 are started first and bundles in run level 6 are started last. +When stopping bundles in run level 6 are stopped first and bundles in run level 0 are stopped last. +Within a run level the order of configured decides the start order; bundles added earlier are started first. + + +Optional Arguments: +- LEVEL: The run level for the added bundles. Default is 3. + +```CMake +celix_docker_bundles(<celix_container_target_name> + [LEVEL (0..5)] + bundle1 + bundle2 + ... +) +``` +]] function(celix_docker_bundles) #0 is docker TARGET #1..n is bundles @@ -244,7 +349,7 @@ function(celix_docker_bundles) set(BUNDLES_LIST ${BUNDLES_UNPARSED_ARGUMENTS}) if (NOT DEFINED BUNDLES_LEVEL) - set(BUNDLES_LEVEL 1) + set(BUNDLES_LEVEL 3) endif () get_target_property(BUNDLES ${DOCKER_TARGET} "DOCKER_BUNDLES_LEVEL_${BUNDLES_LEVEL}") @@ -307,6 +412,18 @@ function(celix_docker_bundles) set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_DEPS" "${DEPS}") endfunction() +#[[ +Same as `celix_container_properties`, but then for the celix container +in the docker image. + +```CMake +celix_docker_properties(<docker_target_name> + "prop1=val1" + "prop2=val2" + ... +) +``` +]] function(celix_docker_properties) #0 is docker TARGET #1..n is properties @@ -322,6 +439,18 @@ function(celix_docker_properties) set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_PROPERTIES" "${PROPS}") endfunction() +#[[ +Same as `celix_container_embedded_properties`, but then for the celix container +in the docker image. + +```CMake +celix_docker_embedded_properties(<docker_target_name> + "prop1=val1" + "prop2=val2" + ... +) +``` +]] function(celix_docker_embedded_properties) #0 is docker TARGET #1..n is properties @@ -337,6 +466,18 @@ function(celix_docker_embedded_properties) set_target_properties(${DOCKER_TARGET} PROPERTIES "DOCKER_EMBEDDED_PROPERTIES" "${PROPS}") endfunction() +#[[ +Add the provided docker instruction to the end of the generated +Dockerfile. + +```CMake +celix_docker_instructions(<docker_target_name> + "instruction1" + "instruction2" + ... +) +``` +]] function(celix_docker_instructions) #0 is docker TARGET #1..n is instructions diff --git a/documents/cmake_commands/README.md b/documents/cmake_commands/README.md index 98d9834..dd6a59c 100644 --- a/documents/cmake_commands/README.md +++ b/documents/cmake_commands/README.md @@ -25,61 +25,65 @@ For Apache Celix several cmake command are added to be able to work with Apache Add a Celix bundle to the project. There are three variants: - With SOURCES the bundle will be created using a list of sources files as input for the bundle activator library. - With ACTIVATOR the bundle will be created using the library target or absolute path to existing library as activator library. -- With no SOURCES or ACTIVATOR a bundle without a activator will be created. +- With the NO_ACTIVATOR option will create a bundle without a activator (i.e. a pure resource bundle). + +Optional arguments are: +- NAME: The (human readable) name of the bundle. This will be used as Bundle-Name manifest entry. Default is the <bundle_target_name>. +- SYMBOLIC_NAME: The symbolic name of the bundle. This will be used as Bundle-SymbolicName manifest entry. Default is the <bundle_target_name>. +- DESCRIPTION: The description of the bundle. This will be used as Bundle-Description manifest entry. Default this is empty. +- GROUP: The group the bundle is part of. This will be used as Bundle-Group manifest entry. Default this is empty (no group). +- VERSION: The bundle version. This will be used for the Bundle-Version manifest entry. In combination with SOURCES the version will also be used to set the activator library target property VERSION and SOVERSION. + For SOVERSION only the major part is used. Expected scheme is "<major>.<minor>.<path>". Default version is "0.0.0" +- FILENAME: The filename of the bundle file. Default is <bundle_target_name>.zip. +- PRIVATE_LIBRARIES: private libraries to be included in the bundle. Specified libraries are added to the "Private-Library" manifest statement and added in the root of the bundle. libraries can be cmake library targets or absolute paths to existing libraries. +- HEADERS: Additional headers values that are appended to the bundle manifest. ```CMake -add_celix_bundle(<bundle_target_name> - SOURCES source1 source2 ... - [NAME bundle_name] - [SYMBOLIC_NAME bundle_symbolic_name] - [DESCRIPTION bundle_description] - [VERSION bundle_version] - [PRIVATE_LIBRARIES private_lib1 private_lib2 ...] - [EXPORT_LIBRARIES export_lib1 export_lib2 ...] - [IMPORT_LIBRARIES import_lib1 import_lib2 ...] - [HEADERS "header1: header1_value" "header2: header2_value" ...] +add_celix_bundle(<bundle_target_name> + SOURCES source1 source2 ... + [NAME bundle_name] + [SYMBOLIC_NAME bundle_symbolic_name] + [DESCRIPTION bundle_description] + [GROUP bundle_group] + [VERSION bundle_version] + [FILENAME bundle_filename] + [PRIVATE_LIBRARIES private_lib1 private_lib2 ...] + [HEADERS "header1: header1_value" "header2: header2_value" ...] ) ``` ```CMake -add_celix_bundle(<bundle_target_name> - ACTIVATOR <activator_lib> - [NAME bundle_name] - [SYMBOLIC_NAME bundle_symbolic_name] - [DESCRIPTION bundle_description] - [VERSION bundle_version] - [PRIVATE_LIBRARIES private_lib1 private_lib2 ...] - [EXPORT_LIBRARIES export_lib1 export_lib2 ...] - [IMPORT_LIBRARIES import_lib1 import_lib2 ...] - [HEADERS "header1: header1_value" "header2: header2_value" ...] +add_celix_bundle(<bundle_target_name> + ACTIVATOR <activator_lib> + [NAME bundle_name] + [SYMBOLIC_NAME bundle_symbolic_name] + [DESCRIPTION bundle_description] + [GROUP bundle_group] + [VERSION bundle_version] + [FILENAME bundle_filename] + [PRIVATE_LIBRARIES private_lib1 private_lib2 ...] + [HEADERS "header1: header1_value" "header2: header2_value" ...] ) ``` ```CMake -add_celix_bundle(<bundle_target_name> - [NAME bundle_name] - [SYMBOLIC_NAME bundle_symbolic_name] - [DESCRIPTION bundle_description] - [VERSION bundle_version] - [PRIVATE_LIBRARIES private_lib1 private_lib2 ...] - [EXPORT_LIBRARIES export_lib1 export_lib2 ...] - [IMPORT_LIBRARIES import_lib1 import_lib2 ...] - [HEADERS "header1: header1_value" "header2: header2_value" ...] +add_celix_bundle(<bundle_target_name> + NO_ACTIVATOR + [NAME bundle_name] + [SYMBOLIC_NAME bundle_symbolic_name] + [DESCRIPTION bundle_description] + [GROUP bundle_group] + [VERSION bundle_version] + [FILENAME bundle_filename] + [PRIVATE_LIBRARIES private_lib1 private_lib2 ...] + [HEADERS "header1: header1_value" "header2: header2_value" ...] ) ``` -- If NAME is provided that will be used as Bundle-Name. Default the bundle target name is used as symbolic name. -- If SYMBOLIC_NAME is provided that will be used as Bundle-SymbolicName. Default the bundle target name is used as symbolic name. -- If DESCRIPTION is provided that will be used as Bundle-Description. Default this is empty -- If VERSION is provided. That will be used for the Bundle-Version. In combination with SOURCES the version will also be used to set the activator library target property VERSION and SOVERSION. -For SOVERSION only the major part is used. Expected scheme is "<major>.<minor>.<path>". Default version is "0.0.0" -- If PRIVATE_LIBRARIES is provided all provided lib are added to the "Private-Library" manifest statement and added in the root of the bundle. libraries can be cmake library targets or absolute paths to existing libraries. -- If EXPORT_LIBRARIES is provided all provided lib are added to the "Export-Library" manifest statement and added in the root of the bundle. libraries can be cmake library targets or absolute paths to existing libraries. This is not yet supported by the celix framework. -- If IMPORT_LIBRARIES is provided all provided lib are added to the "Import-Library" manifest statement and added in the root of the bundle. libraries can be cmake library targets or absolute paths to existing libraries. This is not yet supported by the celix framework -- If HEADERS is provided the headers values are appended to the bundle manifest. - ## celix_bundle_private_libs -Add libraries to a bundle target. The libraries should be cmake library targets or an absolute path to a existing library. +Add libraries to a bundle. The libraries should be cmake library targets or an absolute path to an existing library. + +The libraries will be copied into the bundle zip and activator library will be linked (PRIVATE) against them. ```CMake celix_bundle_private_libs(<bundle_target> @@ -88,10 +92,13 @@ celix_bundle_private_libs(<bundle_target> ``` ## celix_bundle_files -Add files to the target bundle. DESTINATION is relative to the bundle archive root. +Add files to the target bundle. DESTINATION is relative to the bundle archive root. The rest of the command is conform file(COPY ...) cmake command. See cmake file(COPY ...) command for more info. +Note with celix_bundle_files files are copied cmake generation time. +Updates are not copied ! + ```CMake celix_bundle_files(<bundle_target> files... DESTINATION <dir> @@ -99,8 +106,9 @@ celix_bundle_files(<bundle_target> [DIRECTORY_PERMISSIONS permissions...] [NO_SOURCE_PERMISSIONS] [USE_SOURCE_PERMISSIONS] [FILES_MATCHING] - [[PATTERN <pattern> | REGEX <regex>] - [EXCLUDE] [PERMISSIONS permissions...]] [...] + [ [PATTERN <pattern> | REGEX <regex>] + [EXCLUDE] [PERMISSIONS permissions...] ] + [...] ) ``` @@ -144,14 +152,30 @@ Set bundle description celix_bundle_description(<bundle_target> description) ``` +## celix_bundle_group +Set bundle group. + +```CMake +celix_bundle_group(<bundle_target> bundle group) +``` + ## install_celix_bundle Install bundle when 'make install' is executed. Bundles are installed at `<install-prefix>/share/<project_name>/bundles`. Headers are installed at `<install-prefix>/include/<project_name>/<bundle_name>` Resources are installed at `<install-prefix>/shared/<project_name>/<bundle_name>` +Optional arguments: +- EXPORT: Associates the installed bundle with a export_name. + The export name can be used to generate a Celix Targets cmake file (see install_celix_bundle_targets) +- PROJECT_NAME: The project name for installing. Default is the cmake project name. +- BUNDLE_NAME: The bundle name used when installing headers/resources. Default is the bundle target name. +- HEADERS: A list of headers to install for the bundle. +- RESOURCES: A list of resources to install for the bundle. + ```CMake install_celix_bundle(<bundle_target> + [EXPORT] export_name [PROJECT_NAME] project_name [BUNDLE_NAME] bundle_name [HEADERS header_file1 header_file2 ...] @@ -159,77 +183,161 @@ install_celix_bundle(<bundle_target> ) ``` -- If PROJECT_NAME is provided that will be used as project name for installing. Default is the cmake project name. -- If BUNDLE_NAME is provided that will be used as bundle for installing the headers. Default is the bundle target name. -- If HEADERS is provided the list of provided headers will be installed. -- If RESOURCES is provided the list of provided resources will be installed. +## install_celix_targets +Generate and install a Celix Targets cmake file which contains CMake commands to create imported targets for the bundles +install using the provided <export_name>. These imported CMake targets can be used in in CMake project using the installed +bundles. + +Optional Arguments: +- FILE: The Celix Targets cmake filename to used. Default is <export_name>BundleTargets.cmake +- PROJECT_NAME: The project name to used for the share location. Default is the cmake project name. +- DESTINATION: The (relative) location to install the Celix Targets cmake file to. Default is share/<PROJECT_NAME>/cmake. + +```CMake +install_celix_targets(<export_name> + NAMESPACE <namespace> + [FILE <celix_target_filename>] + [PROJECT_NAME <project_name>] + [DESTINATION <celix_targets_destination>] +) +``` + +Example: +```CMake +install_celix_targets(celix NAMESPACE Celix:: DESTINATION share/celix/cmake FILE CelixTargets.cmake) +``` + + + + # Celix Containers +The 'add_celix_container' Celix CMake command can be used to create Celix containers. +Celix containers are executables preconfigured with configuration properties and bundles to run. ## add_celix_container Add a Celix container, consisting out of a selection of bundles and a simple Celix launcher. Celix containers can be used to run/test a selection of bundles in the celix framework. A Celix container can be found in `<cmake_build_dir>/deploy[/<group_name>]/<celix_container_name>`. -Use the `<celix_container_name>` executable to run the deployments. +Use the `<celix_container_name>` executable to run deployments. + +```CMake +Add a Celix container, consisting out of a selection of bundles and a Celix launcher. +Celix containers can be used to run/test a selection of bundles in the celix framework. +A Celix container will be build in `<cmake_build_dir>/deploy[/<group_name>]/<celix_container_name>`. +Use the `<celix_container_name>` executable to run the containers. + +There are three variants of 'add_celix_container': +- If no launcher is specified a custom Celix launcher will be generated. This launcher also contains the configured properties. +- If a LAUNCHER_SRC is provided a Celix launcher will be build using the provided sources. Additional sources can be added with the + CMake 'target_sources' command. +- If a LAUNCHER (absolute path to a executable of CMake `add_executable` target) is provided that will be used as Celix launcher. + +Creating a Celix containers using 'add_celix_container' will lead to a CMake executable target (expect if a LAUNCHER is used). +These targets can be used to run/debug Celix containers from a IDE (if the IDE supports CMake). + +Optional Arguments: +- COPY: With this option the used bundles are copied to the container build dir in the 'bundles' dir. + A additional result of this is that the configured references to the bundles are then relative instead of absolute. +- CXX: With this option the generated Celix launcher (if used) will be a C++ source instead of a C source. + A additional result of this is that Celix launcher is also linked against stdlibc++. +- USE_CONFIG: With this option config properties are generated in a 'config.properties' instead of embedded in the Celix launcher. +- GROUP: If configured the build location will be prefixed the GROUP. Default is empty. +- NAME: The name of the executable. Default is <celix_container_name>. Only useful for generated/LAUNCHER_SRC Celix launchers. +- DIR: The base build directory of the Celix container. Default is `<cmake_build_dir>/deploy`. +- BUNDLES: A list of bundles to configured for the Celix container to install and start. + These bundle will be configured for run level 3. See 'celix_container_bundles' for more info. +- PROPERTIES: A list of configuration properties, these can be used to configure the Celix framework and/or bundles. + Normally this will be EMBEDED_PROPERTIES, but if the USE_CONFIG option is used this will be RUNTIME_PROPERTIES. + See the framework library or bundles documentation about the available configuration options. +- EMBEDDED_PROPERTIES: A list of configuration properties which will be used in the generated Celix launcher. +- RUNTIME_PROPERTIES: A list of configuration properties which will be used in the generated config.properties file. + +```CMake +add_celix_container(<celix_container_name> + [COPY] + [CXX] + [USE_CONFIG] + [GROUP group_name] + [NAME celix_container_name] + [DIR dir] + [BUNDLES <bundle1> <bundle2> ...] + [PROPERTIES "prop1=val1" "prop2=val2" ...] + [EMBEDDED_PROPERTIES "prop1=val1" "prop2=val2" ...] + [RUNTIME_PROPERTIES "prop1=val1" "prop2=val2" ...] +) +``` ```CMake add_celix_container(<celix_container_name> - [COPY] + LAUNCHER launcher + [COPY] [CXX] [USE_CONFIG] [GROUP group_name] [NAME celix_container_name] - [LAUNCHER launcher] [DIR dir] [BUNDLES <bundle1> <bundle2> ...] [PROPERTIES "prop1=val1" "prop2=val2" ...] + [EMBEDDED_PROPERTIES "prop1=val1" "prop2=val2" ...] + [RUNTIME_PROPERTIES "prop1=val1" "prop2=val2" ...] ) ``` -- If the COPY option is provided the selected bundles will be copied in a bundles dir and the generated config.properties will use relative paths to the bundle locations. Default bundles will not be copied and the generated config.properties will use absolute references to the bundle locations. -- If CXX option is provided the celix container launcher will be build as C++ executable and as result be linked with the required C++ libraries of the used compiler. -- If USE_CONFIG option is provided a config.properties file will be generated next to the executable. The config.properties contains the configuration for the provided BUNDLES and PROPERTIES. -- If GROUP is provided the celix container will be grouped in the provided group name. -- If NAME is provided that name will be used for the celix container dir. Default the Celix container target name will be used. -- If LAUNCHER is provided that path or target will be used as launcher executable for the Celix container. If no LAUNCHER is not provided the celix executable will be used. -- If DIR is provided, the specified dir is used instead of `<cmake_build_dir>/deploy` as deploy dir . -- If BUNDLES is provided the list of bundles will be added the the generated executable/config.properties for startup. Combined with COPY the bundles will also be copied to a bundles dir. -- If PROPERTIES is provided the list of properties will be appended to the generated executable/config.properties. +```CMake +add_celix_container(<celix_container_name> + LAUNCHER_SRC launcher_src + [COPY] + [CXX] + [USE_CONFIG] + [GROUP group_name] + [NAME celix_container_name] + [DIR dir] + [BUNDLES <bundle1> <bundle2> ...] + [PROPERTIES "prop1=val1" "prop2=val2" ...] + [EMBEDDED_PROPERTIES "prop1=val1" "prop2=val2" ...] + [RUNTIME_PROPERTIES "prop1=val1" "prop2=val2" ...] +) +``` ## celix_container_bundles -Add the selected bundles to the container. -The bundles are configured for auto starting. +Add the selected bundles to the Celix container. These bundles are (if configured) copied to the container build dir and +are added to the configuration properties so that they are installed and started when the Celix container executed. + +The Celix framework support 7 (0 - 6) run levels. Run levels can be used to control the start and stop order of bundles. +Bundles in run level 0 are started first and bundles in run level 6 are started last. +When stopping bundles in run level 6 are stopped first and bundles in run level 0 are stopped last. +Within a run level the order of configured decides the start order; bundles added earlier are started first. + + +Optional Arguments: +- LEVEL: The run level for the added bundles. Default is 3. ```CMake celix_container_bundles(<celix_container_target_name> [LEVEL (0..5)] - bundle1 - bundle2 + bundle1 + bundle2 ... ) ``` -- If the LEVEL is provided this will be used as the bundle run level. - If no run level is provided run level 1 is used. - Run levels can be used to control to start order of the bundles. - Bundles in run level 0 are started first and bundles in run level 5 - are started last. - ## celix_container_properties -Add the provided properties to the target Celix container config.properties. - +Add the provided properties to the target Celix container config properties. +If the USE_CONFIG option is used these configuration properties will be added to the 'config.properties' file else they +will be added to the generated Celix launcher. ```CMake celix_container_properties(<celix_container_target_name> - "prop1=val1" - "prop2=val2" + "prop1=val1" + "prop2=val2" ... ) ``` ## celix_container_embedded_properties -Embeds the provided properties to the target Celix launcher as embedded properties. -Note that these properties can be overridden by using config.properties. +Add the provided properties to the target Celix container config properties. +These properties will be embedded into the generated Celix launcher. ```CMake celix_container_embedded_properties(<celix_container_target_name> @@ -239,28 +347,35 @@ celix_container_embedded_properties(<celix_container_target_name> ) ``` -## celix_container_bundles_dir -Deploy a selection of bundles to the provided bundle dir. This can be used to create an endpoints / proxies bundles dir for the remote service admin or drivers bundles dir for the device access. +## celix_container_runtime_properties +Add the provided properties to the target Celix container config properties. +These properties will be added to the config.properties in the container build dir. ```CMake -celix_container_bundles_dir(<celix_container_target_name> - DIR_NAME dir_name - BUNDLES - bundle1 - bundle2 - ... +celix_container_runtime_properties(<celix_container_target_name> + "prop1=val1" + "prop2=val2" + ... ) ``` + + + + + + + + # Celix Docker Images -It is possible the use the `add_celix_docker` Apache Celix CMake command to create Apache Celix docker directories, -which in turn can be used to create very small Apache Celix docker images. +The `add_celix_docker` Apache Celix CMake command can be used to create Apache Celix docker directories. +These directories can be used (with 'docker build' or podman) to create very small Apache Celix docker images. ## add_celix_docker -Adds a docker target dir, containing a all the required executables, -libraries, filesystem files and selected bundles needed to run a Apache Celix framework in a docker container. +Adds a docker target dir, containing a all the required executables, +libraries, filesystem files and selected bundles needed to run a Apache Celix framework in a docker container. -The add_celix_docker target is a executable target and can be used to link libraries which are needed in the docker image. +The 'add_celix_docker' target is a executable target and can be used to link libraries which are needed in the docker image. The docker dir can be found in `<cmake_build_dir>/docker[/<group_name>]/<docker_name>`. @@ -272,6 +387,26 @@ The docker images are build with the target `celix-build-docker-images`. For thi and the user executing the `celix-build-docker-images` should have right to create docker images. The `celix-build-docker-images` is not triggered with `make all` +There are three variants of 'add_celix_docker': +- If no launcher is specified a custom Celix launcher will be generated. This launcher also contains the configured properties. +- If a LAUNCHER_SRC is provided a Celix launcher will be build using the provided sources. Additional sources can be added with the + CMake 'target_sources' command. +- If a LAUNCHER (absolute path to a executable of CMake `add_executable` target) is provided that will be used as Celix launcher. + +Optional arguments: +- CXX: With this option the generated Celix launcher (if used) will be a C++ source instead of a C source. + A additional result of this is that Celix launcher is also linked against stdlibc++. +- GROUP: If configured the build location will be prefixed the GROUP. Default is empty. +- NAME: The name of the executable. Default is <docker_target_name>. Only useful for generated/LAUNCHER_SRC Celix launchers. +- FROM: Configured the docker image base. Default is scratch. + If configured a minimal filesystem will not be created! +- BUNDLES_DIR: Configures the directory where are all the bundles are copied. Default is /bundles. +- WORKDIR: Configures the workdir of the docker image. Default is /root. +- IMAGE_NAME: Configure the image name. Default is NAME. +- BUNDLES: Configures the used bundles. These bundles are configured for run level 3. see 'celix_docker_bundles' for more info. +- PROPERTIES: Configure configuration properties. +- INSTRUCTIONS: Additional dockker instruction to add the the generated Dockerfile. + ```CMake add_celix_docker(<docker_target_name> [CXX] @@ -287,26 +422,53 @@ add_celix_docker(<docker_target_name> ) ``` -- If CXX is set the entrypoint executable will be created as a C++ main file, default it is a C main file. -- If GROUP is provided the docker will be grouped in the provided group name. -- If NAME is provided that name will be used for the docker dir. Default the deploy target name will be used. -- If FROM is provided the docker image will use the provide FROM as base, else `FROM scratch` is used and - a minimal filesystem will be created for the docker image -- If BUNDLES_DIR is provided that directory will be used as bundles location. Default `/bundles` will be used -- If WORKDIR is provided that directory will be used a workdir. Default `/root` will be used -- If IMAGE_NAME is provided that will be used as docker image name. Default the NAME will be used -- If BUNDLES is provided, the list of bundles will be added to the docker images and configured in the generated - `config.properties` -- If PROPERTIES is provided, the list of properties will added to the generated `config.properties` file -- If INSTRUCTIONS id provided, the list of docker instructions will be added the the generated `Dockerfile` +```CMake +add_celix_docker(<docker_target_name> + LAUNCHER_SRC launcher_src + [CXX] + [GROUP group_name] + [NAME deploy_name] + [FROM docker_from_image] + [BUNDLES_DIR bundle_dir_in_docker_image] + [WORKDIR workdir_in_docker_image] + [IMAGE_NAME docker_image_name] + [BUNDLES <bundle1> <bundle2> ...] + [PROPERTIES "prop1=val1" "prop2=val2" ...] + [INSTRUCTIONS "instr1" "instr2" ...] +) +``` + +```CMake +add_celix_docker(<docker_target_name> + LAUNCHER launcher + [CXX] + [GROUP group_name] + [NAME deploy_name] + [FROM docker_from_image] + [BUNDLES_DIR bundle_dir_in_docker_image] + [WORKDIR workdir_in_docker_image] + [IMAGE_NAME docker_image_name] + [BUNDLES <bundle1> <bundle2> ...] + [PROPERTIES "prop1=val1" "prop2=val2" ...] + [INSTRUCTIONS "instr1" "instr2" ...] +) +``` ## celix_docker_bundles +Add the selected bundles to the Celix docker image. These bundles are copied to the docker build dir and +are added to the configuration properties so that they are installed and started when the Celix docker container is created and started. -Same as `celix_container_bundles`, but then for the celix container -in the docker image. +The Celix framework support 7 (0 - 6) run levels. Run levels can be used to control the start and stop order of bundles. +Bundles in run level 0 are started first and bundles in run level 6 are started last. +When stopping bundles in run level 6 are stopped first and bundles in run level 0 are stopped last. +Within a run level the order of configured decides the start order; bundles added earlier are started first. + + +Optional Arguments: +- LEVEL: The run level for the added bundles. Default is 3. ```CMake -celix_docker_bundles(<docker_target_name> +celix_docker_bundles(<celix_container_target_name> [LEVEL (0..5)] bundle1 bundle2 @@ -315,7 +477,6 @@ celix_docker_bundles(<docker_target_name> ``` ## celix_docker_properties - Same as `celix_container_properties`, but then for the celix container in the docker image. @@ -328,7 +489,6 @@ celix_docker_properties(<docker_target_name> ``` ## celix_docker_embedded_properties - Same as `celix_container_embedded_properties`, but then for the celix container in the docker image. @@ -341,7 +501,6 @@ celix_docker_embedded_properties(<docker_target_name> ``` ## celix_docker_instructions - Add the provided docker instruction to the end of the generated Dockerfile.
