Skip to content

Commit

Permalink
Merge branch 'master' into feature/511-remove-resolver
Browse files Browse the repository at this point in the history
# Conflicts:
#	libs/framework/CMakeLists.txt
  • Loading branch information
PengZheng committed Aug 1, 2023
2 parents d6637a9 + 2683e8b commit 4ce9a10
Show file tree
Hide file tree
Showing 313 changed files with 5,152 additions and 2,199 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/conan_create.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Conan Create

on:
push:
pull_request:
schedule:
- cron: '0 0 * * *'

jobs:

ubuntu-build:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
compiler: [ [gcc,g++], [clang,clang++] ]
type: [ Debug ]
timeout-minutes: 120
steps:
- name: Checkout source code
uses: actions/checkout@v3.3.0
- name: Install build dependencies
run: |
sudo pip install -U conan==1.59.0
sudo apt-get install -yq --no-install-recommends ninja-build
- name: Setup Conan Profile
env:
CC: ${{ matrix.compiler[0] }}
CXX: ${{ matrix.compiler[1] }}
run: |
# build profile
conan profile new release --detect
conan profile update settings.build_type=Release release
#Note no backwards compatiblity for gcc5 needed, setting libcxx to c++11.
conan profile update settings.compiler.libcxx=libstdc++11 release
conan profile show release
# host profile
conan profile new default --detect
conan profile update settings.build_type=${{ matrix.type }} default
#Note no backwards compatiblity for gcc5 needed, setting libcxx to c++11.
conan profile update settings.compiler.libcxx=libstdc++11 default
conan profile show default
- name: Create Celix
env:
CC: ${{ matrix.compiler[0] }}
CXX: ${{ matrix.compiler[1] }}
CONAN_CMAKE_GENERATOR: Ninja
run: |
conan inspect . -a options | awk 'BEGIN { FS="[\t:]+" } /build/ && !/build_all/ { print $1}' | while read option; do conan create . -b missing -o celix:${option}=True -pr:b release -pr:h default -tf examples/conan_test_package -tbf test-build -o celix:celix_cxx17=True -o celix:celix_install_deprecated_api=True --require-override=libcurl/7.64.1 --require-override=openssl/1.1.1s --require-override=zlib/1.2.13 || exit 1; done
mac-build:
runs-on: macOS-11
timeout-minutes: 120
steps:
- name: Checkout source code
uses: actions/checkout@v3.3.0
- name: Install build dependencies
run: |
brew install python ninja
pip3 install -U conan==1.59.0
- name: Setup Conan Profile
run: |
conan profile new default --detect
conan profile update settings.build_type=Release default
- name: Create Celix
env:
CC: ${{ matrix.compiler[0] }}
CXX: ${{ matrix.compiler[1] }}
CONAN_CMAKE_GENERATOR: Ninja
run: |
conan inspect . -a options | awk 'BEGIN { FS="[\t:]+" } /build/ && !/build_all/ { print $1}' | while read option; do conan create . -b missing -o celix:${option}=True -pr:b default -pr:h default -tf examples/conan_test_package -tbf test-build -o celix:celix_cxx17=True -o celix:celix_install_deprecated_api=True --require-override=libcurl/7.64.1 --require-override=openssl/1.1.1s --require-override=zlib/1.2.13 || exit 1; done
3 changes: 2 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ jobs:
-o celix:enable_code_coverage=True
-o celix:enable_testing_for_cxx14=True
-o celix:enable_testing_dependency_manager_for_cxx11=True
-o celix:enable_testing_on_ci=True
run: |
#force reequire libcurl 7.64.1, due to a sha256 verify issue in libcurl/7.87.0
#force require libcurl 7.64.1, due to a sha256 verify issue in libcurl/7.87.0
conan install . celix/ci -pr:b default -pr:h default -if build ${CONAN_BUILD_OPTIONS} -b missing -b cpputest --require-override=libcurl/7.64.1 --require-override=openssl/1.1.1s
- name: Build
run: |
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:

build-conan:
macos-build-conan:
runs-on: macOS-11
timeout-minutes: 120
steps:
Expand All @@ -30,8 +30,9 @@ jobs:
-o celix:build_all=True
-o celix:enable_testing_for_cxx14=True
-o celix:enable_testing_dependency_manager_for_cxx11=True
-o celix:enable_testing_on_ci=True
run: |
#force reequire libcurl 7.64.1, due to a sha256 verify issue in libcurl/7.87.0
#force require libcurl 7.64.1, due to a sha256 verify issue in libcurl/7.87.0
conan install . celix/ci -pr:b default -pr:h default -if build ${CONAN_BUILD_OPTIONS} -b missing -b cpputest --require-override=libcurl/7.64.1 --require-override=openssl/1.1.1s
- name: Build
run: |
Expand All @@ -44,11 +45,8 @@ jobs:
source activate_run.sh
ctest --output-on-failure
source deactivate_run.sh
- name: Test Installed Celix
run: |
conan create -pr:b default -pr:h default -tf examples/conan_test_package -tbf test-build -o celix:celix_cxx17=True -o celix:celix_install_deprecated_api=True --require-override=libcurl/7.64.1 --require-override=openssl/1.1.1s .
build-brew:
macos-build-brew:
runs-on: macOS-latest
timeout-minutes: 120
steps:
Expand All @@ -65,6 +63,7 @@ jobs:
-DENABLE_TESTING_DEPENDENCY_MANAGER_FOR_CXX11=ON
-DENABLE_TESTING_FOR_CXX14=ON
-DENABLE_ADDRESS_SANITIZER=ON
-DENABLE_TESTING_ON_CI=ON
-DCMAKE_BUILD_TYPE=Release
run: |
mkdir build install
Expand Down
17 changes: 6 additions & 11 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:

