Skip to content

Commit

Permalink
Merge branch 'COVESA:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
LocutusOfBorg authored Oct 15, 2024
2 parents 524227d + 7a6700e commit 3573bd9
Show file tree
Hide file tree
Showing 27 changed files with 756 additions and 315 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/BuildPR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Show cmake version
run: cmake --version
- name: Build project
run: scripts/darwin/build.sh
run: scripts/darwin/build_cmake.sh
- name: Codesign app bundle
if: "! github.event.pull_request.head.repo.fork " # not running on a fork
# Extract the secrets we defined earlier as environment variables
Expand Down Expand Up @@ -124,6 +124,8 @@ jobs:
run: scripts/linux/install.sh
- name: Build project
run: scripts/linux/build.sh
- name: Run tests
run: ctest --test-dir build/qdlt
- name: Make artifact executable
run: chmod -R +x build/dist
- name: Archive artifact
Expand Down
72 changes: 67 additions & 5 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
runs-on: ${{ matrix.macos }}
strategy:
matrix:
xcode: [ Xcode_15.2 ]
abi: [ x86 ]
macos: [ macos-13 ]
abi: [ x86 ]
xcode: [ Xcode_15.2 ]
include:
- macos: macos-14
abi: arm64
Expand All @@ -34,14 +34,76 @@ jobs:
- name: install build environment
run: scripts/darwin/install.sh
- name: Build project
run: scripts/darwin/build.sh
run: scripts/darwin/build_cmake.sh
- name: Codesign app bundle
if: "! github.event.pull_request.head.repo.fork " # not running on a fork
# Extract the secrets we defined earlier as environment variables
env:
MACOS_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.P12_PASSWORD }}
MACOS_CERTIFICATE_NAME: ${{ secrets.APPLE_CERTIFICATE_NAME }}
MACOS_CI_KEYCHAIN_PWD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# Turn our base64-encoded certificate back to a regular .p12 file
echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12
# We need to create a new keychain, otherwise using the certificate will prompt
# with a UI dialog asking for the certificate password, which we can't
# use in a headless CI environment
security create-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_CI_KEYCHAIN_PWD" build.keychain
# We finally codesign our app bundle, specifying the Hardened runtime option
/usr/bin/codesign --timestamp --options=runtime -s "$MACOS_CERTIFICATE_NAME" -f -v /Users/runner/work/dlt-viewer/dlt-viewer/build/install/DLTViewer.app/Contents/Frameworks/*
/usr/bin/codesign --timestamp --options=runtime -s "$MACOS_CERTIFICATE_NAME" -f -v /Users/runner/work/dlt-viewer/dlt-viewer/build/install/DLTViewer.app/Contents/Resources/*
/usr/bin/codesign --timestamp --options=runtime -s "$MACOS_CERTIFICATE_NAME" -f -v /Users/runner/work/dlt-viewer/dlt-viewer/build/install/DLTViewer.app/Contents/PlugIns/bearer/*
/usr/bin/codesign --timestamp --options=runtime -s "$MACOS_CERTIFICATE_NAME" -f -v /Users/runner/work/dlt-viewer/dlt-viewer/build/install/DLTViewer.app/Contents//PlugIns/iconengines/*
/usr/bin/codesign --timestamp --options=runtime -s "$MACOS_CERTIFICATE_NAME" -f -v /Users/runner/work/dlt-viewer/dlt-viewer/build/install/DLTViewer.app/Contents/PlugIns/imageformats/*
/usr/bin/codesign --timestamp --options=runtime -s "$MACOS_CERTIFICATE_NAME" -f -v /Users/runner/work/dlt-viewer/dlt-viewer/build/install/DLTViewer.app/Contents/PlugIns/platforminputcontexts/*
/usr/bin/codesign --timestamp --options=runtime -s "$MACOS_CERTIFICATE_NAME" -f -v /Users/runner/work/dlt-viewer/dlt-viewer/build/install/DLTViewer.app/Contents/PlugIns/platforms/*
/usr/bin/codesign --timestamp --options=runtime -s "$MACOS_CERTIFICATE_NAME" -f -v /Users/runner/work/dlt-viewer/dlt-viewer/build/install/DLTViewer.app/Contents/PlugIns/printsupport/*
/usr/bin/codesign --timestamp --options=runtime -s "$MACOS_CERTIFICATE_NAME" -f -v /Users/runner/work/dlt-viewer/dlt-viewer/build/install/DLTViewer.app/Contents/PlugIns/styles/*
/usr/bin/codesign --timestamp --options=runtime -s "$MACOS_CERTIFICATE_NAME" -f -v /Users/runner/work/dlt-viewer/dlt-viewer/build/install/DLTViewer.app/Contents/PlugIns/virtualkeyboard/*
/usr/bin/codesign --timestamp --options=runtime -s "$MACOS_CERTIFICATE_NAME" -f -v /Users/runner/work/dlt-viewer/dlt-viewer/build/install/DLTViewer.app/Contents/MacOS/plugins/*
/usr/bin/codesign --timestamp --options=runtime -s "$MACOS_CERTIFICATE_NAME" -f -v /Users/runner/work/dlt-viewer/dlt-viewer/build/install/DLTViewer.app/Contents/MacOS/dlt-commander
/usr/bin/codesign --timestamp --options=runtime -s "$MACOS_CERTIFICATE_NAME" -f -v /Users/runner/work/dlt-viewer/dlt-viewer/build/install/DLTViewer.app/Contents/MacOS/dlt-viewer
/usr/bin/codesign --timestamp --options=runtime -s "$MACOS_CERTIFICATE_NAME" -f -v /Users/runner/work/dlt-viewer/dlt-viewer/build/install/DLTViewer.app
- name: Notarize app bundle
if: "! github.event.pull_request.head.repo.fork " # not running on a fork
env:
PROD_MACOS_NOTARIZATION_APPLE_ID: ${{ secrets.APPLE_ID }}
PROD_MACOS_NOTARIZATION_TEAM_ID: ${{ secrets.TEAM_ID }}
PROD_MACOS_NOTARIZATION_PWD: ${{ secrets.APP_PASSWORD }}
run: |
echo "Create keychain profile"
xcrun notarytool store-credentials "notarytool-profile" --apple-id "$PROD_MACOS_NOTARIZATION_APPLE_ID" --team-id "$PROD_MACOS_NOTARIZATION_TEAM_ID" --password "$PROD_MACOS_NOTARIZATION_PWD"
echo "Creating temp notarization archive"
ditto -c -k --keepParent "/Users/runner/work/dlt-viewer/dlt-viewer/build/install/DLTViewer.app" "/Users/runner/work/dlt-viewer/dlt-viewer/build/install/DLTViewer.zip"
echo "Notarize app"
xcrun notarytool submit "/Users/runner/work/dlt-viewer/dlt-viewer/build/install/DLTViewer.zip" --keychain-profile "notarytool-profile" --wait
echo "Attach staple"
xcrun stapler staple "/Users/runner/work/dlt-viewer/dlt-viewer/build/install/DLTViewer.app"
rm -r /Users/runner/work/dlt-viewer/dlt-viewer/build/install/DLTViewer.zip
- name: Artifact Creation
run: |
cd /Users/runner/work/dlt-viewer/dlt-viewer/build
mkdir -p dist
cp ../scripts/darwin/install.md dist
tar -czvf "dist/DLTViewer.tgz" -C /Users/runner/work/dlt-viewer/dlt-viewer/build/install .
- name: Archive artifact
run: zip DLT-macOS-${{ matrix.abi }}.zip -r build/dist
- name: Upload DLT artifact
- name: Archive artifact
uses: actions/upload-artifact@v4
if: ${{ success() }}
with:
name: DLT-Mac-${{ matrix.abi }}
path: DLT-macOS-${{ matrix.abi }}.zip
path: DLT-macOS*.zip

buildLinux:
name: Build ${{ matrix.ubuntu }}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
call build_sdk_windows_qt5_MSVC.bat
call build_sdk_windows_qt5_MSVC_qmake.bat
SET RETCODE=%ERRORLEVEL%
set /p name= Continue
exit /b %RETCODE%
File renamed without changes.
1 change: 1 addition & 0 deletions qdlt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ endforeach()
find_package(GTest)
# configure unit tests only if gtest found on the system
if (GTest_FOUND)
message(STATUS "Tests enabled")
enable_testing()
add_subdirectory(tests)
endif()
2 changes: 2 additions & 0 deletions qdlt/qdlt.pro
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ CONFIG += warn_on qt
QT += network
QT += serialport

win32:LIBS += User32.lib

# Put intermediate files in the build directory
MOC_DIR = build/moc
OBJECTS_DIR = build/obj
Expand Down
60 changes: 38 additions & 22 deletions qdlt/qdltexporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ void QDltExporter::writeCSVLine(int index, QFile *to, QDltMsg msg)
text += escapeCSVValue(QString("%1").arg(msg.getSubtypeString())).append(delimiter);
text += escapeCSVValue(QString("%1").arg(msg.getModeString())).append(delimiter);
text += escapeCSVValue(QString("%1").arg(msg.getNumberOfArguments())).append(delimiter);
text += escapeCSVValue(msg.toStringPayload().simplified().remove(QChar::Null));
QString payload = msg.toStringPayload().simplified().remove(QChar::Null);
if(from) from->applyRegExString(msg,payload);
text += escapeCSVValue(payload);
text += "\n";

to->write(text.toLatin1().constData());
Expand Down Expand Up @@ -97,12 +99,12 @@ bool QDltExporter::start()
{
if(!to->open(QIODevice::WriteOnly | QIODevice::Text))
{
if ( true == QDltOptManager::getInstance()->issilentMode() )
{
qDebug() << QString("ERROR - cannot open the export file %1").arg(to->fileName());
}
else
;//QMessageBox::critical(qobject_cast<QWidget *>(parent()), QString("DLT Viewer"),
if (QDltOptManager::getInstance()->issilentMode())
{
qDebug() << QString("ERROR - cannot open the export file %1").arg(to->fileName());
}
//else
//QMessageBox::critical(qobject_cast<QWidget *>(parent()), QString("DLT Viewer"),
// QString("Cannot open the export file %1").arg(to->fileName()));
return false;
}
Expand All @@ -111,12 +113,12 @@ bool QDltExporter::start()
{
if(!to->open(QIODevice::WriteOnly))
{
if ( true == QDltOptManager::getInstance()->issilentMode() )
{
qDebug() << QString("ERROR - cannot open the export file %1").arg(to->fileName());
}
else
;//QMessageBox::critical(qobject_cast<QWidget *>(parent()), QString("DLT Viewer"),
if (QDltOptManager::getInstance()->issilentMode() )
{
qDebug() << QString("ERROR - cannot open the export file %1").arg(to->fileName());
}
//else
//QMessageBox::critical(qobject_cast<QWidget *>(parent()), QString("DLT Viewer"),
// QString("Cannot open the export file %1").arg(to->fileName()));
return false;
}
Expand All @@ -128,12 +130,12 @@ bool QDltExporter::start()
/* Write the first line of CSV file */
if(!writeCSVHeader(to))
{
if ( true == QDltOptManager::getInstance()->issilentMode() )
{
qDebug() << QString("ERROR - cannot open the export file %1").arg(to->fileName());
}
else
;//QMessageBox::critical(qobject_cast<QWidget *>(parent()), QString("DLT Viewer"),
if(QDltOptManager::getInstance()->issilentMode())
{
qDebug() << QString("ERROR - cannot open the export file %1").arg(to->fileName());
}
//else
//QMessageBox::critical(qobject_cast<QWidget *>(parent()), QString("DLT Viewer"),
// QString("Cannot open the export file %1").arg(to->fileName()));
return false;
}
Expand Down Expand Up @@ -280,7 +282,9 @@ bool QDltExporter::exportMsg(unsigned long int num, QDltMsg &msg, QByteArray &bu

text += " ";
}
text += msg.toStringPayload().simplified().remove(QChar::Null);
QString payload = msg.toStringPayload().simplified().remove(QChar::Null);
if(from) from->applyRegExString(msg,payload);
text += payload;
text += "\n";
try
{
Expand Down Expand Up @@ -326,11 +330,13 @@ bool QDltExporter::exportMsg(unsigned long int num, QDltMsg &msg, QByteArray &bu
text += "|" + QString("%1.%2").arg(msg.getGmTimeWithOffsetString(utcOffset,dst)).arg(msg.getMicroseconds(),6,10,QLatin1Char('0'));
else
text += "|" + QString("%1.%2").arg(msg.getTimeString()).arg(msg.getMicroseconds(),6,10,QLatin1Char('0'));
QString payload = msg.toStringPayload().simplified().remove(QChar::Null);
if(from) from->applyRegExString(msg,payload);
text += "|" + QString("%1.%2").arg(msg.getTimestamp()/10000).arg(msg.getTimestamp()%10000,4,10,QLatin1Char('0')) +
"|" + msg.getEcuid() +
"|" + msg.getApid() +
"|" + msg.getCtid() +
"|" + msg.toStringPayload().simplified().remove(QChar::Null).replace('|', "\\|").replace('#', "\\#").replace('*', "\\*") +
"|" + payload.replace('|', "\\|").replace('#', "\\#").replace('*', "\\*") +
"| |\n";
clipboardString += text;
}
Expand Down Expand Up @@ -374,7 +380,6 @@ void QDltExporter::exportMessages(QDltFile *from, QFile *to, QDltPluginManager *
return;
}


bool silentMode = !QDltOptManager::getInstance()->issilentMode();

if ( this->stoping_index == 0 || this->stoping_index > this->size || this->stoping_index < this->starting_index )
Expand Down Expand Up @@ -420,6 +425,7 @@ void QDltExporter::exportMessages(QDltFile *from, QFile *to, QDltPluginManager *
// decode message if needed
if(exportFormat != QDltExporter::FormatDlt)
{
//FIXME: The following does not work for non verbose messages, must be fixed
if(pluginManager)
pluginManager->decodeMsg(msg,silentMode);
if (exportFormat == QDltExporter::FormatDltDecoded)
Expand All @@ -429,6 +435,16 @@ void QDltExporter::exportMessages(QDltFile *from, QFile *to, QDltPluginManager *
}
}

// apply Regex if needed
if(exportFormat == QDltExporter::FormatDlt || exportFormat == QDltExporter::FormatDltDecoded)
{
//FIXME: The following does not work for non verbose messages, must be fixed to enable RegEx for DLT Export again
//msg.setNumberOfArguments(msg.sizeArguments());
bool isApplied = false;
if(from) isApplied = from->applyRegExStringMsg(msg);
if(isApplied) msg.getMsg(buf,true);
}

// export message
if(!exportMsg(starting,msg,buf))
{
Expand Down
11 changes: 11 additions & 0 deletions qdlt/qdltfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -754,3 +754,14 @@ void QDltFile::setIndexFilter(QVector<qint64> _indexFilter)
{
indexFilter = _indexFilter;
}

bool QDltFile::applyRegExString(QDltMsg &msg,QString &text)
{

return filterList.applyRegExString(msg,text);
}

bool QDltFile::applyRegExStringMsg(QDltMsg &msg)
{
return filterList.applyRegExStringMsg(msg);
}
10 changes: 10 additions & 0 deletions qdlt/qdltfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,16 @@ class QDLT_EXPORT QDltFile : public QDlt
**/
bool getDLTv2Support() const;

//! Apply RegEx Replace to the string, if any active in the filters
/*!
*/
bool applyRegExString(QDltMsg &msg,QString &text);

//! Apply RegEx Replace to the arguments of a message, if any active in the filters
/*!
*/
bool applyRegExStringMsg(QDltMsg &msg);

protected:

private:
Expand Down
52 changes: 52 additions & 0 deletions qdlt/qdltfilterlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
* @licence end@
*/

#include <regex>
#include <stdlib.h>

#include <QtDebug>
#include <QCryptographicHash>

Expand Down Expand Up @@ -121,6 +124,55 @@ QString QDltFilterList::checkMarker(QDltMsg &msg)

#endif

bool QDltFilterList::applyRegExString(QDltMsg &msg,QString &text)
{
QDltFilter *filter;
bool result = false;

for(int numfilter=0;numfilter<pfilters.size();numfilter++)
{
filter = pfilters[numfilter];

if(filter->enableFilter && filter->enableRegexSearchReplace && filter->match(msg))
{
text.replace(QRegularExpression(filter->regex_search), filter->regex_replace);
result = true;
}
}
return result;
}

bool QDltFilterList::applyRegExStringMsg(QDltMsg &msg)
{
QDltFilter *filter;
bool result = false;

for(int numfilter=0;numfilter<pfilters.size();numfilter++)
{
filter = pfilters[numfilter];

if(filter->enableFilter && filter->enableRegexSearchReplace && filter->match(msg))
{
for(int num=0;num<msg.getNumberOfArguments();num++)
{
QDltArgument arg;
msg.getArgument(num,arg);
if(arg.getTypeInfo()==QDltArgument::DltTypeInfoStrg || arg.getTypeInfo()==QDltArgument::DltTypeInfoUtf8)
{
QString text = arg.getValue().toString();
text.replace(QRegularExpression(filter->regex_search), filter->regex_replace);
arg.setValue(text);
msg.removeArgument(num);
msg.addArgument(arg,num);
}
}

result = true;
}
}
return result;
}

bool QDltFilterList::checkFilter(QDltMsg &msg)
{
QDltFilter *filter;
Expand Down
10 changes: 10 additions & 0 deletions qdlt/qdltfilterlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,16 @@ class QDLT_EXPORT QDltFilterList
*/
void updateSortedFilter();

//! Apply RegEx Replace to the string, if any active in the filters.
/*!
*/
bool applyRegExString(QDltMsg &msg,QString &text);

//! Apply RegEx Replace to the argumnets of a message, if any active in the filters.
/*!
*/
bool applyRegExStringMsg(QDltMsg &msg);

protected:
private:

Expand Down
Loading

0 comments on commit 3573bd9

Please sign in to comment.