From 73fc87b7b8948b8bef7cfd939e9068a8e7a3ed89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sikora?= Date: Fri, 23 Jan 2026 16:08:15 +0100 Subject: [PATCH] Use per-project Sentry configuration (#4818) (cherry picked from commit 2a7da69e2579e01e9295b7c88808fb58d271d3b4) --- .configure | 7 +------ .configure-files/secret.properties.enc | Bin 1184 -> 1168 bytes app/build.gradle.kts | 8 ++++++-- automotive/build.gradle.kts | 8 ++++++++ build.gradle.kts | 8 +++++--- dependencies.gradle.kts | 5 +++++ wear/build.gradle.kts | 8 ++++++-- 7 files changed, 31 insertions(+), 13 deletions(-) diff --git a/.configure b/.configure index d3410975465..e01987012d3 100644 --- a/.configure +++ b/.configure @@ -1,18 +1,13 @@ { "project_name": "pocketcasts-android", "branch": "trunk", - "pinned_hash": "29f04c18842c391363c5129b59b8a32973319611", + "pinned_hash": "f8db88d1a1d1149ce3a144b7c629e36717c885ea", "files_to_copy": [ { "file": "android/pocket-casts/secret.properties", "destination": "secret.properties", "encrypt": true }, - { - "file": "android/pocket-casts/sentry.properties", - "destination": "sentry.properties", - "encrypt": true - }, { "file": "android/pocket-casts/google-services.json", "destination": "app/google-services.json", diff --git a/.configure-files/secret.properties.enc b/.configure-files/secret.properties.enc index b8c749778d334830849d0f759eed0ce44471ac60..f1fcb4515361ab0f5702001a7ea5be13c4fcf453 100644 GIT binary patch delta 249 zcmVK=l5fk15i`d_72e= zrY)cHftAs~Xbz6WmnWmXQ7k)ynUC^h82j!Rx*^_9wJk>`lwEOK?;2`c#mw2`WAz14 zj*%XGGWz1b76ejT=$-u}u3k5PM7+Tgi7#w%PesPBc;*0>D;Qw`QbtZLPIYMj@uf~4 zj(57zE3I-0_DrFHSjub0nb|knjTYozD{y)3gW0|4!wX5Z_UEi&A4z##NyD`r1DATo delta 266 zcmV+l0rmcn37`qEpaXvxU|>l5#%$QY0Pe^BVBIwW4T_7VNODMT2qpHRn7avsH)~5q zkA8V5c$+iU(f)aCRT=YDF?$`Vp7Os12T4WG8tz6-%XgHy;oXfsNeK|8_}84RmK;_m zPr3JC+A@pv>R>f#;6A)TxWm5D)T6C^8>!6e^!*_HRx7{K-nf6LwR9ZGy&e9AHCtU~ zLe=#uA=}_k#Gu~iw;NB4xmU|J7GTj0!FGu=UnV#yE9j{2AGe$~rF5)zWk!gEq2I`N zfhPf3Z%Ndw?A#faB;G2J(jk6A2uDi3%5ttqD*>Iq`XO;dVoT$X%O!rc-IaEBzl>PL QqSel%$H{IWPvioAA#3)Aod5s; diff --git a/app/build.gradle.kts b/app/build.gradle.kts index ceb0f2ab68c..4ec5066ae4c 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -9,6 +9,10 @@ plugins { alias(libs.plugins.compose.compiler) } +sentry { + projectName = project.findProperty("sentryAndroidProject")?.toString() +} + android { namespace = "au.com.shiftyjelly.pocketcasts" @@ -46,8 +50,8 @@ android { named("release") { manifestPlaceholders["appIcon"] = "@mipmap/ic_launcher" - if (!file("${project.rootDir}/sentry.properties").exists()) { - println("WARNING: Sentry configuration file 'sentry.properties' not found. The ProGuard mapping files won't be uploaded.") + if (project.findProperty("sentryAndroidProject")?.toString().isNullOrBlank()) { + println("WARNING: Sentry configuration not found. The ProGuard mapping files won't be uploaded.") } } } diff --git a/automotive/build.gradle.kts b/automotive/build.gradle.kts index 997173b39df..049173123ac 100644 --- a/automotive/build.gradle.kts +++ b/automotive/build.gradle.kts @@ -9,6 +9,10 @@ plugins { alias(libs.plugins.compose.compiler) } +sentry { + projectName = project.findProperty("sentryAutomotiveProject")?.toString() +} + android { namespace = "au.com.shiftyjelly.pocketcasts" @@ -35,6 +39,10 @@ android { named("release") { manifestPlaceholders["appIcon"] = "@mipmap/ic_launcher" + + if (project.findProperty("sentryAutomotiveProject")?.toString().isNullOrBlank()) { + println("WARNING: Sentry configuration not found. The ProGuard mapping files won't be uploaded.") + } } } diff --git a/build.gradle.kts b/build.gradle.kts index 29c811a357d..e3ec19d2dec 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,7 +14,6 @@ import com.google.devtools.ksp.gradle.KspGradleSubplugin import io.sentry.android.gradle.extensions.InstrumentationFeature import io.sentry.android.gradle.extensions.SentryPluginExtension import java.util.EnumSet -import kotlin.collections.addAll import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompilerOptions import org.jetbrains.kotlin.gradle.plugin.KotlinBasePlugin @@ -174,7 +173,7 @@ subprojects { } plugins.withId(rootProject.libs.plugins.sentry.get().pluginId) { - configureSentry() + applyCommonSentryConfiguration() } configurations.configureEach { @@ -419,8 +418,11 @@ subprojects { } } -fun Project.configureSentry() { +fun Project.applyCommonSentryConfiguration() { extensions.getByType(SentryPluginExtension::class.java).apply { + authToken = project.findProperty("sentryAuthToken")?.toString() + org = project.findProperty("sentryOrg")?.toString() + val shouldUploadDebugFiles = System.getenv()["CI"].toBoolean() && !project.properties["skipSentryProguardMappingUpload"]?.toString().toBoolean() includeProguardMapping = shouldUploadDebugFiles diff --git a/dependencies.gradle.kts b/dependencies.gradle.kts index 2ac22c87ce8..995fb9a1d5c 100644 --- a/dependencies.gradle.kts +++ b/dependencies.gradle.kts @@ -106,5 +106,10 @@ project.apply { set("encryptionKey", secretProperties.getProperty("encryption_key", "")) set("appSecret", secretProperties.getProperty("app_secret", "")) set("metaAppId", secretProperties.getProperty("metaAppId", "")) + set("sentryAuthToken", secretProperties.getProperty("sentryAuthToken", "")) + set("sentryOrg", secretProperties.getProperty("sentryOrg", "")) + set("sentryAndroidProject", secretProperties.getProperty("sentryAndroidProject", "")) + set("sentryAutomotiveProject", secretProperties.getProperty("sentryAutomotiveProject", "")) + set("sentryWearProject", secretProperties.getProperty("sentryWearProject", "")) } } diff --git a/wear/build.gradle.kts b/wear/build.gradle.kts index fd358ce60c6..28d5fc4c921 100644 --- a/wear/build.gradle.kts +++ b/wear/build.gradle.kts @@ -11,6 +11,10 @@ plugins { alias(libs.plugins.compose.compiler) } +sentry { + projectName = project.findProperty("sentryWearProject")?.toString() +} + android { namespace = "au.com.shiftyjelly.pocketcasts" @@ -32,8 +36,8 @@ android { named("release") { manifestPlaceholders["appIcon"] = "@mipmap/ic_launcher" - if (!file("${project.rootDir}/sentry.properties").exists()) { - println("WARNING: Sentry configuration file 'sentry.properties' not found. The ProGuard mapping files won't be uploaded.") + if (project.findProperty("sentryWearProject")?.toString().isNullOrBlank()) { + println("WARNING: Sentry configuration not found. The ProGuard mapping files won't be uploaded.") } } }