build-conan:
linux-build-conan:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
Expand All @@ -19,9 +19,10 @@ jobs:
steps:
- name: Checkout source code
uses: actions/checkout@v3.3.0
- name: Install conan
- name: Install build dependencies
run: |
sudo pip install -U conan==1.59.0
sudo apt-get install -yq --no-install-recommends ninja-build
- name: Setup Conan Profile
env:
CC: ${{ matrix.compiler[0] }}
Expand Down Expand Up @@ -49,9 +50,9 @@ jobs:
-o celix:build_all=True
-o celix:enable_testing_for_cxx14=True
-o celix:enable_testing_dependency_manager_for_cxx11=True
-o celix:enable_testing_on_ci=True
run: |
#force require libcurl 7.64.1, due to a sha256 verify issue in libcurl/7.87.0
sudo apt-get install -yq --no-install-recommends ninja-build
conan install . celix/ci -pr:b release -pr:h default -if build ${CONAN_BUILD_OPTIONS} -b missing -b cpputest --require-override=libcurl/7.64.1 --require-override=openssl/1.1.1s
- name: Build
env:
Expand All @@ -67,15 +68,8 @@ jobs:
source activate_run.sh
ctest --output-on-failure
source deactivate_run.sh
- name: Test Installed Celix
env:
CC: ${{ matrix.compiler[0] }}
CXX: ${{ matrix.compiler[1] }}
CONAN_CMAKE_GENERATOR: Ninja
run: |
conan create -pr:b release -pr:h default -tf examples/conan_test_package -tbf test-build -o celix:celix_cxx17=True -o celix:celix_install_deprecated_api=True --require-override=libcurl/7.64.1 --require-override=openssl/1.1.1s .
build-apt:
linux-build-apt:
runs-on: ubuntu-22.04
timeout-minutes: 120
steps:
Expand Down Expand Up @@ -112,6 +106,7 @@ jobs:
-DRSA_SHM=ON
-DRSA_REMOTE_SERVICE_ADMIN_SHM_V2=ON
-DSHELL_BONJOUR=ON
-DENABLE_TESTING_ON_CI=ON
-DCMAKE_BUILD_TYPE=Debug
run: |
mkdir build install
Expand Down
34 changes: 9 additions & 25 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,33 +28,9 @@ include(cmake/cmake_celix/UseCelix.cmake)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

#find required packages
find_package(ZLIB REQUIRED) #framework
find_package(libuuid REQUIRED) #framework
find_package(CURL REQUIRED) #framework, etcdlib
find_package(libzip REQUIRED) #framework, etcdlib
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

if (NOT TARGET ZLIB::ZLIB)
#Note more recent zlib will create ZLIB::ZLIB target
message("Note ZLIB::ZLIB target not created by find_package(ZLIB). Creating ZLIB::ZLIB Target.")
add_library(ZLIB::ZLIB SHARED IMPORTED)
set_target_properties(ZLIB::ZLIB PROPERTIES
IMPORTED_LOCATION "${ZLIB_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIRS}"
)
endif ()

if (NOT TARGET CURL::libcurl)
#Note more recent curl will create CURL::libcurl target
message("Note CURL::libcurl target not created by find_package(CURL). Creating CURL::libcurl Target.")
add_library(CURL::libcurl SHARED IMPORTED)
set_target_properties(CURL::libcurl PROPERTIES
IMPORTED_LOCATION "${CURL_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}"
)
endif ()

# 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)." )
Expand All @@ -70,7 +46,7 @@ if (ENABLE_TESTING)
endif ()

