Compare commits

...

6 Commits

Author SHA1 Message Date
Roman Telezhynskyi 187fbd0208 Install dump_syms on MacOS. 2024-03-25 14:14:59 +02:00
Roman Telezhynskyi a085dddd28 Fix building. 2024-03-25 14:14:40 +02:00
Roman Telezhynskyi bdb9028a00 Install dump_syms on Windows. 2024-03-25 14:14:40 +02:00
Roman Telezhynskyi 5597a497b5 Corect handling dynamic libraries on Windows with MSVC. 2024-03-25 13:59:58 +02:00
Roman Telezhynskyi 7383d78775 Refactoring. 2024-03-25 13:59:17 +02:00
Roman Telezhynskyi 035e702a04 Add missing dependency. 2024-03-25 13:58:45 +02:00
10 changed files with 105 additions and 35 deletions

View File

@ -159,7 +159,7 @@ appimage_task_template: &APPIMAGE_TASK_TEMPLATE
- qbs config defaultProfile qt5
- qbs config profiles.qt5.baseProfile ${COMPILER}
- conan install . -s os=Linux --build=missing -o with_crash_reporting=True -pr=valentina
- qbs build -f valentina.qbs -d $CIRRUS_WORKING_DIR/build --jobs $(nproc) profile:qt5 config:release modules.buildconfig.enableCcache:${ENABLE_CCACHE} qbs.installRoot:$CIRRUS_WORKING_DIR/build/AppDir modules.buildconfig.enableAppImage:true modules.buildconfig.enableRPath:false project.conanWithCrashReporting:true project.enableConan:true
- qbs build -f valentina.qbs -d $CIRRUS_WORKING_DIR/build --jobs $(nproc) profile:qt5 config:release modules.buildconfig.enableCcache:${ENABLE_CCACHE} qbs.installRoot:$CIRRUS_WORKING_DIR/build/AppDir modules.buildconfig.enableAppImage:true modules.buildconfig.enableRPath:false project.conanWithCrashReporting:true project.enableConan:true project.conanProfiles:valentina
- qbs -p autotest-runner -d build profile:qt5 config:release
- export CRASH_QT_VERSION=$(/opt/qt515/bin/qmake -query QT_VERSION | awk -F. '{print $1 "_" $2}')
- export CRASH_SHORT_SHA=$(git log --pretty=format:%h -n 1)
@ -355,17 +355,18 @@ macos_task_template: &MACOS_TASK_TEMPLATE
# This won't display anything secret.
- security find-identity -v -p codesigning
- brew update > /dev/null
- brew install qt6 coreutils ccache qbs cmake ninja git openssl@1.1 pkg-config poppler xerces-c
- brew install qt6 coreutils ccache qbs cmake ninja git openssl@1.1 pkg-config poppler xerces-c pipx
- brew outdated
- brew upgrade qt6
- brew upgrade qt6
- pipx ensurepath
- echo $PATH
- export PATH="${HOME}/.local/bin:`python3 -m site --user-base`/bin:$PATH"
- echo $PATH
- python3 --version
- pip3 install --user --upgrade pip dropbox py7zr 'urllib3<2.0' conan==1.63.0 requests
- pipx install pip dropbox py7zr 'urllib3<2.0' conan==1.63.0 requests
- ccache --set-config sloppiness=pch_defines,time_macros max_size="$CCACHE_SIZE"
- qmake6 --version
- which qmake6
- qmake --version
- which qmake
- qbs --version
build_script:
- echo $PATH
@ -390,13 +391,14 @@ macos_task_template: &MACOS_TASK_TEMPLATE
- conan profile update settings.compiler.version=14 valentina
- qbs setup-toolchains --detect
- qbs config --list profiles
- qbs setup-qt /opt/homebrew/opt/qt6/bin/qmake6 qt6
- qbs setup-qt /opt/homebrew/opt/qt6/bin/qmake qt6
- qbs config defaultProfile qt6
- qbs config profiles.qt6.baseProfile clang
- conan install . -s os=Macos --build=missing -o with_crash_reporting=True -pr=valentina
- qbs build -f valentina.qbs -d $CIRRUS_WORKING_DIR/build --jobs $(nproc) config:release modules.buildconfig.enableUnitTests:false modules.buildconfig.enableMultiBundle:${MULTI_BUNDLE} qbs.installRoot:$CIRRUS_WORKING_DIR/build/install-root profile:qt6 project.minimumMacosVersion:${MACOS_DEPLOYMENT_TARGET} modules.buildconfig.enableCcache:${ENABLE_CCACHE} moduleProviders.qbspkgconfig.extraPaths:$(brew --prefix xerces-c)/lib/pkgconfig,$(brew --prefix qt6)/lib/pkgconfig,$(brew --prefix openssl@1.1)/lib/pkgconfig "modules.buildconfig.signingIdentity:$MACOS_CERTIFICATE_NAME" modules.macdeployqt.libpath:$(brew --prefix qt6)/lib,$(brew --prefix poppler)/lib modules.macdeployqt.macdeployqtProgramBinPath:${HOME}/macdeployqt-install-dir
- export CRASH_QT_VERSION=$(/opt/homebrew/opt/qt6/bin/qmake6 -query QT_VERSION | awk -F. '{print $1 "_" $2}')
- export CRASH_QT_VERSION=$(/opt/homebrew/opt/qt6/bin/qmake -query QT_VERSION | awk -F. '{print $1 "_" $2}')
- export CRASH_SHORT_SHA=$(git log --pretty=format:%h -n 1)
- curl --proto '=https' --tlsv1.2 -LsSf https://github.com/mozilla/dump_syms/releases/download/v2.3.1/dump_syms-installer.sh | sh
- python3 scripts/symupload.py $CIRRUS_WORKING_DIR/build/install-root $VALENTINA_VERSION $CRASH_SHORT_SHA $CRASH_QT_VERSION --clean
- qbs build -f valentina.qbs -d $CIRRUS_WORKING_DIR/build -p 'Valentina DMG' --force-probe-execution --jobs $(nproc) config:release modules.buildconfig.enableUnitTests:false modules.buildconfig.enableMultiBundle:${MULTI_BUNDLE} qbs.installRoot:$CIRRUS_WORKING_DIR/build/install-root profile:qt6 project.minimumMacosVersion:${MACOS_DEPLOYMENT_TARGET} modules.buildconfig.enableCcache:${ENABLE_CCACHE} moduleProviders.qbspkgconfig.extraPaths:$(brew --prefix xerces-c)/lib/pkgconfig,$(brew --prefix qt6)/lib/pkgconfig,$(brew --prefix openssl@1.1)/lib/pkgconfig "modules.buildconfig.signingIdentity:$MACOS_CERTIFICATE_NAME" modules.macdeployqt.libpath:$(brew --prefix qt6)/lib,$(brew --prefix poppler)/lib modules.macdeployqt.macdeployqtProgramBinPath:${HOME}/macdeployqt-install-dir
# Store the notarization credentials so that we can prevent a UI password dialog

View File

@ -420,6 +420,7 @@ for:
$env:CRASH_SHORT_SHA = git log --pretty=format:%h -n 1
}
- ps: scripts/install_dump_sysms.ps1
- if "%WITH_CRASH_REPORTING%" == "True" (python3 scripts/symupload.py %APPVEYOR_BUILD_FOLDER%\build\install-root\valentina $VALENTINA_VERSION $CRASH_SHORT_SHA $CRASH_QT_VERSION --clean)
- if "%DEPLOY%" == "true" (qbs build -f valentina.qbs -d %APPVEYOR_BUILD_FOLDER%\build -p ValentinaSetup --jobs %NUMBER_OF_PROCESSORS% config:release qbs.installRoot:%APPVEYOR_BUILD_FOLDER%\build\install-root\valentina profile:qt6 project.enableConan:true project.conanWithCrashReporting:true project.conanWithXerces:true modules.buildconfig.enableCcache:false project.conanProfiles:valentina modules.buildconfig.enablePCH:%ENABLE_PCH% modules.windeployqt.windeployqtProgramBinPath:%WINDEPLOYQT_BIN_PATH% modules.windeployqt.compilerRuntime:%WINDEPLOYQT_COMPILER_RUNTIME% modules.windeployqt.noCompilerRuntime:%WINDEPLOYQT_NO_COMPILER_RUNTIME%)
- ps: scripts/appveyor-deploy.ps1
@ -699,6 +700,7 @@ for:
- qbs build -f valentina.qbs -d ${APPVEYOR_BUILD_FOLDER}/build --jobs $(nproc) config:release modules.buildconfig.enableUnitTests:false modules.buildconfig.enableMultiBundle:${MULTI_BUNDLE} qbs.installRoot:${APPVEYOR_BUILD_FOLDER}/build/install-root profile:qt6 project.minimumMacosVersion:${MACOS_DEPLOYMENT_TARGET} modules.buildconfig.enableCcache:true moduleProviders.qbspkgconfig.extraPaths:$(brew --prefix xerces-c)/lib/pkgconfig,$(brew --prefix qt6)/lib/pkgconfig,$(brew --prefix openssl@1.1)/lib/pkgconfig "modules.buildconfig.signingIdentity:$MACOS_CERTIFICATE_NAME" modules.macdeployqt.libpath:$(brew --prefix qt6)/lib,$(brew --prefix poppler)/lib modules.macdeployqt.macdeployqtProgramBinPath:${HOME}/macdeployqt-install-dir project.enableConan:true project.conanWithCrashReporting:true
- export CRASH_QT_VERSION=$($QTDIR/bin/qmake -query QT_VERSION | awk -F. '{print $1 "_" $2}')
- export CRASH_SHORT_SHA=$(git log --pretty=format:%h -n 1)
- curl --proto '=https' --tlsv1.2 -LsSf https://github.com/mozilla/dump_syms/releases/download/v2.3.1/dump_syms-installer.sh | sh
- python3 scripts/symupload.py ${APPVEYOR_BUILD_FOLDER}/build/install-root $VALENTINA_VERSION $CRASH_SHORT_SHA $CRASH_QT_VERSION --clean
- qbs build -f valentina.qbs -d ${APPVEYOR_BUILD_FOLDER}/build -p 'Valentina DMG' --force-probe-execution --jobs $(nproc) config:release modules.buildconfig.enableUnitTests:false modules.buildconfig.enableMultiBundle:${MULTI_BUNDLE} qbs.installRoot:${APPVEYOR_BUILD_FOLDER}/build/install-root profile:qt6 project.minimumMacosVersion:${MACOS_DEPLOYMENT_TARGET} modules.buildconfig.enableCcache:true moduleProviders.qbspkgconfig.extraPaths:$(brew --prefix xerces-c)/lib/pkgconfig,$(brew --prefix qt6)/lib/pkgconfig,$(brew --prefix openssl@1.1)/lib/pkgconfig "modules.buildconfig.signingIdentity:$MACOS_CERTIFICATE_NAME" modules.macdeployqt.libpath:$(brew --prefix qt6)/lib,$(brew --prefix poppler)/lib modules.macdeployqt.macdeployqtProgramBinPath:${HOME}/macdeployqt-install-dir project.enableConan:true project.conanWithCrashReporting:true
# Store the notarization credentials so that we can prevent a UI password dialog
@ -897,6 +899,7 @@ for:
- qbs build -f valentina.qbs -d ${APPVEYOR_BUILD_FOLDER}/build --jobs $(nproc) config:release modules.buildconfig.enableUnitTests:false modules.buildconfig.enableMultiBundle:${MULTI_BUNDLE} qbs.installRoot:${APPVEYOR_BUILD_FOLDER}/build/install-root profile:qt5 project.minimumMacosVersion:${MACOS_DEPLOYMENT_TARGET} modules.buildconfig.enableCcache:true "modules.buildconfig.signingIdentity:$MACOS_CERTIFICATE_NAME" modules.macdeployqt.libpath:${QTDIR}/lib modules.macdeployqt.pluginspath:${QTDIR}/plugins modules.macdeployqt.macdeployqtProgramBinPath:${HOME}/macdeployqt-install-dir project.enableConan:true project.conanWithCrashReporting:true
- export CRASH_QT_VERSION=$($QTDIR/bin/qmake -query QT_VERSION | awk -F. '{print $1 "_" $2}')
- export CRASH_SHORT_SHA=$(git log --pretty=format:%h -n 1)
- curl --proto '=https' --tlsv1.2 -LsSf https://github.com/mozilla/dump_syms/releases/download/v2.3.1/dump_syms-installer.sh | sh
- python3 scripts/symupload.py ${APPVEYOR_BUILD_FOLDER}/build/install-root $VALENTINA_VERSION $CRASH_SHORT_SHA $CRASH_QT_VERSION --clean
- qbs build -f valentina.qbs -d ${APPVEYOR_BUILD_FOLDER}/build -p 'Valentina DMG' --force-probe-execution --jobs $(nproc) config:release modules.buildconfig.enableUnitTests:false modules.buildconfig.enableMultiBundle:${MULTI_BUNDLE} qbs.installRoot:${APPVEYOR_BUILD_FOLDER}/build/install-root profile:qt5 project.minimumMacosVersion:${MACOS_DEPLOYMENT_TARGET} modules.buildconfig.enableCcache:true "modules.buildconfig.signingIdentity:$MACOS_CERTIFICATE_NAME" modules.macdeployqt.libpath:${QTDIR}/lib modules.macdeployqt.pluginspath:${QTDIR}/plugins modules.macdeployqt.macdeployqtProgramBinPath:${HOME}/macdeployqt-install-dir project.enableConan:true project.conanWithCrashReporting:true
# Store the notarization credentials so that we can prevent a UI password dialog

