Skip to content

Commit

Permalink
Merge pull request #1168 from alvr/feature/remove_sentry
Browse files Browse the repository at this point in the history
feat: remove sentry
  • Loading branch information
alvr authored Jan 26, 2025
2 parents c1237c9 + d7d5a8e commit 495d4e1
Show file tree
Hide file tree
Showing 19 changed files with 18 additions and 177 deletions.
7 changes: 0 additions & 7 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@
"io.kotest.extensions",
],
},
{
"groupName": "Sentry",
"groupSlug": "sentry",
"matchPackagePrefixes": [
"io.sentry",
],
},
{
"groupName": "Apollo",
"groupSlug": "apollo",
Expand Down
21 changes: 0 additions & 21 deletions app/proguard-rules.pro

This file was deleted.

4 changes: 0 additions & 4 deletions app/src/androidMain/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,5 @@
android:scheme="katana" />
</intent-filter>
</activity>

<meta-data
android:name="io.sentry.auto-init"
android:value="false" />
</application>
</manifest>
6 changes: 6 additions & 0 deletions app/src/androidMain/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Logger
-assumenosideeffects class co.touchlab.kermit.Logger {
public void v(...);
public void d(...);
public void i(...);
}
3 changes: 1 addition & 2 deletions build-logic/katana-convention/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ group = "dev.alvr.katana.buildlogic"
version = extra["katana.plugins.version"].toString()

dependencies {
implementation(libs.bundles.build.config)
implementation(libs.bundles.gradle)
implementation(libs.kotlinpoet)
implementation(libs.kaml)
}

gradlePlugin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import com.android.build.gradle.internal.dsl.BaseAppModuleExtension
import dev.alvr.katana.buildlogic.KatanaConfiguration
import dev.alvr.katana.buildlogic.catalogBundle
import dev.alvr.katana.buildlogic.configureAndroid
import io.sentry.android.gradle.extensions.SentryPluginExtension
import java.io.FileInputStream
import java.time.Year
import java.util.Properties
Expand All @@ -32,7 +31,6 @@ internal class KatanaAppPlugin : Plugin<Project> {
apply(plugin = "com.android.application")
commonConfiguration()
apply(plugin = "katana.multiplatform.compose")
apply(plugin = "io.sentry.android.gradle")

with(extensions) {
configure<ComposeExtension> {
Expand All @@ -41,7 +39,6 @@ internal class KatanaAppPlugin : Plugin<Project> {
.configureDesktop(project)
}
configure<KotlinMultiplatformExtension> { configureMultiplatform() }
configure<SentryPluginExtension> { configureSentry() }

configure<BaseAppModuleExtension> { configureAndroid(project) }
}
Expand Down Expand Up @@ -176,18 +173,6 @@ internal class KatanaAppPlugin : Plugin<Project> {
sourceSets["main"].res.srcDirs("$AndroidDir/res")
}

private fun SentryPluginExtension.configureSentry() {
includeProguardMapping = true
autoUploadProguardMapping = System.getenv("CI").toBoolean()
dexguardEnabled = false
uploadNativeSymbols = false
includeNativeSources = false
tracingInstrumentation.enabled = false
autoInstallation.enabled = false
ignoredBuildTypes = setOf("debug")
telemetry = false
}

private fun ApplicationBuildType.configure(isDebug: Boolean) {
isDebuggable = isDebug
isDefault = isDebug
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ import dev.alvr.katana.buildlogic.catalogBundle
import dev.alvr.katana.buildlogic.commonExtensions
import dev.alvr.katana.buildlogic.commonTasks
import dev.alvr.katana.buildlogic.kspDependencies
import io.sentry.kotlin.multiplatform.gradle.SentryExtension
import org.gradle.api.Project
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.assign
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.invoke
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
Expand All @@ -20,12 +18,10 @@ internal fun Project.commonConfiguration() {
apply(plugin = "io.kotest.multiplatform")
apply(plugin = "org.jetbrains.kotlinx.kover")
apply(plugin = "dev.mokkery")
apply(plugin = "io.sentry.kotlin.multiplatform.gradle")

with(extensions) {
commonExtensions()
configure<KotlinMultiplatformExtension> { configureMultiplatform(project) }
configure<SentryExtension> { configureSentryMultiplatform() }
}

tasks.commonTasks()
Expand Down Expand Up @@ -73,9 +69,3 @@ private fun KotlinMultiplatformExtension.configureSourceSets() {
}
}
}

private fun SentryExtension.configureSentryMultiplatform() {
autoInstall.enabled = false
autoInstall.commonMain.enabled = false
autoInstall.cocoapods.enabled = false
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ internal class KatanaMultiplatformDataRemotePlugin : Plugin<Project> {
}
}

@OptIn(ApolloExperimental::class)
private fun ApolloExtension.configureApollo(project: Project) {
service("anilist") {
decapitalizeFields = true
Expand Down
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ plugins {
alias(libs.plugins.kover) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.mokkery) apply false
alias(libs.plugins.sentry) apply false
alias(libs.plugins.serialization) apply false
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ internal class SessionDataStoreTest : FreeSpec(), KoinTest {
private val corruptedDataStore by inject<DataStore<Session>>(corruptedDataStoreNamed)

init {
"initial session should equal to the Session class" {
"!initial session should equal to the Session class" {
dataStore.data.test {
awaitItem() shouldBeEqual Session()
ensureAllEventsConsumed()
}
}

"saving a session should return the same values" {
"!saving a session should return the same values" {
with(dataStore) {
updateData { p ->
p.copy(
Expand All @@ -46,7 +46,7 @@ internal class SessionDataStoreTest : FreeSpec(), KoinTest {
}
}

"corrupted dataStore should recreate again the file with initial values" {
"!corrupted dataStore should recreate again the file with initial values" {
corruptedDataStore.data.test {
awaitItem() shouldBeEqual Session(anilistToken = AnilistToken("recreated"))
ensureAllEventsConsumed()
Expand Down
4 changes: 0 additions & 4 deletions core/remote/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ kotlin {
implementation(projects.common.session.domain)
}

androidMain.dependencies {
implementation(libs.sentry.apollo)
}

commonTest.dependencies { implementation(projects.core.tests) }
}
}
4 changes: 0 additions & 4 deletions core/ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ kotlin {
implementation(libs.materialkolor)
}

androidMain.dependencies {
implementation(libs.sentry.compose)
}

commonTest.dependencies { implementation(projects.core.tests) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ internal class HomePreferencesDataStoreTest : FreeSpec(), KoinTest {
private val corruptedDataStore by inject<DataStore<HomePreferences>>(corruptedDataStoreNamed)

init {
"initial session should equal to the Session class" {
"!initial home preferences should equal to the HomePreferences class" {
dataStore.data.test {
awaitItem() shouldBeEqual HomePreferences()
ensureAllEventsConsumed()
}
}

"saving a session should return the same values" {
"!saving a home preferences should return the same values" {
with(dataStore) {
updateData { p ->
p.copy(
Expand All @@ -43,7 +43,7 @@ internal class HomePreferencesDataStoreTest : FreeSpec(), KoinTest {
}
}

"corrupted dataStore should recreate again the file with initial values" {
"!corrupted dataStore should recreate again the file with initial values" {
corruptedDataStore.data.test {
awaitItem() shouldBeEqual HomePreferences(welcomeCardVisible = false)
ensureAllEventsConsumed()
Expand Down
20 changes: 5 additions & 15 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ mokkery = "2.6.1"
navigation = "2.8.0-alpha12"
navigation-material = "1.7.0-beta02"
okio = "3.10.2"
sentry = "8.0.0"
sentry-multiplatform = "0.10.0"
sentry-plugin = "4.14.1"
turbine = "1.2.0"

[plugins]
Expand All @@ -52,7 +49,6 @@ kotlin = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
mokkery = { id = "dev.mokkery", version.ref = "mokkery" }
sentry = { id = "io.sentry.android.gradle", version.ref = "sentry-plugin" }
serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }

[libraries]
Expand Down Expand Up @@ -101,8 +97,6 @@ gradle-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.
gradle-kover = { module = "org.jetbrains.kotlinx:kover-gradle-plugin", version.ref = "kover" }
gradle-ksp = { module = "com.google.devtools.ksp:symbol-processing-gradle-plugin", version.ref = "ksp" }
gradle-mokkery = { module = "dev.mokkery:mokkery-gradle", version.ref = "mokkery" }
gradle-sentry = { module = "io.sentry:sentry-android-gradle-plugin", version.ref = "sentry-plugin" }
gradle-sentry-multiplatform = { module = "io.sentry.kotlin.multiplatform.gradle:io.sentry.kotlin.multiplatform.gradle.gradle.plugin", version.ref = "sentry-multiplatform" }

# Kaml
kaml = { module = "com.charleskorn.kaml:kaml", version.ref = "kaml" }
Expand Down Expand Up @@ -152,12 +146,6 @@ navigation-material = { module = "org.jetbrains.compose.material:material-naviga
okio = { module = "com.squareup.okio:okio", version.ref = "okio" }
okio-fakefilesystem = { module = "com.squareup.okio:okio-fakefilesystem", version.ref = "okio" }

# Sentry
sentry = { module = "io.sentry:sentry-android-core", version.ref = "sentry" }
sentry-apollo = { module = "io.sentry:sentry-apollo-3", version.ref = "sentry" }
sentry-compose = { module = "io.sentry:sentry-compose-android", version.ref = "sentry" }
sentry-multiplatform = { module = "io.sentry:sentry-kotlin-multiplatform", version.ref = "sentry-multiplatform" }

# Tests
## Kotest
kotest-assertions-core = { module = "io.kotest:kotest-assertions-core", version.ref = "kotest" }
Expand Down Expand Up @@ -323,11 +311,15 @@ app-android = [
"androidx-activity",
"androidx-splashscreen",
"coil",
"sentry",
]
app-ios = []
app-desktop = []

build-config = [
"kaml",
"kotlinpoet",
]

gradle = [
"gradle-android",
"gradle-apollo",
Expand All @@ -339,6 +331,4 @@ gradle = [
"gradle-kover",
"gradle-ksp",
"gradle-mokkery",
"gradle-sentry",
"gradle-sentry-multiplatform",
]
2 changes: 0 additions & 2 deletions shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ kotlin {
implementation(projects.features.lists.data)
implementation(projects.features.lists.domain)
implementation(projects.features.lists.ui)

implementation(libs.sentry.multiplatform)
}

commonTest.dependencies {
Expand Down

This file was deleted.

42 changes: 0 additions & 42 deletions shared/src/commonMain/kotlin/dev/alvr/katana/shared/KatanaApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ package dev.alvr.katana.shared

import androidx.compose.runtime.Composable
import co.touchlab.kermit.DefaultFormatter
import co.touchlab.kermit.LogWriter
import co.touchlab.kermit.Logger
import co.touchlab.kermit.Severity
import co.touchlab.kermit.platformLogWriter
import coil3.ImageLoader
import coil3.compose.setSingletonImageLoaderFactory
Expand All @@ -14,10 +12,6 @@ import dev.alvr.katana.core.common.KatanaBuildConfig
import dev.alvr.katana.core.ui.theme.KatanaTheme
import dev.alvr.katana.shared.screens.Katana
import dev.alvr.katana.shared.utils.coilDiskCache
import io.sentry.kotlin.multiplatform.PlatformOptionsConfiguration
import io.sentry.kotlin.multiplatform.Sentry
import io.sentry.kotlin.multiplatform.SentryLevel
import io.sentry.kotlin.multiplatform.protocol.Breadcrumb
import org.koin.compose.KoinContext

@Composable
Expand All @@ -34,7 +28,6 @@ fun Katana() {
@Composable
private fun InitApp() {
InitCoil()
initSentry()
initNapier()
}

Expand All @@ -56,41 +49,6 @@ private fun InitCoil() {
private fun initNapier() {
if (KatanaBuildConfig.DEBUG) {
Logger.setLogWriters(platformLogWriter(DefaultFormatter))
} else {
Logger.setLogWriters(SentryLogger(Severity.Error))
}
}

internal expect fun sentryOptionsConfiguration(): PlatformOptionsConfiguration

private fun initSentry() {
Sentry.initWithPlatformOptions(sentryOptionsConfiguration())
}

private class SentryLogger(private val minSeverity: Severity) : LogWriter() {
private val Severity.sentryLevel
get() = when (this) {
Severity.Verbose -> SentryLevel.DEBUG
Severity.Debug -> SentryLevel.DEBUG
Severity.Info -> SentryLevel.INFO
Severity.Warn -> SentryLevel.WARNING
Severity.Error -> SentryLevel.ERROR
Severity.Assert -> SentryLevel.FATAL
}

override fun isLoggable(tag: String, severity: Severity) =
!KatanaBuildConfig.DEBUG && severity >= minSeverity

override fun log(severity: Severity, message: String, tag: String, throwable: Throwable?) {
if (throwable != null && severity >= minSeverity) {
Sentry.addBreadcrumb(
Breadcrumb(
level = severity.sentryLevel,
message = "$tag: $message",
),
)
Sentry.captureException(throwable)
}
}
}

Expand Down
Loading

0 comments on commit 495d4e1

Please sign in to comment.