Skip to content
Permalink
Browse files
Merge branch 'apache:master' into fix_rsalist_race
  • Loading branch information
xuzhenbao committed Apr 14, 2022
2 parents 3cc3960 + 6c7cc60 commit 2dc4d7b372715e597bf6350d63ce12f53e4ea871
Showing 118 changed files with 3,193 additions and 1,573 deletions.
@@ -5,35 +5,45 @@
# 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.

# - Try to find Syslog
# Once done this will define
# SYSLOG_FOUND - System has Syslog
# JANSSON_INCLUDE_DIRS - The Syslog include directories
# SYSLOG::lib - Imported target for Syslog
# https://cwiki.apache.org/confluence/display/INFRA/git+-+.asf.yaml+features
---
github:
description: "Apache Celix - An implementation of the OSGi specification adapted to C and C++"
homepage: https://celix.apache.org/
labels:
- apache
- celix
- c
- cplusplus
- osgi

find_path(SYSLOG_INCLUDE_DIR syslog.h /usr/include)
features:
# Enable the 'Issues' tab for the GitHub repo
issues: true
# Enable the 'Projects' tab for the GitHub repo
projects: true
# Disable the 'Wiki' tab for the GitHub repo
wiki: false

include(FindPackageHandleStandardArgs)
enabled_merge_buttons:
merge: true
squash: true
rebase: true

find_package_handle_standard_args(SYSLOG DEFAULT_MSG
SYSLOG_INCLUDE_DIR)
protected_branches:
master:
required_pull_request_reviews:
dismiss_stale_reviews: false
require_code_owner_reviews: false
required_approving_review_count: 0

set(Syslog_INCLUDE_DIRS ${SYSLOG_INCLUDE_DIR})
mark_as_advanced(SYSLOG_INCLUDE_DIR)

if (SYSLOG_FOUND AND NOT TARGET SYSLOG::lib)
add_library(SYSLOG::lib SHARED IMPORTED)
set_target_properties(SYSLOG::lib PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${SYSLOG_INCLUDE_DIR}"
)
endif ()
@@ -25,6 +25,7 @@ jobs:
BUILD_OPTIONS: |
-DENABLE_TESTING=ON
-DENABLE_ADDRESS_SANITIZER=ON
-DBUILD_CXX_REMOTE_SERVICE_ADMIN=ON
run: |
mkdir build install
cd build
@@ -55,6 +55,7 @@ jobs:
BUILD_OPTIONS: |
-DENABLE_TESTING=ON
-DBUILD_EXPERIMENTAL=ON
-DBUILD_CXX_REMOTE_SERVICE_ADMIN=ON
BUILD_OPTIONS_SANITIZER: |
-DENABLE_ADDRESS_SANITIZER=ON
BUILD_OPTIONS_V3_API: |
@@ -27,6 +27,45 @@ project (Celix C CXX)
include(cmake/celix_project/CelixProject.cmake)
include(cmake/cmake_celix/UseCelix.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
find_package(jansson REQUIRED) #etcdlib, dfi
find_package(libffi REQUIRED) #dfi
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 ()

if (NOT TARGET jansson::jansson)
message("Note jansson::jansson target not created by find_package(jansson). Creating jansson::jansson Target.")
add_library(jansson::jansson SHARED IMPORTED)
set_target_properties(jansson::jansson PROPERTIES
IMPORTED_LOCATION "${JANSSON_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${JANSSON_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)." )
@@ -72,8 +111,12 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
endif()

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_C_FLAGS "-Wno-unused-result -Wno-format-truncation -Wno-stringop-overflow ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-Wno-unused-result -Wno-format-truncation -Wno-stringop-overflow ${CMAKE_CXX_FLAGS}")
set(CMAKE_C_FLAGS "-Wno-unused-result ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-Wno-unused-result ${CMAKE_CXX_FLAGS}")
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 7.0)
set(CMAKE_C_FLAGS "-Wno-format-truncation -Wno-stringop-overflow ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-Wno-format-truncation -Wno-stringop-overflow ${CMAKE_CXX_FLAGS}")
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
set(CMAKE_C_FLAGS "-Wno-stringop-truncation ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-Wno-stringop-truncation ${CMAKE_CXX_FLAGS}")
@@ -116,9 +159,11 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
endif()

# Set version for the framework package/release
set(CELIX_MAJOR "2")
set(CELIX_MINOR "2")
set(CELIX_MICRO "1")
if (NOT DEFINED CELIX_MAJOR)
set(CELIX_MAJOR "2")
set(CELIX_MINOR "2")
set(CELIX_MICRO "1")
endif ()

# Default bundle version
set(DEFAULT_VERSION 1.0.0)
@@ -15,21 +15,14 @@
# specific language governing permissions and limitations
# under the License.

celix_subproject(REMOTE_SERVICE_ADMIN "Option to enable building the C++17 Remote Service Admin Service bundles" OFF)
if (REMOTE_SERVICE_ADMIN)
celix_subproject(CXX_REMOTE_SERVICE_ADMIN "Option to enable building the C++17 Remote Service Admin Service bundles" OFF)
if (CXX_REMOTE_SERVICE_ADMIN)
message(STATUS "The C++ Remote Service Admin is still experimental; The API, SPI and implementation is not stable and will change")

add_subdirectory(rsa_spi)
add_subdirectory(admin)
add_subdirectory(discovery_configured)

find_package(ZMQ)
find_package(CZMQ)
if (ZMQ_FOUND AND CZMQ_FOUND)
add_subdirectory(integration)
else ()
message(STATUS "C++ RSA integration test will not be build, because they require zmq and czmq")
endif ()
add_subdirectory(integration)

#NOTE the topology manager is not yet used. The discovery and RSA need to be refactor for this
#add_subdirectory(topology_manager)
@@ -20,7 +20,7 @@ add_executable(test_cxx_remote_service_admin
)
target_link_libraries(test_cxx_remote_service_admin PRIVATE Celix::framework GTest::gtest GTest::gtest_main Celix::rsa_spi)

add_dependencies(test_cxx_remote_service_admin RemoteServiceAdmin_bundle)
add_celix_bundle_dependencies(test_cxx_remote_service_admin RemoteServiceAdmin)