View File

@ -27,6 +27,7 @@ ModuleProvider {
file.close();
var settings = fileContent.settings;
var deps = fileContent.dependencies;
for(i in deps){
@ -69,8 +70,32 @@ ModuleProvider {
}
var cppLibraries = shared ? "\tcpp.dynamicLibraries: " : "\tcpp.staticLibraries: ";
var cppLibrariesTag = shared ? "dynamiclibrary" : "staticlibrary";
var cppLibrarySuffix = shared ? "cpp.dynamicLibrarySuffix" : "cpp.staticLibrarySuffix";
var cppLibrariesTag = "staticlibrary";
if (shared)
{
if (settings["os"] == "Linux" || settings["os"] == "Macos")
{
cppLibrariesTag = "dynamiclibrary";
}
else
{
cppLibrariesTag = "dynamiclibrary_import";
}
}
var cppLibrarySuffix = "cpp.staticLibrarySuffix";
if (shared)
{
if (settings["os"] == "Linux" || settings["os"] == "Macos")
{
cppLibrarySuffix = "cpp.dynamicLibrarySuffix";
}
else
{
cppLibrarySuffix = "cpp.staticLibrarySuffix";
}
}
moduleFile.write("import qbs\n" +
"Module {\n" +

View File

@ -0,0 +1,25 @@
# Check if WITH_CRASH_REPORTING environment variable is set to True
if ($env:WITH_CRASH_REPORTING -eq "True") {
# Define URLs and file paths
$archiveUrl = "https://github.com/mozilla/dump_syms/releases/download/v2.3.1/dump_syms-x86_64-pc-windows-msvc.zip"
$downloadPath = "$env:TEMP\dump_syms.zip"
$extractPath = "$env:TEMP\dump_syms"
# Download the archive
Invoke-WebRequest -Uri $archiveUrl -OutFile $downloadPath
# Extract the archive
Expand-Archive -Path $downloadPath -DestinationPath $extractPath -Force
# Add the directory containing dump_syms to the PATH environment variable
$env:Path += ";$extractPath"
# Check if dump_syms is callable
if (Test-Path (Join-Path $extractedFolderPath "dump_syms.exe")) {
Write-Host "dump_syms utility installed successfully and added to PATH."
} else {
Write-Host "Failed to install dump_syms utility."
}
} else {
Write-Host "Skipping dump_syms installation."
}

View File

@ -43,6 +43,9 @@
#define MIN(x, y) (((x) < (y)) ? (x) : (y)) // NOLINT
#endif
#include <string>
#include <vector>
#include <client/crash_report_database.h>
#include <client/crashpad_client.h>
#include <client/settings.h>
@ -58,7 +61,6 @@
#include <vcsRepoState.h>
using namespace base;
using namespace crashpad;
namespace
@ -168,7 +170,7 @@ auto InitializeCrashpad(const QString &appName) -> bool
#endif
// Helper class for cross-platform file systems
VCrashPaths crashpadPaths(exeDir);
VCrashPaths const crashpadPaths(exeDir);
auto MakeDir = [](const QString &path)
{
@ -182,7 +184,7 @@ auto InitializeCrashpad(const QString &appName) -> bool
// Directory where reports will be saved. Important! Must be writable or crashpad_handler will crash.
QString const reportsPath = VCrashPaths::GetReportsPath();
MakeDir(reportsPath);
FilePath const reportsDir(VCrashPaths::GetPlatformString(reportsPath));
base::FilePath const reportsDir(VCrashPaths::GetPlatformString(reportsPath));
// Initialize crashpad database
std::unique_ptr<CrashReportDatabase> database = CrashReportDatabase::Initialize(reportsDir);
@ -200,20 +202,20 @@ auto InitializeCrashpad(const QString &appName) -> bool
settings->SetUploadsEnabled(true);
// Attachments to be uploaded alongside the crash - default bundle size limit is 20MB
std::vector<FilePath> attachments;
FilePath const attachment(VCrashPaths::GetPlatformString(VCrashPaths::GetAttachmentPath(appName)));
std::vector<base::FilePath> attachments;
base::FilePath const attachment(VCrashPaths::GetPlatformString(VCrashPaths::GetAttachmentPath(appName)));
#if defined(Q_OS_WINDOWS) || defined(Q_OS_LINUX)
// Crashpad hasn't implemented attachments on OS X yet
attachments.push_back(attachment);
#endif
// Ensure that crashpad_handler is shipped with your application
FilePath const handler(VCrashPaths::GetPlatformString(crashpadPaths.GetHandlerPath()));
base::FilePath const handler(VCrashPaths::GetPlatformString(crashpadPaths.GetHandlerPath()));
// Directory where metrics will be saved. Important! Must be writable or crashpad_handler will crash.
QString const metricsPath = VCrashPaths::GetMetricsPath();
MakeDir(metricsPath);
FilePath const metricsDir(VCrashPaths::GetPlatformString(metricsPath));
base::FilePath const metricsDir(VCrashPaths::GetPlatformString(metricsPath));
QString const dbName = QStringLiteral("valentina");
// Configure url with your BugSplat database
@ -221,7 +223,7 @@ auto InitializeCrashpad(const QString &appName) -> bool
// Metadata that will be posted to BugSplat
QMap<std::string, std::string> annotations;
annotations["format"] = "minidump"; // Required: Crashpad setting to save crash as a minidump
annotations["format"] = "minidump"; // Required: Crashpad setting to save crash as a
annotations["database"] = dbName.toStdString(); // Required: BugSplat database
annotations["product"] = appName.toStdString(); // Required: BugSplat appName
annotations["version"] = AppCrashVersion().toStdString(); // Required: BugSplat appVersion
@ -245,7 +247,7 @@ auto InitializeCrashpad(const QString &appName) -> bool
arguments.emplace_back("--no-rate-limit");
// Start crash handler
auto *client = new CrashpadClient();
return client->StartHandler(handler, reportsDir, metricsDir, url.toStdString(), "", annotations.toStdMap(),
arguments, true, true, attachments);
CrashpadClient client;
return client.StartHandler(handler, reportsDir, metricsDir, url.toStdString(), "", annotations.toStdMap(),
arguments, true, true, attachments);
}

View File

@ -49,7 +49,7 @@ auto VCrashPaths::GetAttachmentPath(const QString &appName) -> QString
}
//---------------------------------------------------------------------------------------------------------------------
auto VCrashPaths::GetHandlerPath() -> QString
auto VCrashPaths::GetHandlerPath() const -> QString
{
#if defined(Q_OS_WINDOWS)
const QString handler = QStringLiteral("crashpad_handler.exe");
@ -76,16 +76,14 @@ auto VCrashPaths::GetMetricsPath() -> QString
}
//---------------------------------------------------------------------------------------------------------------------
auto VCrashPaths::GetPlatformString(const QString &string) -> base::FilePath::StringType
{
#if defined(Q_OS_UNIX)
auto VCrashPaths::GetPlatformString(const QString &string) -> std::string
{
return string.toStdString();
}
#elif defined(Q_OS_WINDOWS)
auto VCrashPaths::GetPlatformString(const QString &string) -> std::wstring
{
return string.toStdWString();
}
#else
return string.toStdWString();
#error GetPlatformString not implemented on this platform
#endif
}

View File

@ -30,22 +30,22 @@
#include <QString>
#include <base/files/file_path.h>
class VCrashPaths
{
public:
explicit VCrashPaths(QString exeDir);
auto GetHandlerPath() -> QString;
auto GetHandlerPath() const -> QString;
static auto GetAttachmentPath(const QString &appName) -> QString;
static auto GetReportsPath() -> QString;
static auto GetMetricsPath() -> QString;
#if defined(Q_OS_UNIX)
static auto GetPlatformString(const QString &string) -> std::string;
#elif defined(Q_OS_WINDOWS)
static auto GetPlatformString(const QString &string) -> std::wstring;
#else
#if defined(Q_OS_UNIX) || defined(Q_OS_WINDOWS)
static auto GetPlatformString(const QString &string) -> base::FilePath::StringType;
#elif
#error GetPlatformString not implemented on this platform
#endif

View File

@ -9,6 +9,11 @@ VLib {
condition: buildconfig.useConanPackages && buildconfig.conanCrashReportingEnabled
}
Properties {
condition: buildconfig.useConanPackages && buildconfig.conanCrashReportingEnabled && qbs.targetOS.contains("windows") && qbs.toolchain.contains("msvc")
cpp.dynamicLibraries: ["Advapi32"]
}
name: "VMiscLib"
files: {
var files = [

View File

@ -25,6 +25,11 @@ VTestApp {
condition: buildconfig.useConanPackages && buildconfig.conanCrashReportingEnabled
}
Properties {
condition: buildconfig.useConanPackages && buildconfig.conanCrashReportingEnabled && qbs.targetOS.contains("windows") && qbs.toolchain.contains("msvc")
cpp.dynamicLibraries: ["Advapi32"]
}
name: "CollectionTest"
buildconfig.appTarget: qbs.targetOS.contains("macos") ? "CollectionTest" : "collectionTest"
targetName: buildconfig.appTarget

View File

@ -24,6 +24,11 @@ VTestApp {
condition: buildconfig.useConanPackages && buildconfig.conanCrashReportingEnabled
}
Properties {
condition: buildconfig.useConanPackages && buildconfig.conanCrashReportingEnabled && qbs.targetOS.contains("windows") && qbs.toolchain.contains("msvc")
cpp.dynamicLibraries: ["Advapi32"]
}
name: "TranslationsTest"
buildconfig.appTarget: qbs.targetOS.contains("macos") ? "TranslationsTest" : "translationsTest"
targetName: buildconfig.appTarget