Skip to content

Commit

Permalink
Merging master
Browse files Browse the repository at this point in the history
  • Loading branch information
VeithMetro committed Oct 15, 2024
2 parents 8d3c3a1 + f3191fd commit ea398a9
Show file tree
Hide file tree
Showing 66 changed files with 2,009 additions and 1,096 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/Linux build template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

jobs:
Thunder:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

strategy:
matrix:
Expand All @@ -26,10 +26,12 @@ jobs:
sudo apt-spy2 fix --commit --launchpad --country=US
echo "deb http://archive.ubuntu.com/ubuntu/ jammy main universe restricted multiverse" | sudo tee -a /etc/apt/sources.list
echo "deb http://archive.ubuntu.com/ubuntu/ jammy-updates main universe restricted multiverse" | sudo tee -a /etc/apt/sources.list
sudo dpkg --add-architecture i386
${{matrix.architecture == '32' && 'sudo dpkg --add-architecture i386' || ':'}}
sudo apt-get update
sudo apt install python3-pip build-essential cmake ninja-build libusb-1.0-0-dev zlib1g-dev zlib1g-dev:i386 libssl-dev gcc-11-multilib g++-11-multilib
sudo pip install jsonref
sudo apt install python3-pip build-essential cmake ninja-build libusb-1.0-0-dev ${{matrix.architecture == '32' && 'zlib1g-dev:i386 libssl-dev:i386 libsbc-dev:i386 gcc-13-multilib g++-13-multilib' || 'zlib1g-dev libssl-dev libsbc-dev'}}
python3 -m venv venv
source venv/bin/activate
pip install jsonref
# ----- Checkout & DependsOn regex -----
# --------- Thunder ----------
Expand Down Expand Up @@ -85,6 +87,8 @@ jobs:
# ----- Installing generators & Options regex -----
- name: Install generators
run: |
source venv/bin/activate
${{matrix.architecture == '32' && 'export PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig:$PKG_CONFIG_PATH' || 'PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH'}}
cmake -G Ninja -S ThunderTools -B ${{matrix.build_type}}/build/ThunderTools \
-DCMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic -Werror -m${{matrix.architecture}}" \
-DCMAKE_C_FLAGS="-Wall -Wextra -Wpedantic -Werror -m${{matrix.architecture}}" \
Expand All @@ -103,6 +107,8 @@ jobs:
# ----- Building & uploading artifacts -----
- name: Build Thunder
run: |
source venv/bin/activate
${{matrix.architecture == '32' && 'export PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig:$PKG_CONFIG_PATH' || 'PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH'}}
cmake -G Ninja -S Thunder -B ${{matrix.build_type}}/build/Thunder \
-DCMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic -Werror -m${{matrix.architecture}}" \
-DCMAKE_C_FLAGS="-Wall -Wextra -Wpedantic -Werror -m${{matrix.architecture}}" \
Expand All @@ -117,6 +123,11 @@ jobs:
-DPROXYSTUB_PATH="${PWD}/${{matrix.build_type}}/install/usr/lib/wpeframework/proxystubs" \
-DSYSTEM_PATH="${PWD}/${{matrix.build_type}}/install/usr/lib/wpeframework/plugins" \
-DVOLATILE_PATH="tmp" \
-DBLUETOOTH_SUPPORT=ON \
-DBLUETOOTH=ON \
-DDOWNLOAD_BLUEZ_UTIL_HEADERS=ON \
-DBLUETOOTH_AUDIO_SUPPORT=ON \
-DBLUETOOTH_GATT_SUPPORT=ON \
-DLOCALTRACER=ON \
-DWARNING_REPORTING=ON \
-DPROCESSCONTAINERS=ON \
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/Test Thunder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ jobs:
sudo gem install apt-spy2
sudo apt-spy2 fix --commit --launchpad --country=US
sudo apt-get update
sudo apt install python3-pip
sudo apt install python3-pip build-essential cmake ninja-build libusb-1.0-0-dev zlib1g-dev libssl-dev libgtest-dev
python3 -m venv venv
source venv/bin/activate
pip install jsonref
sudo apt install build-essential cmake ninja-build libusb-1.0-0-dev zlib1g-dev libssl-dev libgtest-dev
# ----- Checkout & DependsOn Regex -----
# -------------- Thunder ---------------
Expand Down Expand Up @@ -98,12 +99,14 @@ jobs:
# ----- Building -----
- name: Install generators
run: |
source venv/bin/activate
cmake -G Ninja -S ThunderTools -B ${{matrix.build_type}}/build/ThunderTools \
-DCMAKE_INSTALL_PREFIX=${{matrix.build_type}}/install/usr
cmake --build ${{matrix.build_type}}/build/ThunderTools --target install
- name: Build Thunder
run: |
source venv/bin/activate
cmake -G Ninja -S Thunder -B ${{matrix.build_type}}/build/Thunder \
-DBINDING="127.0.0.1" \
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
Expand Down
117 changes: 117 additions & 0 deletions ReleaseNotes/ThunderReleaseNotes_R5.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# Thunder Release Notes R5.1

