[CrashReporting] Send PROJECT_VERSION as the Sentry release

main() reported VERSION_STRING (PROJECT_VERSION_FRIENDLY) as the Sentry
release — that carries a build date, so every build of the same version
landed in its own release, and it never matched the installer, which
reports CPACK/PROJECT_VERSION. Bake COCKATRICE_SENTRY_RELEASE=
PROJECT_VERSION instead: date-free, identical between client and
installer, and derived from the git tag on tag builds, so events,
symbol uploads and the installer log all group under one release.
This commit is contained in:
Lukas Brübach 2026-10-17 15:16:17 +02:00 • committed by GitHub
parent 2a21c87e7c
commit 8ddb9b9570
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 1 deletions

View file

@ -32,6 +32,12 @@ function(cockatrice_target_enable_crash_reporting _target)
endif() endif()
# Always baked in (possibly empty): main() prefers the COCKATRICE_SENTRY_DSN env var at runtime. # Always baked in (possibly empty): main() prefers the COCKATRICE_SENTRY_DSN env var at runtime.
target_compile_definitions(${_target} PRIVATE "COCKATRICE_SENTRY_DSN=\"${COCKATRICE_SENTRY_DSN}\"") target_compile_definitions(${_target} PRIVATE "COCKATRICE_SENTRY_DSN=\"${COCKATRICE_SENTRY_DSN}\"")
# Sentry release for events from this target: PROJECT_VERSION (getversion.cmake ran before this
# file was included). Deliberately not PROJECT_VERSION_FRIENDLY / VERSION_STRING — that carries
# a build date, so every build of the same version would land in a different Sentry release.
# PROJECT_VERSION matches what the installer reports in its own log and what CPack derives the
# package version from, so client and installer events group under one release.
target_compile_definitions(${_target} PRIVATE "COCKATRICE_SENTRY_RELEASE=\"${PROJECT_VERSION}\"")
endfunction() endfunction()
if(WITH_CRASH_REPORTING AND WITH_CLIENT) if(WITH_CRASH_REPORTING AND WITH_CLIENT)

View file

@ -20,6 +20,10 @@
#define COCKATRICE_SENTRY_DSN "" #define COCKATRICE_SENTRY_DSN ""
#endif #endif
#ifndef COCKATRICE_SENTRY_RELEASE
#define COCKATRICE_SENTRY_RELEASE ""
#endif
Q_DECLARE_LOGGING_CATEGORY(CrashReportLog); Q_DECLARE_LOGGING_CATEGORY(CrashReportLog);
/** /**

View file

@ -301,7 +301,7 @@ int main(int argc, char *argv[])
crashLogAttachedEnvelopes = CrashReporter::attachToPendingCrashEnvelopes( crashLogAttachedEnvelopes = CrashReporter::attachToPendingCrashEnvelopes(
crashDatabasePath, DlgCrashReport::buildRedactedPreview(), QString()); crashDatabasePath, DlgCrashReport::buildRedactedPreview(), QString());
} }
crashReporter.init(crashDsn, QString::fromUtf8(VERSION_STRING), crashDatabasePath, crashMode); crashReporter.init(crashDsn, QString::fromUtf8(COCKATRICE_SENTRY_RELEASE), crashDatabasePath, crashMode);
if (crashReporter.isReady() && crashMode == PersonalSettings::CrashReportingMode::AlwaysSend) { if (crashReporter.isReady() && crashMode == PersonalSettings::CrashReportingMode::AlwaysSend) {
// Silent opt-in: cached native crash envelopes flush automatically once consent is given. // Silent opt-in: cached native crash envelopes flush automatically once consent is given.
crashReporter.giveConsent(); crashReporter.giveConsent();