# Set C specific flags
set(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=c99 -fPIC ${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 -fPIC ${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS "-Wall -Werror -Wformat -Wno-error=deprecated-declarations ${CMAKE_C_FLAGS}")

# Set C++ specific flags
Expand Down Expand Up @@ -183,6 +159,8 @@ endif ()
option(ENABLE_TESTING_DEPENDENCY_MANAGER_FOR_CXX11 "Test the Dependency Manager for C++11 support" OFF)
option(ENABLE_TESTING_FOR_CXX14 "Test celix utils and framework C++ header for C++14 support" OFF)

option(ENABLE_TESTING_ON_CI "Whether to enable testing on CI. This influence allowed timing errors during unit tests" OFF)

if (CELIX_INSTALL_DEPRECATED_API)
#ignore deprecated warnings
set(CMAKE_C_FLAGS "-Wno-deprecated-declarations ${CMAKE_C_FLAGS}")
Expand All @@ -196,6 +174,12 @@ include(CheckLinkerFlag)
check_linker_flag(CXX LINKER:--wrap,celix_nonexistent_symbol LINKER_WRAP_SUPPORTED)
cmake_pop_check_state()

# avoid unknown export "celix" error when building nothing
add_library(celix INTERFACE)
add_library(Celix::celix ALIAS celix)
install(TARGETS celix EXPORT celix DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT framework
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix)

#Add generate_export_header to cmake
include(GenerateExportHeader)

Expand Down
1 change: 1 addition & 0 deletions bundles/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ add_subdirectory(deployment_admin)
add_subdirectory(remote_services)
add_subdirectory(pubsub)
add_subdirectory(cxx_remote_services)
add_subdirectory(components_ready_check)
50 changes: 50 additions & 0 deletions bundles/components_ready_check/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# 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.

celix_subproject(COMPONENTS_READY_CHECK "Bundle that checks if all components becomes active and reports this using a condition service" ON)
if (COMPONENTS_READY_CHECK)

add_library(components_ready_api INTERFACE)
target_include_directories(components_ready_api INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/api>)
add_library(Celix::components_ready_api ALIAS components_ready_api)
install(TARGETS components_ready_api EXPORT celix DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT components_ready
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix_components_ready_api)
install(DIRECTORY api/ DESTINATION include/celix_components_ready_api COMPONENT components_ready)


set(COMPONENTS_READY_CHECK_SRC src/celix_components_ready_check.c)
set(COMPONENTS_READY_CHECK_DEPS Celix::framework Celix::components_ready_api)
add_celix_bundle(components_ready_check
SOURCES src/celix_components_ready_check_activator.c ${COMPONENTS_READY_CHECK_SRC}
VERSION 1.0.0
SYMBOLIC_NAME "apache_celix_components_ready_check"
GROUP "Celix/Conditions"
NAME "Apache Celix Components Ready Check"
FILENAME celix_components_ready_check
)
target_include_directories(components_ready_check PRIVATE src)
target_link_libraries(components_ready_check PRIVATE ${COMPONENTS_READY_CHECK_DEPS})
add_library(Celix::components_ready_check ALIAS components_ready_check)
install_celix_bundle(components_ready_check EXPORT celix COMPONENT components_ready)

if (ENABLE_TESTING)
add_library(components_ready_cut STATIC ${COMPONENTS_READY_CHECK_SRC})
target_include_directories(components_ready_cut PUBLIC src)
target_link_libraries(components_ready_cut PUBLIC ${COMPONENTS_READY_CHECK_DEPS})
add_subdirectory(gtest)
endif()
endif ()
50 changes: 50 additions & 0 deletions bundles/components_ready_check/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
title: Shell
---

<!--
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.
-->

# Apache Celix Component Ready

## Intro
The Apache Celix Component Ready provides an api and bundle which can be used to check if all components are ready.

## API library
The Apache Celix Component Ready Check provides a single api library `Celix::component_ready_api` which contains
the condition id constant used to register the "components.ready" condition service.

## Bundle
The Apache Celix Component Ready Check provides the `Celix::components_ready_check` bundle which registers the
"components.ready" condition service.

The "components.ready" condition service will be registered when the "framework.ready" service is registered,
all components have become active and the event queue is empty.

If the "components.ready" condition service is registered and some components become inactive or the event queue is
not empty, the "components.ready" condition is **not** removed. The "components.ready" condition is meant to indicate
that the components in the initial framework startup phase are ready.

## CMake options

- COMPONENTS_READY_CHECK=ON

## Using info

If the Apache Celix Component Ready is installed, `find_package(Celix)` will set:
- The `Celix::component_ready_api` interface (i.e. header only) library target
- The `Celix::components_ready_check` bundle target
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* 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.
*/

#ifndef CELIX_COMPONENTS_READY_CONSTANTS_H_
#define CELIX_COMPONENTS_READY_CONSTANTS_H_

#ifdef __cplusplus
extern "C" {
#endif

/*!
* @brief The unique identifier for the components.ready condition.
*
* The components ready condition is registered by the framework if the framework.ready condition is registered
* and all components active.
*/
#define CELIX_CONDITION_ID_COMPONENTS_READY "components.ready"

#ifdef __cplusplus
}
#endif

#endif /* CELIX_COMPONENTS_READY_CONSTANTS_H_ */
Loading

0 comments on commit 4ce9a10

Please sign in to comment.