Skip to content

Commit

Permalink
Merge branch 'master' into development/messagedispatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
msieben authored Jun 26, 2024
2 parents 754e777 + 0392ba8 commit cfcf37a
Show file tree
Hide file tree
Showing 180 changed files with 2,296 additions and 1,150 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/Linux build template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ jobs:
-DVOLATILE_PATH="tmp" \
-DLOCALTRACER=ON \
-DWARNING_REPORTING=ON \
-DPROCESSCONTAINERS=ON \
-DPROCESSCONTAINERS_RUNC=ON \
${{steps.regexthunder.outputs.first_match}}
cmake --build ${{matrix.build_type}}/build/Thunder --target install
Expand Down
51 changes: 33 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,44 +15,57 @@
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required(VERSION 3.3)
cmake_minimum_required(VERSION 3.15)

project(Thunder)
project(Thunder
VERSION 5.0.0
DESCRIPTION "Thunder framework"
HOMEPAGE_URL "https://rdkcentral.github.io/Thunder/")

set(VERSION_MAJOR 1)
set(VERSION_MINOR 0)
set(VERSION_PATCH 0)
include(GNUInstallDirs)

set(VERSION ${${PROJECT_NAME}_VERSION})
set(VERSION_MAJOR ${${PROJECT_NAME}_VERSION_MAJOR})
set(VERSION_MINOR ${${PROJECT_NAME}_VERSION_MINOR})
set(VERSION_PATCH ${${PROJECT_NAME}_VERSION_PATCH})

set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
string(TIMESTAMP BUILD_TIMESTAMP UTC)

message(STATUS "Setting up ${PROJECT_NAME} v${VERSION}")
message(STATUS "Setting up ${PROJECT_NAME} v${Thunder_VERSION}")

option(HIDE_NON_EXTERNAL_SYMBOLS
"Hide all non EXTERNAL tagged symbols" ON)
option(ENABLE_STRICT_COMPILER_SETTINGS
"Enable compiler flags to get the warnings/errors due to improper condition in the code" OFF)
option(LEGACY_CONFIG_GENERATOR
"Use the legacy config generator and all its needed CMake sub-components.
If switched OFF, plugins need to use the new python-based templates. (*.conf.in)" OFF)
If switched OFF, plugins need to use the new python-based templates. (*.conf.in)" OFF)
option(HUMAN_VERSIONED_BINARIES
"Create binaries with a human readeable version suffix" ON)
option(VERSIONED_LIBRARY_LOADING
"Uses the major version (*.so.<major>) to load libraries rather then *.so" OFF)

if (BUILD_REFERENCE)
add_definitions (-DBUILD_REFERENCE=${BUILD_REFERENCE})
endif()

if(VERSIONED_LIBRARY_LOADING)
add_definitions(-DVERSIONED_LIBRARY_LOADING)
endif()

list(APPEND CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/common"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
"${CMAKE_SYSROOT}${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME}/Modules")
"${CMAKE_SYSROOT}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/Modules")

if (TOOLS_SYSROOT)
list(APPEND CMAKE_MODULE_PATH
"${TOOLS_SYSROOT}${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME}/Modules")
"${TOOLS_SYSROOT}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/Modules")
endif()

include(platform)
include(CmakeHelperFunctions)
include(GNUInstallDirs)

set(PLATFORM "PC_UNIX" CACHE STRING
"Defines on what platform the application will run")
Expand All @@ -65,7 +78,7 @@ find_package(ConfigGenerator REQUIRED)

if(NOT DEFINED BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS ON CACHE INTERNAL "Enable shared objects by default")
message(STATUS "BUILD_SHARED_LIBS was not set, assuming ${BUILD_SHARED_LIBS}")
message(VERBOSE "Building shared libs")
endif()

#
Expand All @@ -76,7 +89,7 @@ if(NOT CMAKE_BUILD_TYPE)
message(AUTHOR_WARNING "CMAKE_BUILD_TYPE not set, assuming '${CMAKE_BUILD_TYPE}'")
endif()

message(STATUS "CMake build type: '${CMAKE_BUILD_TYPE}'")
message(VERBOSE "CMake build type: '${CMAKE_BUILD_TYPE}'")

# Remove optimization flags added by the build system
string(REGEX REPLACE "(-g[0123])" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
Expand All @@ -97,26 +110,29 @@ configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/project.cmake.in"

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${NAMESPACE}.cmake"
RENAME "${NAMESPACE}Config.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE})
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE}
COMPONENT ${NAMESPACE}_Development)

if(CMAKE_VERSION VERSION_LESS 3.20.0 AND LEGACY_CONFIG_GENERATOR)
install(DIRECTORY
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/config"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE})
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE}
COMPONENT ${NAMESPACE}_Development)
endif(CMAKE_VERSION VERSION_LESS 3.20.0 AND LEGACY_CONFIG_GENERATOR)

install(DIRECTORY
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/common"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE})
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE}
COMPONENT ${NAMESPACE}_Development)