celix_get_bundle_file(RemoteServiceAdmin REMOTE_SERVICE_ADMIN_BUNDLE_LOCATION)
target_compile_definitions(test_cxx_remote_service_admin PRIVATE REMOTE_SERVICE_ADMIN_BUNDLE_LOCATION="${REMOTE_SERVICE_ADMIN_BUNDLE_LOCATION}")
@@ -21,7 +21,7 @@ add_executable(test_cxx_rsa_configured_discovery

target_link_libraries(test_cxx_rsa_configured_discovery PRIVATE Celix::framework GTest::gtest GTest::gtest_main Celix::rsa_spi RsaConfiguredDiscovery_api)

add_dependencies(test_cxx_rsa_configured_discovery RsaConfiguredDiscovery_bundle)
add_celix_bundle_dependencies(test_cxx_rsa_configured_discovery RsaConfiguredDiscovery)
celix_get_bundle_file(RsaConfiguredDiscovery RSA_CONFIGURED_DISCOVERY_BUNDLE_LOCATION)
target_compile_definitions(test_cxx_rsa_configured_discovery PRIVATE RSA_CONFIGURED_DISCOVERY_BUNDLE_LOCATION="${RSA_CONFIGURED_DISCOVERY_BUNDLE_LOCATION}")
target_compile_definitions(test_cxx_rsa_configured_discovery PRIVATE RSA_CONFIGURED_DISCOVERY_DISCOVERY_FILE="${CMAKE_CURRENT_SOURCE_DIR}/resources/endpoint_discovery.json")
@@ -15,42 +15,46 @@
# specific language governing permissions and limitations
# under the License.

add_celix_bundle(TestExportImportRemoteServiceFactory
SOURCES src/TestExportImportRemoteServiceFactory.cc
)
target_link_libraries(TestExportImportRemoteServiceFactory PRIVATE Celix::rsa_spi Celix::pubsub_api Celix::Promises Celix::PushStreams Celix::log_helper)
target_include_directories(TestExportImportRemoteServiceFactory PRIVATE include)
celix_bundle_files(TestExportImportRemoteServiceFactory
resources/Calculator$add$Invoke.descriptor
resources/Calculator$result$Event.descriptor
resources/Calculator$add$Return.descriptor
DESTINATION "META-INF/descriptors"
)
celix_subproject(CXX_RSA_INTEGRATION "Option to build the C++17 Remote Service Admin Service integration" ON DEPS SHELL SHELL_TUI PUBSUB PROMISES PUSHSTREAMS PUBSUB_PSA_ZMQ PUBSUB_DISCOVERY_ETCD)
if (CXX_RSA_INTEGRATION)
find_package(ZeroMQ REQUIRED)
find_package(czmq REQUIRED)
add_celix_bundle(TestExportImportRemoteServiceFactory
SOURCES src/TestExportImportRemoteServiceFactory.cc
)
target_link_libraries(TestExportImportRemoteServiceFactory PRIVATE Celix::rsa_spi Celix::pubsub_api Celix::Promises Celix::PushStreams Celix::log_helper)
target_include_directories(TestExportImportRemoteServiceFactory PRIVATE include)
celix_bundle_files(TestExportImportRemoteServiceFactory
resources/Calculator$add$Invoke.descriptor
resources/Calculator$result$Event.descriptor
resources/Calculator$add$Return.descriptor
DESTINATION "META-INF/descriptors"
)

add_celix_bundle(CalculatorProvider
SOURCES src/CalculatorProvider.cc
)
target_link_libraries(CalculatorProvider PRIVATE Celix::Promises Celix::PushStreams)
target_include_directories(CalculatorProvider PRIVATE include)
add_celix_bundle(CalculatorProvider
SOURCES src/CalculatorProvider.cc
)
target_link_libraries(CalculatorProvider PRIVATE Celix::Promises Celix::PushStreams)
target_include_directories(CalculatorProvider PRIVATE include)

add_celix_bundle(CalculatorConsumer
SOURCES src/CalculatorConsumer.cc
)
celix_bundle_files(CalculatorConsumer ${CMAKE_CURRENT_SOURCE_DIR}/resources/endpoint_discovery.json DESTINATION "META-INF/discovery") # add configured discovery as resource in the bundle.
target_link_libraries(CalculatorConsumer PRIVATE Celix::Promises Celix::PushStreams Celix::shell_api Celix::RsaConfiguredDiscovery_api)
target_include_directories(CalculatorConsumer PRIVATE include)
add_celix_bundle(CalculatorConsumer
SOURCES src/CalculatorConsumer.cc
)
celix_bundle_files(CalculatorConsumer ${CMAKE_CURRENT_SOURCE_DIR}/resources/endpoint_discovery.json DESTINATION "META-INF/discovery") # add configured discovery as resource in the bundle.
target_link_libraries(CalculatorConsumer PRIVATE Celix::Promises Celix::PushStreams Celix::shell_api Celix::RsaConfiguredDiscovery_api)
target_include_directories(CalculatorConsumer PRIVATE include)

if (ENABLE_TESTING)
add_subdirectory(gtest)
endif()
if (ENABLE_TESTING)
add_subdirectory(gtest)
endif()

################# Integration examples ##################################
################# Integration examples ##################################

add_celix_container(RemoteCalculatorProvider
GROUP rsa
PROPERTIES
add_celix_container(RemoteCalculatorProvider
GROUP rsa
PROPERTIES
CELIX_LOGGING_DEFAULT_ACTIVE_LOG_LEVEL=trace
BUNDLES
BUNDLES
Celix::ShellCxx
Celix::shell_tui

@@ -66,14 +70,14 @@ add_celix_container(RemoteCalculatorProvider
TestExportImportRemoteServiceFactory #needed to be able to create a ExportedService for ICalculator

CalculatorProvider
)
target_link_libraries(RemoteCalculatorProvider PRIVATE ZMQ::lib CZMQ::lib)
)
target_link_libraries(RemoteCalculatorProvider PRIVATE ZeroMQ::ZeroMQ czmq::czmq)

add_celix_container(RemoteCalculatorConsumer
GROUP rsa
PROPERTIES
add_celix_container(RemoteCalculatorConsumer
GROUP rsa
PROPERTIES
CELIX_LOGGING_DEFAULT_ACTIVE_LOG_LEVEL=trace
BUNDLES
BUNDLES
Celix::ShellCxx
Celix::shell_tui

@@ -90,5 +94,6 @@ add_celix_container(RemoteCalculatorConsumer
TestExportImportRemoteServiceFactory #needed to be able to create a ExportedService for ICalculator

CalculatorConsumer
)
target_link_libraries(RemoteCalculatorConsumer PRIVATE ZMQ::lib CZMQ::lib)
)
target_link_libraries(RemoteCalculatorConsumer PRIVATE ZeroMQ::ZeroMQ czmq::czmq)
endif()
@@ -18,7 +18,7 @@
add_executable(test_cxx_remote_services_integration
src/RemoteServicesIntegrationTestSuite.cc
)
target_link_libraries(test_cxx_remote_services_integration PRIVATE Celix::framework Celix::Promises Celix::PushStreams Celix::shell_api ZMQ::lib CZMQ::lib GTest::gtest GTest::gtest_main)
target_link_libraries(test_cxx_remote_services_integration PRIVATE Celix::framework Celix::Promises Celix::PushStreams Celix::shell_api ZeroMQ::ZeroMQ czmq::czmq GTest::gtest GTest::gtest_main)
target_include_directories(test_cxx_remote_services_integration PRIVATE ../include) #Add ICalculator

add_celix_bundle_dependencies(test_cxx_remote_services_integration
@@ -18,11 +18,11 @@
add_library(rsa_spi INTERFACE)
target_include_directories(rsa_spi INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
$<INSTALL_INTERFACE:include/celix/rsa>
)

install(TARGETS rsa_spi EXPORT celix DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT rsa)
install(DIRECTORY include/ DESTINATION include/celix/rsa COMPONENT rsa)
install(TARGETS rsa_spi EXPORT celix DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT rsa
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/rsa)
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/rsa COMPONENT rsa)

#Setup target aliases to match external usage
add_library(Celix::rsa_spi ALIAS rsa_spi)
@@ -15,18 +15,17 @@
# specific language governing permissions and limitations
# under the License.

celix_subproject(DEPLOYMENT_ADMIN "Option to enable building the Deployment Admin Service bundles" ON DEPS framework launcher shell_tui log_writer)
celix_subproject(DEPLOYMENT_ADMIN "Option to enable building the Deployment Admin Service bundles" ON)
if (DEPLOYMENT_ADMIN)
message(WARNING "Celix::deployment_admin is considered unstable, because develop of this bundle has been dormant for a while")

find_package(CURL REQUIRED)
find_package(UUID REQUIRED)
find_package(libuuid REQUIRED)
find_package(ZLIB REQUIRED)

add_library(deployment_admin_api INTERFACE)
target_include_directories(deployment_admin_api INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/api>
$<INSTALL_INTERFACE:include/celix/deployment_admin>
)

add_celix_bundle(deployment_admin
@@ -47,22 +46,24 @@ if (DEPLOYMENT_ADMIN)
)

target_compile_definitions(deployment_admin PRIVATE -DUSE_FILE32API)
target_link_libraries(deployment_admin PRIVATE CURL::libcurl UUID::lib ZLIB::ZLIB deployment_admin_api)
target_link_libraries(deployment_admin PRIVATE CURL::libcurl libuuid::libuuid ZLIB::ZLIB deployment_admin_api)

install(TARGETS deployment_admin_api EXPORT celix COMPONENT deployment_admin)
install(DIRECTORY api/ DESTINATION include/celix/deployment_admin COMPONENT deployment_admin)
install(TARGETS deployment_admin_api EXPORT celix COMPONENT deployment_admin
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/deployment_admin)
install(DIRECTORY api/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/deployment_admin COMPONENT deployment_admin)
install_celix_bundle(deployment_admin EXPORT celix COMPONENT deployment_admin)

#Setup target aliases to match external usage
add_library(Celix::deployment_admin_api ALIAS deployment_admin_api)
add_library(Celix::deployment_admin ALIAS deployment_admin)

add_celix_container(deployment-admin
BUNDLES Celix::deployment_admin Celix::shell Celix::shell_tui Celix::log_admin
PROPERTIES
"deployment_admin_url=http://localhost:8080"
"deployment_admin_identification=celix"
"org.osgi.framework.storage.clean=onFirstInit"
)

if (BUILD_SHELL AND BUILD_SHELL_TUI AND BUILD_LOG_SERVICE)
add_celix_container(deployment-admin
BUNDLES Celix::deployment_admin Celix::shell Celix::shell_tui Celix::log_admin
PROPERTIES
"deployment_admin_url=http://localhost:8080"
"deployment_admin_identification=celix"
"org.osgi.framework.storage.clean=onFirstInit"
)
endif ()
endif (DEPLOYMENT_ADMIN)

0 comments on commit 2dc4d7b

Please sign in to comment.