## introduction

This document describes the new features and changes introduced in Thunder R5.1 (compared to the latest R5.0 release).
See [here](https://github.com/rdkcentral/Thunder/blob/R5_0/ReleaseNotes/ThunderReleaseNotes_R5.0.md) for the release notes of Thunder R5.0.
This document describes the changes in Thunder, ThunderTools and ThunderInterfaces as they are related.

# Thunder

## Process Changes and new Features

### Feature: Github actions extensions

The Github actions were extended to have better build coverage, they are ran on every Pull Request commit. More components are now included in the builds. Also the 32bit build and Process Containers are now included as target.

### Change: Unit test improvements

The existing Thunder unit tests were improved again and new tests were added. These are also triggered from a GitHub action on each commit added to a Thunder Pull Request.

### Change: Thunder Documentation

The Thunder documentation was extended with new content, please find the documentation [here](https://rdkcentral.github.io/Thunder/). More content still to come!

## Changes and new Features

### New Feature: Whole plugin OOP (out of process)

It so now possible to run the full plugin out of process (OOP). Before this feature was added a plugin had to be specifically designed to be run OOP and part of it was always in process. The "whole plugin OOP" feature is added mainly as a development/debug option, for example to test leaks and crashes with plugins only designed to run in process. There is also the prerequisite that the plugin must have a JSON-RPC interface, a prerequisite that may be removed in a future Thunder version.
You use this feature by adding a root section including mode="Local" outside the config part of the plugin (like you normally would have inside the plugin config). Any other modes should work as well but have not been tested.

### New Feature: PluginSmartInterfaceType

Next to the already existing SmartInterfaceType that can be used to more easily communicate with plugins exposing interfaces over a COM-RPP connection from native code a new PluginSmartInterfaceType was added that enables the same but then from plugin to plugin. Of course this could already be done but the new PluginSmartInterfaceType makes this much easier and requires less boilerplate code.
Find the code [here](https://github.com/rdkcentral/Thunder/blob/ac3f7d42d22715897ddce76d49ee164d36d5cc10/Source/plugins/Types.h#L403) and an example on how to use this feature can be found [here](https://github.com/rdkcentral/ThunderNanoServices/tree/master/examples/PluginSmartInterfaceType).

### New Feature: Concurrent Process Containers

On request of an external partner it is now possible to have multiple container flavours (container providers) active at the same time.
This feature was added fully backwards compatible regarding the Thunder and plugin config files, meaning if only one provider is active no changes to the config files are needed. However a change is required to the Container implementation as well and this has been done for runC and LXC. For Dobby and AWC we are discussing this with the owners of these implementations.
To use the feature first enable multiple container providers in your build. Then in the Thunder config file add the following section to set the default container implementation to be used for a plugin:
```json
"processcontainers" : {
"default" : "lxc"
}
```
Other valid options are: "runc", "crun", "dobby" and "awc".
If in a plugin you want to use another container flavour than the default one you can do so by adding this to the config file of the container (of course the "mode : Container" should always be there when you want to run a plugin inside a container):
```json
"root":{
"mode":"Container",
"configuration" : {
"containertype":"runc"
}
}
```
More detailed documentation on this feature and process containers in general will be added to the Thunder documentation in the near future.

### New Feature: Flowcontrol

To mitigate issues with plugins that have methods that have a relatively long processing time while at the same time have an interface that for example invite the user of the interface to do a lot of calls to the plugin and/or the plugin emits a lot of events Thunder 5.1 now has a FlowControl feature.
Per channel (e.g. websocket) there can now be only one JSON-RPC call at a time, the next call received in parallel while the first one has not been handled will only be executed once the first one has been completed. Next to the channel flow control also a feature is added that will only allow one JSON-RPC call at a time to a certain plugin, so even if they come from different channels.
In a future Thunder version the number of allowed parallel calls (both for a channel as to a plugin) will be made configurable.

### New Feature: Destroy plugin option

Next to the already existing possibility to Clone a plugin it is now also possible to Destroy a (cloned) plugin using the Controller COM-RPC or JSON-RPC interface.

### Change: General bug fixes

As Thunder R5.0 was quite a change compared to Thunder R4 a lot of issue found in the mean time in Thunder 5.0 have been fixed in Thunder 5.1. If you are using Thunder 5.0 we would strongly advice to upgrade to Thunder 5.1. As Thunder 5.1 is released relatively short after Thunder 5.0 it does not contain that many new features and changes but more importantly does contain quite some fixes for issues found in Thunder 5.0.

### Change: Message Engine improvements

There were quite some improvements to the message engine. UDP support for exporting messages was enhanced greatly.

## Breaking Changes

Although Thunder 5.1 is a minor upgrade and therefore should not contain breaking changes there is one however. This because of the request to the Thunder team to include this fix and only after consulting Thunder user representatives.

### Change: JSON-RPC over HTTP error code

We were made aware that the HTTP 202 result code that was returned in case there was an error handling a JSON-RPC call over HTTP was not as one would expect.
We did some investigation and although there is no official RFC for JSON-RPC over HTTP the consensus is indeed a 200 code should be returned, also when there is an error handling the JSON-RPC call. So Thunder 5.1 will return a HTTP 200 result code in this case.
Note in case this does cause issues in certain situations the old behaviour can be simply brought back by setting the LEGACY_JSONRPCOVERHTTP_ERRORCODE build flag when building Thunder.

# Thunder Tools

## Changes and new Features

### Case handling improvements

There were may changes in the code generators to better support the different Case options for the JSON-RPC methods, parameters, POD members etc.

### camelCase COM-RPC methods

camelCase COM-RPC methods names are now allowed and supported by the generators (please note this is not the standard used in the Thunder repositories)

### Enhanced fixed array support

Fixed arrays are now also allowed as method parameters and POD members in interfaces. Please note only primitive types are allowed as already was the case with dynamic arrays. Thunder documentation will be updated soon with more information on this.

### OptionalType enhancements

OptionalType is now also allowed for property indexes and iterators in interfaces. The OptionalType for the property index is for example used in the Thunder Controller interface: if filled it indicates the callsign of the plugin for which info is requested, if omitted (so empty) information for all plugins will be returned.

### null returned for property setter

In case a property setter was used with an array or object it might return something else than null in previous versions of Thunder. The generated documentation however did (correctly) specify null would be returned. This is now also actually the case for the generated code.

# Thunder Interfaces

## Changes and new Features

### IDolby

IDolby was made backwards compatible again (this was broken in ThunderInterfaces R5.0)
84 changes: 12 additions & 72 deletions Source/Thunder/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,64 +114,6 @@ namespace PluginHost {
// Configuration to get a server (PluginHost server) up and running.
class JSONConfig : public Core::JSON::Container {
public:
class Environment : public Core::JSON::Container {
public:
Environment()
: Core::JSON::Container()
, Key()
, Value()
, Override(false)
{
Add(_T("key"), &Key);
Add(_T("value"), &Value);
Add(_T("override"), &Override);
}
Environment(const Environment& copy)
: Core::JSON::Container()
, Key(copy.Key)
, Value(copy.Value)
, Override(copy.Override)
{
Add(_T("key"), &Key);
Add(_T("value"), &Value);
Add(_T("override"), &Override);
}
Environment(Environment&& move) noexcept
: Core::JSON::Container()
, Key(std::move(move.Key))
, Value(std::move(move.Value))
, Override(std::move(move.Override))
{
Add(_T("key"), &Key);
Add(_T("value"), &Value);
Add(_T("override"), &Override);
}
~Environment() override = default;
Environment& operator=(const Environment& RHS)
{
Key = RHS.Key;
Value = RHS.Value;
Override = RHS.Override;

return (*this);
}
Environment& operator=(Environment&& move) noexcept
{
if (this != &move) {
Key = std::move(move.Key);
Value = std::move(move.Value);
Override = std::move(move.Override);
}

return (*this);
}

public:
Core::JSON::String Key;
Core::JSON::String Value;
Core::JSON::Boolean Override;
};

class ProcessSet : public Core::JSON::Container {
public:
ProcessSet()
Expand Down Expand Up @@ -526,7 +468,7 @@ namespace PluginHost {
Core::JSON::String Configs;
Core::JSON::String EthernetCard;
Core::JSON::ArrayType<Plugin::Config> Plugins;
Core::JSON::ArrayType<Environment> Environments;
Core::JSON::ArrayType<Plugin::Config::Environment> Environments;
Core::JSON::ArrayType<Core::JSON::EnumType<PluginHost::IShell::reason>> ExitReasons;
Core::JSON::DecSInt32 Latitude;
Core::JSON::DecSInt32 Longitude;
Expand Down Expand Up @@ -654,7 +596,7 @@ namespace PluginHost {
Config& operator=(const Config&) = delete;

PUSH_WARNING(DISABLE_WARNING_THIS_IN_MEMBER_INITIALIZER_LIST)
Config(Core::File& file, const bool background, Core::OptionalType<Core::JSON::Error>& error)
Config(Core::File& file, const bool background, Core::OptionalType<Core::JSON::Error>& error)
: _background(background)
, _prefix()
, _webPrefix()
Expand Down Expand Up @@ -772,18 +714,15 @@ namespace PluginHost {
}
}

bool status = true;
Core::JSON::ArrayType<JSONConfig::Environment>::ConstIterator index(static_cast<const JSONConfig&>(config).Environments.Elements());
Core::JSON::ArrayType<Plugin::Config::Environment>::ConstIterator index(static_cast<const JSONConfig&>(config).Environments.Elements());
while (index.Next() == true) {
if ((index.Current().Key.IsSet() == true) && (index.Current().Value.IsSet() == true)) {
if (index.Current().Key.IsSet() == false) {
SYSLOG(Logging::Startup, (_T("Failure n setting an environmet variable. Empty key defined!!\n")));
}
else {
string value = _substituter.Substitute(index.Current().Value.Value(), nullptr);
if (value.empty() != true) {
status = Core::SystemInfo::SetEnvironment(index.Current().Key.Value(), value, index.Current().Override.Value());
if (status != true) {
SYSLOG(Logging::Startup, (_T("Failure in setting Key:Value:[%s]:[%s]\n"), index.Current().Key.Value().c_str(), index.Current().Value.Value().c_str()));
}
} else {
SYSLOG(Logging::Startup, (_T("Failure in Substituting Value of Key:Value:[%s]:[%s]\n"), index.Current().Key.Value().c_str(), index.Current().Value.Value().c_str()));
if (Core::SystemInfo::SetEnvironment(index.Current().Key.Value(), value, ((index.Current().Scope.Value() == RPC::Environment::scope::GLOBAL) ? true : false)) != true) {
SYSLOG(Logging::Startup, (_T("Failure in setting Key:Value:[%s]:[%s]\n"), index.Current().Key.Value().c_str(), index.Current().Value.Value().c_str()));
}
}
}
Expand All @@ -794,11 +733,12 @@ namespace PluginHost {
_plugins = config.Plugins;

Core::JSON::ArrayType<Core::JSON::String>::Iterator itr(config.LinkerPluginPaths.Elements());
while (itr.Next())
while (itr.Next() == true) {
_linkerPluginPaths.push_back(itr.Current().Value());
}
}
}
POP_WARNING()
POP_WARNING()
~Config()
{
ASSERT(_security != nullptr);
Expand Down
Loading

0 comments on commit ea398a9

Please sign in to comment.