refactor(build): always enable Sentry and set environment
Thx Static-Var my beloved
This commit is contained in:
parent
85fc5cac21
commit
5ba0c9a544
|
@ -70,7 +70,7 @@ jobs:
|
|||
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||
run: |
|
||||
./gradlew --no-configuration-cache collectReleaseApks collectReleaseBundle -PsentryUploadMappings
|
||||
./gradlew --no-configuration-cache collectReleaseApks collectReleaseBundle -PenableSentry
|
||||
|
||||
- name: Clean secrets
|
||||
run: scripts/signing-cleanup.sh
|
||||
|
|
|
@ -35,7 +35,7 @@ jobs:
|
|||
run: |
|
||||
./scripts/setup-age.sh
|
||||
./scripts/signing-setup.sh "$AGE_SECRET_KEY"
|
||||
./gradlew --no-configuration-cache --stacktrace -PsentryUploadMappings collectReleaseBundle
|
||||
./gradlew --no-configuration-cache --stacktrace -PenableSentry collectReleaseBundle
|
||||
./scripts/signing-cleanup.sh
|
||||
env:
|
||||
AGE_SECRET_KEY: ${{ secrets.AGE_SECRET_KEY }}
|
||||
|
|
|
@ -178,17 +178,19 @@
|
|||
<!-- enable automatic breadcrumbs for user interactions (clicks, swipes, scrolls) -->
|
||||
<meta-data
|
||||
android:name="io.sentry.traces.user-interaction.enable"
|
||||
android:value="${enableSentry}" />
|
||||
android:value="true" />
|
||||
<meta-data
|
||||
android:name="io.sentry.breadcrumbs.user-interaction"
|
||||
android:value="${enableSentry}" />
|
||||
android:value="true" />
|
||||
<!-- enable screenshot for crashes -->
|
||||
<meta-data
|
||||
android:name="io.sentry.attach-screenshot"
|
||||
android:value="${enableSentry}" />
|
||||
android:value="true" />
|
||||
<!-- enable view hierarchy for crashes -->
|
||||
<meta-data
|
||||
android:name="io.sentry.attach-view-hierarchy"
|
||||
android:value="${enableSentry}" />
|
||||
android:value="true" />
|
||||
<!-- set the environment for this build -->
|
||||
<meta-data android:name="io.sentry.environment" android:value="${sentryEnvironment}" />
|
||||
</application>
|
||||
</manifest>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright © 2022-2023 Harsh Shandilya.
|
||||
* Copyright © 2022-2024 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.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright © 2023 Harsh Shandilya.
|
||||
* Copyright © 2023-2024 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.
|
||||
|
|
|
@ -25,25 +25,33 @@ class SentryPlugin : Plugin<Project> {
|
|||
project.extensions.configure<ApplicationAndroidComponentsExtension> {
|
||||
onVariants(selector().all()) { variant ->
|
||||
val sentryDsn = project.providers.environmentVariable(SENTRY_DSN_PROPERTY)
|
||||
val enableSentry =
|
||||
project.providers.gradleProperty(SENTRY_ENABLE_GRADLE_PROPERTY).isPresent
|
||||
variant.manifestPlaceholders.put("sentryDsn", sentryDsn.getOrElse(""))
|
||||
variant.manifestPlaceholders.put("enableSentry", "${variant.name == "release"}")
|
||||
variant.manifestPlaceholders.put(
|
||||
"sentryEnvironment",
|
||||
when {
|
||||
variant.name.contains("release", true) && enableSentry -> "production"
|
||||
variant.name.contains("release", true) && !enableSentry -> "nightly"
|
||||
else -> "dev"
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
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)
|
||||
includeProguardMapping.set(true)
|
||||
autoUploadProguardMapping.set(true)
|
||||
uploadNativeSymbols.set(false)
|
||||
autoUploadNativeSymbols.set(false)
|
||||
includeNativeSources.set(false)
|
||||
ignoredVariants.set(emptySet())
|
||||
ignoredBuildTypes.set(setOf("benchmark", "debug"))
|
||||
ignoredBuildTypes.set(setOf("benchmark"))
|
||||
ignoredFlavors.set(emptySet())
|
||||
tracingInstrumentation {
|
||||
enabled.set(true)
|
||||
debug.set(false)
|
||||
logcat.enabled.set(true)
|
||||
forceInstrumentDependencies.set(false)
|
||||
features.set(EnumSet.allOf(InstrumentationFeature::class.java))
|
||||
}
|
||||
|
@ -64,13 +72,16 @@ class SentryPlugin : Plugin<Project> {
|
|||
telemetry.set(false)
|
||||
telemetryDsn.set(null)
|
||||
}
|
||||
with(project.dependencies) { addProvider("implementation", platform(libs.sentry.bom)) }
|
||||
with(project.dependencies) {
|
||||
addProvider("implementation", platform(libs.sentry.bom))
|
||||
addProvider("implementation", libs.sentry.android)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
||||
private const val SENTRY_DSN_PROPERTY = "SENTRY_DSN"
|
||||
private const val SENTRY_UPLOAD_MAPPINGS_PROPERTY = "sentryUploadMappings"
|
||||
private const val SENTRY_ENABLE_GRADLE_PROPERTY = "enableSentry"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,6 +93,7 @@ okhttp-loggingInterceptor = { module = "com.squareup.okhttp3:logging-interceptor
|
|||
okhttp-mockwebserver = { module = "com.squareup.okhttp3:mockwebserver" }
|
||||
retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
|
||||
retrofit-kotlinxSerializationConverter = "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:1.0.0"
|
||||
sentry-android = { module = "io.sentry:sentry-android", version.ref = "sentry-sdk" }
|
||||
sentry-bom = { module = "io.sentry:sentry-bom", version.ref = "sentry-sdk" }
|
||||
sentry-okhttp = { module = "io.sentry:sentry-okhttp", version.ref = "sentry-sdk" }
|
||||
slack-compose-lints = "com.slack.lint.compose:compose-lint-checks:1.3.1"
|
||||
|
|
Loading…
Reference in New Issue