if(APPLE)
# Mac needed variables
# http://www.cmake.org/Wiki/CMake_RPATH_handling#Mac_OS_X_and_the_RPATH)
set(CMAKE_MACOSX_RPATH ON)
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
endif()

Expand All @@ -138,4 +154,3 @@ endif()
add_subdirectory(Source)

add_subdirectory(Tests)

24 changes: 11 additions & 13 deletions Source/Thunder/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ find_package(Threads REQUIRED)
get_filename_component(TARGET ${CMAKE_CURRENT_SOURCE_DIR} NAME)

set(THREADPOOL_COUNT "4" CACHE STRING "The number of threads in the thread pool")
set(ENABLE_INITSCRIPT_SUPPORT ON CACHE STRING "Enable init script(systemd/initd) install support from the thunder source tree")
set(ENABLE_TRACING_MODULES "" CACHE STRING "A space separated list of specific tracing modules to be enabled at start.")

add_executable(${TARGET}
Expand All @@ -43,17 +42,18 @@ target_compile_options (${TARGET} PRIVATE -Wno-psabi)

if (TREE_REFERENCE)
target_compile_definitions(${TARGET}
PRIVATE
PRIVATE
-DTREE_REFERENCE=${TREE_REFERENCE}
)
endif()

target_include_directories( ${TARGET}
target_include_directories(${TARGET}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../plugins/generated/jsonrpc>
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/generated>
)


if (EXCEPTION_CATCHING)
set_source_files_properties( PluginServer.cpp PROPERTIES COMPILE_FLAGS "-fexceptions" )
endif()
Expand Down Expand Up @@ -99,20 +99,18 @@ set_target_properties(${TARGET} PROPERTIES
)

install(
TARGETS ${TARGET} EXPORT ${TARGET}Targets # for downstream dependencies
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # static lib
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # shared lib
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # binaries
FRAMEWORK DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # for mac
TARGETS ${TARGET} EXPORT ${TARGET}Targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${NAMESPACE}_Development
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${NAMESPACE}_Runtime NAMELINK_COMPONENT ${NAMESPACE}_Development
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${NAMESPACE}_Runtime
FRAMEWORK DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${NAMESPACE}_Runtime
)

install(DIRECTORY
DESTINATION ${CMAKE_INSTALL_PREFIX}/../${PERSISTENT_PATH/${NAMESPACE}}
DESTINATION ${PERSISTENT_PATH} COMPONENT ${NAMESPACE}_Runtime
DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE
)

if (ENABLE_INITSCRIPT_SUPPORT)
add_subdirectory(scripts)
endif()
add_subdirectory(scripts)

include(GenericConfig.cmake)
24 changes: 12 additions & 12 deletions Source/Thunder/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ namespace PluginHost {
Add(_T("value"), &Value);
Add(_T("override"), &Override);
}
Environment(Environment&& move)
Environment(Environment&& move) noexcept
: Core::JSON::Container()
, Key(std::move(move.Key))
, Value(std::move(move.Value))
Expand All @@ -155,7 +155,7 @@ namespace PluginHost {

return (*this);
}
Environment& operator=(Environment&& move)
Environment& operator=(Environment&& move) noexcept
{
if (this != &move) {
Key = std::move(move.Key);
Expand Down Expand Up @@ -210,7 +210,7 @@ namespace PluginHost {
Add(_T("stacksize"), &StackSize);
Add(_T("umask"), &Umask);
}
ProcessSet(ProcessSet&& move)
ProcessSet(ProcessSet&& move) noexcept
: Core::JSON::Container()
, User(std::move(move.User))
, Group(std::move(move.Group))
Expand Down Expand Up @@ -244,7 +244,7 @@ namespace PluginHost {
return (*this);
}

ProcessSet& operator=(ProcessSet&& move)
ProcessSet& operator=(ProcessSet&& move) noexcept
{
if (this != &move) {
User = std::move(move.User);
Expand Down Expand Up @@ -295,7 +295,7 @@ namespace PluginHost {
Add(_T("type"), &Type);
Add(_T("output"), &OutputEnabled);
}
InputConfig(InputConfig&& move)
InputConfig(InputConfig&& move) noexcept
: Core::JSON::Container()
, Locator(std::move(move.Locator))
, Type(std::move(move.Type))
Expand All @@ -316,7 +316,7 @@ namespace PluginHost {
return (*this);
}

InputConfig& operator=(InputConfig&& move)
InputConfig& operator=(InputConfig&& move) noexcept
{
if (this != &move) {
Locator = std::move(move.Locator);
Expand Down Expand Up @@ -349,7 +349,7 @@ namespace PluginHost {
Add(_T("proxystubpath"), &ProxyStubPath);
Add(_T("configpath"), &PluginConfigPath);
}
Observables(Observables&& move)
Observables(Observables&& move) noexcept
: Core::JSON::Container()
, ProxyStubPath(std::move(move.ProxyStubPath))
, PluginConfigPath(std::move(move.PluginConfigPath)) {
Expand Down Expand Up @@ -377,7 +377,7 @@ namespace PluginHost {
{
Add(_T("logging"), &Logging);
}
ProcessContainerConfig(ProcessContainerConfig&& move)
ProcessContainerConfig(ProcessContainerConfig&& move) noexcept
: Logging(std::move(move.Logging))
{
Add(_T("logging"), &Logging);
Expand All @@ -389,10 +389,10 @@ namespace PluginHost {
Logging = RHS.Logging;
return (*this);
}
ProcessContainerConfig& operator=(ProcessContainerConfig&& move)
ProcessContainerConfig& operator=(ProcessContainerConfig&& move) noexcept
{
if (this != &move) {
Logging = std::move(move.Logging;
Logging = std::move(move.Logging);
}
return (*this);
}
Expand All @@ -416,7 +416,7 @@ namespace PluginHost {
{
Add(_T("locator"), &Locator);
}
HibernateConfig(HibernateConfig&& move)
HibernateConfig(HibernateConfig&& move) noexcept
: Locator(std::move(move.Locator))
{
Add(_T("locator"), &Locator);
Expand All @@ -428,7 +428,7 @@ namespace PluginHost {
Locator = RHS.Locator;
return (*this);
}
HibernateConfig& operator=(HibernateConfig&& move)
HibernateConfig& operator=(HibernateConfig&& move) noexcept
{
if (this != &move) {
Locator = std::move(move.Locator);
Expand Down
39 changes: 20 additions & 19 deletions Source/Thunder/Controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,21 @@ namespace Plugin {
ASSERT(_pluginServer != nullptr);

if (_pluginServer->Services().FromIdentifier(callsign, service) == Core::ERROR_NONE) {
result = service->ConfigLine(configuration);
Core::JSON::Variant config;
Core::OptionalType<Core::JSON::Error> error;
config.FromString(configuration, error);
result = Core::ERROR_INCOMPLETE_CONFIG;
if (error.IsSet() == true) {
SYSLOG(Logging::ParsingError, (_T("Parsing failed with %s"), ErrorDisplayMessage(error.Value()).c_str()));
} else if (config.IsValid() != true) {
SYSLOG(Logging::ParsingError, (_T("Given configuration is not valid")));
} else {
result = service->ConfigLine(configuration);

// Normalise return code
if (result != Core::ERROR_NONE) {
result = Core::ERROR_GENERAL;
// Normalise return code
if (result != Core::ERROR_NONE) {
result = Core::ERROR_GENERAL;
}
}
}

Expand Down Expand Up @@ -717,17 +727,18 @@ namespace Plugin {
PluginHost::Metadata::COMRPC::Proxy& info(entry.Proxies.Add());
info.Instance = proxy->Implementation();
info.Interface = proxy->InterfaceId();
info.Count = proxy->ReferenceCount();
info.Name = Core::ClassName(proxy->Name()).Text();
// Subtract one for the Thunder syatem that keeps track of this
//proxy for leakage reporting!
info.Count = proxy->ReferenceCount() - 1;
}
}
);
}

void Controller::SubSystems()
{
#if THUNDER_RESTFULL_API || defined(__DEBUG__)
PluginHost::Metadata response;
#endif
Core::JSON::ArrayType<JsonData::Subsystems::SubsystemInfo> responseJsonRpc;
PluginHost::ISubSystem* subSystem = _service->SubSystems();

Expand All @@ -750,10 +761,7 @@ namespace Plugin {
status.Subsystem = current;
status.Active = ((reportMask & bit) != 0);
responseJsonRpc.Add(status);

#if THUNDER_RESTFULL_API || defined(__DEBUG__)
response.SubSystems.Add(current, ((reportMask & bit) != 0));
#endif

sendReport = true;
}
Expand All @@ -768,15 +776,11 @@ namespace Plugin {

if (sendReport == true) {

#if THUNDER_RESTFULL_API || defined(__DEBUG__)
string message;
response.ToString(message);
TRACE_L1("Sending out a SubSystem change notification. %s", message.c_str());
#endif

#if THUNDER_RESTFULL_API
_pluginServer->_controller->Notification(message);
#endif
_service->Notify(EMPTY_STRING, message);

Exchange::Controller::JSubsystems::Event::SubsystemChange(*this, responseJsonRpc);
}
Expand Down Expand Up @@ -1097,10 +1101,7 @@ namespace Plugin {
service.Configuration = meta.Configuration;
service.Precondition = meta.Precondition;
service.Termination = meta.Termination;

#if THUNDER_RESTFULL_API
service.Observers = meta.Observers;
#endif

#if THUNDER_RUNTIME_STATISTICS
service.ProcessedRequests = meta.ProcessedRequests;
Expand Down Expand Up @@ -1242,7 +1243,7 @@ namespace Plugin {
while (it2.Next() == true) {
auto const& entry = it2.Current();

proxies.push_back({ entry.Interface.Value(), entry.Instance.Value(), entry.Count.Value() });
proxies.push_back({ entry.Interface.Value(), entry.Name.Value(), entry.Instance.Value(), entry.Count.Value() });
}

break;
Expand Down
Loading

0 comments on commit cfcf37a

Please sign in to comment.