mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-13 18:27:00 +05:30
feat: set up Sentry
This commit is contained in:
parent
62dd421cf4
commit
905c27fe84
10 changed files with 130 additions and 2 deletions
18
.github/renovate.json5
vendored
18
.github/renovate.json5
vendored
|
@ -25,6 +25,13 @@
|
|||
],
|
||||
"groupName": "kotlin"
|
||||
},
|
||||
{
|
||||
"matchPackagePatterns": [
|
||||
"^io.sentry",
|
||||
"^sentry",
|
||||
],
|
||||
"groupName": "sentry"
|
||||
},
|
||||
{
|
||||
"managers": [
|
||||
"gradle"
|
||||
|
@ -81,6 +88,17 @@
|
|||
],
|
||||
"datasourceTemplate": "docker",
|
||||
"depNameTemplate": "jetbrains/qodana-jvm-android",
|
||||
},
|
||||
{
|
||||
"fileMatch": [
|
||||
"gradle/libs.versions.toml"
|
||||
],
|
||||
"matchStrings": [
|
||||
"sentry-sdk = \"(?<currentValue>.*)\""
|
||||
],
|
||||
"datasourceTemplate": "maven",
|
||||
"depNameTemplate": "io.sentry:sentry-android",
|
||||
"registryUrlTemplate": "https://repo1.maven.org/maven2/",
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
2
.github/workflows/baseline-profile.yml
vendored
2
.github/workflows/baseline-profile.yml
vendored
|
@ -61,6 +61,8 @@ jobs:
|
|||
# This allows us to build most of what we need without the emulator running
|
||||
# and using resources
|
||||
- name: Build app and benchmark
|
||||
env:
|
||||
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
||||
run: ./gradlew :benchmark:assembleBenchmark :android:assembleBenchmark
|
||||
|
||||
# Now use reactivecircus/android-emulator-runner to spin up an emulator. We're gonna use it again
|
||||
|
|
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -70,6 +70,8 @@ jobs:
|
|||
|
||||
- name: Build release app
|
||||
uses: gradle/gradle-build-action@6095a76664413da4c8c134ee32e8a8ae900f0f1f # v2.4.0
|
||||
env:
|
||||
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
||||
with:
|
||||
arguments: --no-configuration-cache --stacktrace collectReleaseApks
|
||||
gradle-home-cache-cleanup: true
|
||||
|
|
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
|
@ -57,8 +57,10 @@ jobs:
|
|||
|
||||
- name: Build release assets
|
||||
shell: bash
|
||||
env:
|
||||
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
||||
run: |
|
||||
./gradlew --no-configuration-cache collectReleaseApks collectReleaseBundle
|
||||
./gradlew --no-configuration-cache collectReleaseApks collectReleaseBundle -PsentryUploadMappings
|
||||
|
||||
- name: Clean secrets
|
||||
run: scripts/signing-cleanup.sh
|
||||
|
|
|
@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
* Introduce [Sentry](https://sentry.io) for error reporting and performance monitoring
|
||||
|
||||
## [1.22.0] - 2023-03-02
|
||||
|
||||
### Changed
|
||||
|
|
|
@ -11,6 +11,7 @@ plugins {
|
|||
id("dev.msfjarvis.claw.rename-artifacts")
|
||||
id("dev.msfjarvis.claw.kotlin-android")
|
||||
id("dev.msfjarvis.claw.kotlin-kapt")
|
||||
id("dev.msfjarvis.claw.sentry")
|
||||
id("dev.msfjarvis.claw.versioning-plugin")
|
||||
alias(libs.plugins.anvil)
|
||||
alias(libs.plugins.whetstone)
|
||||
|
|
20
android/src/release/AndroidManifest.xml
Normal file
20
android/src/release/AndroidManifest.xml
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<application>
|
||||
<!-- Required: set your sentry.io project identifier (DSN) -->
|
||||
<meta-data android:name="io.sentry.dsn" android:value="${sentryDsn}" />
|
||||
|
||||
<!-- enable automatic breadcrumbs for user interactions (clicks, swipes, scrolls) -->
|
||||
<meta-data android:name="io.sentry.traces.user-interaction.enable" android:value="true" />
|
||||
<meta-data android:name="io.sentry.breadcrumbs.user-interaction" android:value="true" />
|
||||
<!-- enable screenshot for crashes -->
|
||||
<meta-data android:name="io.sentry.attach-screenshot" android:value="true" />
|
||||
<!-- enable view hierarchy for crashes -->
|
||||
<meta-data android:name="io.sentry.attach-view-hierarchy" android:value="true" />
|
||||
|
||||
<!-- enable the performance API by setting a sample-rate, adjust in production env -->
|
||||
<meta-data android:name="io.sentry.traces.sample-rate" android:value="0.8" />
|
||||
<!-- enable profiling when starting transactions, adjust in production env -->
|
||||
<meta-data android:name="io.sentry.traces.profiling.sample-rate" android:value="0.8" />
|
||||
</application>
|
||||
</manifest>
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright © 2022 Harsh Shandilya.
|
||||
* Copyright © 2022-2023 Harsh Shandilya.
|
||||
* Use of this source code is governed by an MIT-style
|
||||
* license that can be found in the LICENSE file or at
|
||||
* https://opensource.org/licenses/MIT.
|
||||
|
@ -59,6 +59,10 @@ gradlePlugin {
|
|||
id = "dev.msfjarvis.claw.rename-artifacts"
|
||||
implementationClass = "dev.msfjarvis.claw.gradle.RenameArtifactsPlugin"
|
||||
}
|
||||
register("sentry") {
|
||||
id = "dev.msfjarvis.claw.sentry"
|
||||
implementationClass = "dev.msfjarvis.claw.gradle.SentryPlugin"
|
||||
}
|
||||
register("spotless") {
|
||||
id = "dev.msfjarvis.claw.spotless"
|
||||
implementationClass = "dev.msfjarvis.claw.gradle.SpotlessPlugin"
|
||||
|
@ -80,6 +84,7 @@ dependencies {
|
|||
implementation(libs.build.detekt)
|
||||
implementation(libs.build.kotlin.gradle)
|
||||
implementation(libs.build.semver)
|
||||
implementation(libs.build.sentry)
|
||||
implementation(libs.build.spotless)
|
||||
implementation(libs.build.vcu)
|
||||
implementation(libs.build.versions)
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Copyright © 2023 Harsh Shandilya.
|
||||
* Use of this source code is governed by an MIT-style
|
||||
* license that can be found in the LICENSE file or at
|
||||
* https://opensource.org/licenses/MIT.
|
||||
*/
|
||||
package dev.msfjarvis.claw.gradle
|
||||
|
||||
import com.android.build.api.variant.ApplicationAndroidComponentsExtension
|
||||
import io.sentry.android.gradle.extensions.InstrumentationFeature
|
||||
import io.sentry.android.gradle.extensions.SentryPluginExtension
|
||||
import java.util.EnumSet
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.artifacts.VersionCatalogsExtension
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.gradle.kotlin.dsl.getByType
|
||||
|
||||
@Suppress("Unused")
|
||||
class SentryPlugin : Plugin<Project> {
|
||||
|
||||
override fun apply(project: Project) {
|
||||
project.pluginManager.withPlugin("com.android.application") {
|
||||
val catalog = project.extensions.getByType<VersionCatalogsExtension>()
|
||||
val libs = catalog.named("libs")
|
||||
project.extensions.configure<ApplicationAndroidComponentsExtension> {
|
||||
onVariants(selector()) { variant ->
|
||||
val sentryDsn = project.providers.environmentVariable(SENTRY_DSN_PROPERTY)
|
||||
if (sentryDsn.isPresent) {
|
||||
variant.manifestPlaceholders.put("sentryDsn", sentryDsn.get())
|
||||
}
|
||||
}
|
||||
}
|
||||
project.plugins.apply(io.sentry.android.gradle.SentryPlugin::class)
|
||||
project.extensions.configure<SentryPluginExtension> {
|
||||
val enableMappings =
|
||||
project.providers.gradleProperty(SENTRY_UPLOAD_MAPPINGS_PROPERTY).isPresent
|
||||
includeProguardMapping.set(enableMappings)
|
||||
autoUploadProguardMapping.set(enableMappings)
|
||||
uploadNativeSymbols.set(false)
|
||||
autoUploadNativeSymbols.set(false)
|
||||
includeNativeSources.set(false)
|
||||
ignoredVariants.set(emptySet())
|
||||
ignoredBuildTypes.set(setOf("debug"))
|
||||
ignoredFlavors.set(emptySet())
|
||||
tracingInstrumentation {
|
||||
enabled.set(true)
|
||||
debug.set(false)
|
||||
forceInstrumentDependencies.set(false)
|
||||
features.set(EnumSet.allOf(InstrumentationFeature::class.java))
|
||||
}
|
||||
experimentalGuardsquareSupport.set(false)
|
||||
autoInstallation {
|
||||
enabled.set(true)
|
||||
sentryVersion.set(libs.findVersion("sentry-sdk").get().requiredVersion)
|
||||
}
|
||||
includeDependenciesReport.set(true)
|
||||
}
|
||||
with(project.dependencies) {
|
||||
addProvider("implementation", platform(libs.findLibrary("sentry-bom").get()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
||||
private const val SENTRY_DSN_PROPERTY = "SENTRY_DSN"
|
||||
private const val SENTRY_UPLOAD_MAPPINGS_PROPERTY = "sentryUploadMappings"
|
||||
}
|
||||
}
|
|
@ -14,6 +14,7 @@ kotlin = "1.8.10"
|
|||
okhttp = "3.14.9"
|
||||
retrofit = "2.9.0"
|
||||
richtext = "0.16.0"
|
||||
sentry-sdk = "6.15.0"
|
||||
serialization = "1.5.0"
|
||||
sqldelight = "2.0.0-alpha05"
|
||||
whetstone = "0.6.0-SNAPSHOT"
|
||||
|
@ -52,6 +53,7 @@ build-cachefix = "org.gradle.android.cache-fix:org.gradle.android.cache-fix.grad
|
|||
build-detekt = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.22.0"
|
||||
build-kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
|
||||
build-semver = "com.vdurmont:semver4j:3.1.0"
|
||||
build-sentry = "io.sentry.android.gradle:io.sentry.android.gradle.gradle.plugin:3.4.2"
|
||||
build-spotless = "com.diffplug.spotless:spotless-plugin-gradle:6.16.0"
|
||||
build-vcu = "nl.littlerobots.version-catalog-update:nl.littlerobots.version-catalog-update.gradle.plugin:0.7.0"
|
||||
build-versions = "com.github.ben-manes:gradle-versions-plugin:0.46.0"
|
||||
|
@ -78,6 +80,7 @@ okhttp-core = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
|
|||
okhttp-loggingInterceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "okhttp" }
|
||||
retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
|
||||
retrofit-kotlinxSerializationConverter = "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0"
|
||||
sentry-bom = { module = "io.sentry:sentry-bom", version.ref = "sentry-sdk" }
|
||||
sqldelight-androidDriver = { module = "app.cash.sqldelight:android-driver", version.ref = "sqldelight" }
|
||||
sqldelight-extensions-coroutines = { module = "app.cash.sqldelight:coroutines-extensions-jvm", version.ref = "sqldelight" }
|
||||
sqldelight-jvmDriver = { module = "app.cash.sqldelight:sqlite-driver", version.ref = "sqldelight" }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue