Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/native_full_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Build Component in Native Environment

on:
push:
branches: [ main, 'sprint/**', 'release/**', topic/*, develop ]
pull_request:
branches: [ main, 'sprint/**', 'release/**', topic/*, develop ]

jobs:
build-entservices-on-pr:
name: Build xdialserver component in github rdkcentral
runs-on: ubuntu-latest
container:
image: ghcr.io/rdkcentral/docker-rdk-ci:latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: native build
run: |
sh -x build_dependencies.sh
sh -x cov_build.sh
env:
GITHUB_TOKEN: ${{ secrets.RDKCM_RDKE }}
130 changes: 130 additions & 0 deletions build_dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
#!/bin/bash
set -x
set -e
##############################
GITHUB_WORKSPACE="${PWD}"

cd ${GITHUB_WORKSPACE}

# # #############################
#1. Install Dependencies and packages

apt update
apt install -y ninja-build meson curl libsoup2.4-dev libxml2-dev libglib2.0-dev gobject-introspection libgirepository1.0-dev libgtk-3-dev valac pandoc
pip install jsonref

############################
# Build trevor-base64
if [ ! -d "trower-base64" ]; then
git clone https://github.com/xmidt-org/trower-base64.git
fi
cd trower-base64
meson setup --warnlevel 3 --werror build
ninja -C build
ninja -C build install
cd ..
###########################################
# Clone the required repositories

rm -rf iarmbus ThunderTools Thunder entservices-apis entservices-testframework gssdp


git clone https://github.com/rdkcentral/iarmbus.git
export IARMBUS_PATH=$GITHUB_WORKSPACE/iarmbus

git clone --branch R4.4.3 https://github.com/rdkcentral/ThunderTools.git

git clone --branch R4.4.1 https://github.com/rdkcentral/Thunder.git

git clone --branch main https://github.com/rdkcentral/entservices-apis.git

git clone https://[email protected]/rdkcentral/entservices-testframework.git

git clone --branch gssdp-1.2.3 https://gitlab.gnome.org/GNOME/gssdp.git

############################
# Build gssdp-1.2
echo "======================================================================================"
echo "buliding gssdp-1.2"
cd gssdp

rm -rf build
meson setup build

ninja -C build
ninja -C build install
cd -

############################
# Build Thunder-Tools
echo "======================================================================================"
echo "buliding thunderTools"
cd ThunderTools
patch -p1 < $GITHUB_WORKSPACE/entservices-testframework/patches/00010-R4.4-Add-support-for-project-dir.patch
cd -


cmake -G Ninja -S ThunderTools -B build/ThunderTools \
-DEXCEPTIONS_ENABLE=ON \
-DCMAKE_INSTALL_PREFIX="/usr" \
-DCMAKE_MODULE_PATH="$GITHUB_WORKSPACE/install/tools/cmake" \
-DGENERIC_CMAKE_MODULE_PATH="$GITHUB_WORKSPACE/install/tools/cmake" \

cmake --build build/ThunderTools --target install


############################
# Build Thunder
echo "======================================================================================"
echo "buliding thunder"

cd Thunder
patch -p1 < $GITHUB_WORKSPACE/entservices-testframework/patches/Use_Legact_Alt_Based_On_ThunderTools_R4.4.3.patch
patch -p1 < $GITHUB_WORKSPACE/entservices-testframework/patches/error_code_R4_4.patch
patch -p1 < $GITHUB_WORKSPACE/entservices-testframework/patches/1004-Add-support-for-project-dir.patch
patch -p1 < $GITHUB_WORKSPACE/entservices-testframework/patches/RDKEMW-733-Add-ENTOS-IDS.patch
cd -

cmake -G Ninja -S Thunder -B build/Thunder \
-DMESSAGING=ON \
-DCMAKE_INSTALL_PREFIX="/usr" \
-DCMAKE_MODULE_PATH="$GITHUB_WORKSPACE/install/tools/cmake" \
-DGENERIC_CMAKE_MODULE_PATH="$GITHUB_WORKSPACE/install/tools/cmake" \
-DBUILD_TYPE=Debug \
-DBINDING=127.0.0.1 \
-DPORT=55555 \
-DEXCEPTIONS_ENABLE=ON \

cmake --build build/Thunder --target install

############################
# Build entservices-apis
echo "======================================================================================"
echo "buliding entservices-apis"
cd entservices-apis
rm -rf jsonrpc/DTV.json
cd ..

cmake -G Ninja -S entservices-apis -B build/entservices-apis \
-DEXCEPTIONS_ENABLE=ON \
-DCMAKE_INSTALL_PREFIX="/usr" \
-DCMAKE_MODULE_PATH="$GITHUB_WORKSPACE/install/tools/cmake" \

cmake --build build/entservices-apis --target install

############################

############################
# Build and deploy stubs for IARMBus and WPEFramework securityagent
mkdir -p /usr/include/WPEFramework/securityagent
cp $GITHUB_WORKSPACE/stubs/securityagent/* /usr/include/WPEFramework/securityagent/ -v

echo "======================================================================================"
echo "Building IARMBus and WPEFramework securityagent stubs"
cd $GITHUB_WORKSPACE
cd ./stubs
g++ -fPIC -shared -o libIARMBus.so iarm_stubs.cpp -I$GITHUB_WORKSPACE/stubs -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I$IARMBUS_PATH/core -I$IARMBUS_PATH/core/include -fpermissive
g++ -fPIC -shared -o libWPEFrameworkSecurityUtil.so securityagent/SecurityTokenUtil.cpp -I$GITHUB_WORKSPACE/stubs -fpermissive

cp libIARMBus.so /usr/local/lib/
cp libWPEFrameworkSecurityUtil.so /usr/local/lib/
16 changes: 16 additions & 0 deletions cov_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
set -x
set -e
##############################
GITHUB_WORKSPACE="${PWD}"
ls -la ${GITHUB_WORKSPACE}
############################
# Build xdialserver
echo "buliding xdialserver"

cd ${GITHUB_WORKSPACE}

make

echo "======================================================================================"
exit 0
10 changes: 2 additions & 8 deletions server/include/gdial-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
* limitations under the License.
*/

#ifndef GDIAL_H_
#define GDIAL_H_
#ifndef _GDIAL_CONFIG_H_
#define _GDIAL_CONFIG_H_

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -81,12 +81,6 @@ extern "C" {
#define GDIAL_THROTTLE_DELAY_US 100000
#define GDIAL_DEBUG g_print

enum {
GDIAL_ERROR_NONE = 0,
GDIAL_ERROR_NOT_REGISTERED,
GDIAL_ERROR_FAIL_TO_START,
} GDialError;

#define GDIAL_GERROR_CHECK_AND_FREE(err, msg) \
{\
if (err) {\
Expand Down
68 changes: 68 additions & 0 deletions stubs/iarm_stubs.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#include "libIBus.h"
#include "libIARMCore.h"
using namespace std;

IARM_Result_t IARM_Malloc(IARM_MemType_t type, size_t size, void **ptr)
{
return IARM_RESULT_SUCCESS;
}

IARM_Result_t IARM_Free(IARM_MemType_t type, void *alloc)
{
return IARM_RESULT_SUCCESS;
}

IARM_Result_t IARM_Bus_BroadcastEvent(const char *ownerName, IARM_EventId_t eventId, void *arg, size_t argLen)
{
return IARM_RESULT_SUCCESS;
}

IARM_Result_t IARM_Bus_Init(const char* name)
{
return IARM_RESULT_SUCCESS;
}

IARM_Result_t IARM_Bus_Connect()
{
return IARM_RESULT_SUCCESS;
}

IARM_Result_t IARM_Bus_IsConnected(const char* memberName, int* isRegistered)
{
return IARM_RESULT_SUCCESS;
}

IARM_Result_t IARM_Bus_RegisterEventHandler(const char* ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler)
{
return IARM_RESULT_SUCCESS;
}

IARM_Result_t IARM_Bus_UnRegisterEventHandler(const char* ownerName, IARM_EventId_t eventId)
{
return IARM_RESULT_SUCCESS;
}

IARM_Result_t IARM_Bus_RemoveEventHandler(const char* ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler)
{
return IARM_RESULT_SUCCESS;
}
IARM_Result_t IARM_Bus_RegisterCall(const char *methodName, IARM_BusCall_t handler)
{
return IARM_RESULT_SUCCESS;
}
IARM_Result_t IARM_Bus_Term(void)
{
return IARM_RESULT_SUCCESS;
}
IARM_Result_t IARM_Bus_Disconnect(void)
{
return IARM_RESULT_SUCCESS;
}
IARM_Result_t IARM_Bus_RegisterEvent(IARM_EventId_t maxEventId)
{
return IARM_RESULT_SUCCESS;
}
IARM_Result_t IARM_Bus_Call(const char* ownerName, const char* methodName, void* arg, size_t argLen)
{
return IARM_RESULT_SUCCESS;
}
56 changes: 56 additions & 0 deletions stubs/securityagent/SecurityTokenUtil.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:
*
* Copyright 2020 RDK Management
*
* Licensed 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.
*/

#include <iostream>
#include <cstring>
#include "SecurityTokenUtil.h"
/*
* Send thunder security token for localhost.
* This token can be used by native applications to securely access rdkservices.
*/

using namespace std;

extern "C" {
/*
* GetSecurityToken - function to obtain a token from SecurityAgent
*
* Parameters
* maxLength - holds the maximum uint8_t length of the buffer
* Id - Buffer to hold the token.
*
* Return value
* < 0 - failure, absolute value returned is the length required to store the token
* > 0 - success, char length of the returned token
*
* Post-condition; return value 0 should not occur
*
*/
int GetSecurityToken(unsigned short maxLength, unsigned char buffer[])
{
// get a localhost token
string payload = "http://localhost";

size_t len = payload.length();

if(!memcpy(buffer,payload.c_str(),len))
return -1;
return 0;
}
}
50 changes: 50 additions & 0 deletions stubs/securityagent/SecurityTokenUtil.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:
*
* Copyright 2020 RDK Management
*
* Licensed 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.
*/

#pragma once

#ifdef __WINDOWS__
#undef EXTERNAL
#ifdef SECURITYUTILITY_EXPORTS
#define EXTERNAL EXTERNAL_EXPORT
#else
#define EXTERNAL EXTERNAL_IMPORT
#endif
#else
#undef EXTERNAL
#define EXTERNAL
#endif

extern "C" {
/*
* GetSecurityToken - function to obtain a token from SecurityAgent
*
* Parameters
* maxLength - holds the maximum uint8_t length of the buffer
* buffer - Buffer to hold the token.
*
* Return value
* < 0 - failure, absolute value returned is the length required to store the token
* > 0 - success, char length of the returned token
*
* Post-condition; return value 0 should not occur
*
*/
int EXTERNAL GetSecurityToken(unsigned short maxLength, unsigned char buffer[]);
}
Loading