DROID-979 App | Tech | Setup sentry (#3002)
DROID-979 App | Tech | Setup sentry
This commit is contained in:
parent
4cae9fce35
commit
5ee6443ebb
|
@ -17,7 +17,8 @@ jobs:
|
|||
user_secret: ${{ secrets.ANYTYPE_USER_SECRET }}
|
||||
amplitude_secret: ${{ secrets.ANYTYPE_AMPLITUDE_SECRET }}
|
||||
amplitude_secret_debug: ${{ secrets.ANYTYPE_AMPLITUDE_DEBUG_SECRET }}
|
||||
run: ./middleware2.sh $token_secret $user_secret $amplitude_secret $amplitude_secret_debug
|
||||
sentry_dsn_secret: ${{ secrets.ANYTYPE_SENTRY_DSN_SECRET }}
|
||||
run: ./middleware2.sh $token_secret $user_secret $amplitude_secret $amplitude_secret_debug $sentry_dsn_secret
|
||||
|
||||
- name: Compile android test sources
|
||||
run: make compile_android_test_sources
|
||||
|
|
|
@ -14,7 +14,8 @@ jobs:
|
|||
user_secret: ${{ secrets.ANYTYPE_USER_SECRET }}
|
||||
amplitude_secret: ${{ secrets.ANYTYPE_AMPLITUDE_SECRET }}
|
||||
amplitude_secret_debug: ${{ secrets.ANYTYPE_AMPLITUDE_DEBUG_SECRET }}
|
||||
run: ./middleware2.sh $token_secret $user_secret $amplitude_secret $amplitude_secret_debug
|
||||
sentry_dsn_secret: ${{ secrets.ANYTYPE_SENTRY_DSN_SECRET }}
|
||||
run: ./middleware2.sh $token_secret $user_secret $amplitude_secret $amplitude_secret_debug $sentry_dsn_secret
|
||||
|
||||
- name: Enable dated version for nightly debug builds
|
||||
run: make enable_dated_version_name
|
||||
|
|
|
@ -12,7 +12,8 @@ jobs:
|
|||
user_secret: ${{ secrets.ANYTYPE_USER_SECRET }}
|
||||
amplitude_secret: ${{ secrets.ANYTYPE_AMPLITUDE_SECRET }}
|
||||
amplitude_secret_debug: ${{ secrets.ANYTYPE_AMPLITUDE_DEBUG_SECRET }}
|
||||
run: ./middleware2.sh $token_secret $user_secret $amplitude_secret $amplitude_secret_debug
|
||||
sentry_dsn_secret: ${{ secrets.ANYTYPE_SENTRY_DSN_SECRET }}
|
||||
run: ./middleware2.sh $token_secret $user_secret $amplitude_secret $amplitude_secret_debug $sentry_dsn_secret
|
||||
|
||||
- name: Decrypt secrets
|
||||
run: ./scripts/release/decrypt-secrets.sh
|
||||
|
|
|
@ -14,7 +14,8 @@ jobs:
|
|||
user_secret: ${{ secrets.ANYTYPE_USER_SECRET }}
|
||||
amplitude_secret: ${{ secrets.ANYTYPE_AMPLITUDE_SECRET }}
|
||||
amplitude_secret_debug: ${{ secrets.ANYTYPE_AMPLITUDE_DEBUG_SECRET }}
|
||||
run: ./middleware2.sh $token_secret $user_secret $amplitude_secret $amplitude_secret_debug
|
||||
sentry_dsn_secret: ${{ secrets.ANYTYPE_SENTRY_DSN_SECRET }}
|
||||
run: ./middleware2.sh $token_secret $user_secret $amplitude_secret $amplitude_secret_debug $sentry_dsn_secret
|
||||
|
||||
- name: Run unit tests. Full mode.
|
||||
run: ./gradlew build test -Dpre-dex=false -q
|
|
@ -20,6 +20,7 @@ Your Github ID (starting with '#' character) can be found [here](https://caius.g
|
|||
```
|
||||
amplitude.debug="AMPLITUDE_DEBUG_KEY"
|
||||
amplitude.release="AMPLITUDE_RELEASE_KEY"
|
||||
sentry_dsn="SENTRY_DSN_KEY"
|
||||
```
|
||||
|
||||
Then build project.
|
||||
|
|
|
@ -39,6 +39,7 @@ android {
|
|||
buildConfigField "boolean", "LOG_DASHBOARD_REDUCER", localProperties.getProperty("LOG_DASHBOARD_REDUCER", "false")
|
||||
buildConfigField "boolean", "LOG_EDITOR_VIEWMODEL_EVENTS", localProperties.getProperty("LOG_EDITOR_VIEWMODEL_EVENTS", "false")
|
||||
buildConfigField "boolean", "LOG_EDITOR_CONTROL_PANEL", localProperties.getProperty("LOG_EDITOR_CONTROL_PANEL", "false")
|
||||
resValue "string", "SENTRY_DSN", config.sentryApiKey
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
|
@ -146,6 +147,7 @@ dependencies {
|
|||
implementation project(':library-syntax-highlighter')
|
||||
implementation project(':analytics')
|
||||
implementation project(':ui-settings')
|
||||
implementation project(':crash-reporting')
|
||||
|
||||
//Compile time dependencies
|
||||
kapt libs.daggerCompiler
|
||||
|
|
|
@ -74,6 +74,11 @@
|
|||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/provider_paths" />
|
||||
</provider>
|
||||
|
||||
<meta-data
|
||||
android:name="io.sentry.dsn"
|
||||
android:value="@string/SENTRY_DSN" />
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -7,6 +7,7 @@ import androidx.emoji.text.FontRequestEmojiCompatConfig
|
|||
import com.amplitude.api.Amplitude
|
||||
import com.anytypeio.anytype.BuildConfig
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.SentryCrashReporter
|
||||
import com.anytypeio.anytype.analytics.tracker.AmplitudeTracker
|
||||
import com.anytypeio.anytype.core_utils.tools.CrashlyticsTree
|
||||
import com.anytypeio.anytype.di.common.ComponentDependenciesProvider
|
||||
|
@ -31,6 +32,9 @@ class AndroidApplication : Application(), HasComponentDependencies {
|
|||
@Inject
|
||||
lateinit var discoveryManager: MDNSProvider
|
||||
|
||||
@Inject
|
||||
lateinit var crashReporter: SentryCrashReporter
|
||||
|
||||
@Inject
|
||||
override lateinit var dependencies: ComponentDependenciesProvider
|
||||
protected set
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package com.anytypeio.anytype.di.main
|
||||
|
||||
import android.content.Context
|
||||
import com.anytypeio.anytype.SentryCrashReporter
|
||||
import com.anytypeio.anytype.core_utils.tools.AppInfo
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Module
|
||||
object CrashReportingModule {
|
||||
|
||||
@JvmStatic
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideCrashReporter(
|
||||
context: Context,
|
||||
appInfo: AppInfo
|
||||
): SentryCrashReporter = SentryCrashReporter(context, appInfo)
|
||||
|
||||
}
|
|
@ -57,7 +57,8 @@ import javax.inject.Singleton
|
|||
ClipboardModule::class,
|
||||
AnalyticsModule::class,
|
||||
LocalNetworkProviderModule::class,
|
||||
SubscriptionsModule::class
|
||||
SubscriptionsModule::class,
|
||||
CrashReportingModule::class
|
||||
]
|
||||
)
|
||||
interface MainComponent :
|
||||
|
|
|
@ -3,8 +3,11 @@ package com.anytypeio.anytype.di.main
|
|||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import androidx.preference.PreferenceManager
|
||||
import com.anytypeio.anytype.BuildConfig
|
||||
import com.anytypeio.anytype.app.TogglePrefs
|
||||
import com.anytypeio.anytype.app.DefaultFeatureToggles
|
||||
import com.anytypeio.anytype.core_utils.tools.AppInfo
|
||||
import com.anytypeio.anytype.core_utils.tools.DefaultAppInfo
|
||||
import com.anytypeio.anytype.core_utils.tools.DefaultUrlValidator
|
||||
import com.anytypeio.anytype.core_utils.tools.FeatureToggles
|
||||
import com.anytypeio.anytype.core_utils.tools.UrlValidator
|
||||
|
@ -33,6 +36,11 @@ object UtilModule {
|
|||
context: Context
|
||||
): SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
||||
@JvmStatic
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideAppInfo(): AppInfo = DefaultAppInfo(BuildConfig.VERSION_NAME)
|
||||
|
||||
@Module
|
||||
interface Bindings {
|
||||
|
||||
|
|
|
@ -14,6 +14,12 @@ buildscript {
|
|||
def githubPropertiesFile = file("$rootDir${File.separator}github.properties")
|
||||
githubProperties.load(new FileInputStream(githubPropertiesFile))
|
||||
|
||||
def apiKeysProperties = new Properties()
|
||||
def apiKeysPropertiesFile = file("$rootDir${File.separator}apikeys.properties")
|
||||
apiKeysProperties.load(new FileInputStream(apiKeysPropertiesFile))
|
||||
|
||||
ext.sentryApiKey = apiKeysProperties["sentry_dsn"]
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
google()
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package com.anytypeio.anytype.core_utils.tools
|
||||
|
||||
import com.anytypeio.anytype.core_utils.BuildConfig
|
||||
import javax.inject.Inject
|
||||
|
||||
interface AppInfo {
|
||||
val sentryEnvironment: SentryEnvironment
|
||||
val versionName: String
|
||||
}
|
||||
|
||||
class DefaultAppInfo @Inject constructor(
|
||||
versionNameValue: String
|
||||
): AppInfo {
|
||||
|
||||
override val sentryEnvironment = if (BuildConfig.DEBUG) SentryEnvironment.DEV else SentryEnvironment.PROD
|
||||
|
||||
override val versionName: String = versionNameValue
|
||||
|
||||
}
|
||||
|
||||
enum class SentryEnvironment(val value: String) {
|
||||
DEV("development"), PROD("production")
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
plugins {
|
||||
id "com.android.library"
|
||||
id "kotlin-android"
|
||||
id "io.sentry.android.gradle" version "3.4.2"
|
||||
}
|
||||
|
||||
android {
|
||||
sentry {
|
||||
includeProguardMapping = true
|
||||
autoUploadProguardMapping = true
|
||||
experimentalGuardsquareSupport = false
|
||||
uploadNativeSymbols = false
|
||||
includeNativeSources = false
|
||||
autoInstallation {
|
||||
enabled = true
|
||||
sentryVersion = libs.versions.sentryVersion
|
||||
}
|
||||
includeDependenciesReport = true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation libs.sentry
|
||||
implementation project(path: ':core-utils')
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="com.anytypeio.anytype.crash_reporting"/>
|
|
@ -0,0 +1,20 @@
|
|||
package com.anytypeio.anytype
|
||||
|
||||
import android.content.Context
|
||||
import com.anytypeio.anytype.core_utils.tools.AppInfo
|
||||
import io.sentry.android.core.SentryAndroid
|
||||
import io.sentry.android.core.SentryAndroidOptions
|
||||
|
||||
class SentryCrashReporter(
|
||||
context: Context,
|
||||
appInfo: AppInfo
|
||||
) {
|
||||
|
||||
init {
|
||||
SentryAndroid.init(context) { options: SentryAndroidOptions ->
|
||||
options.release = appInfo.versionName
|
||||
options.environment = appInfo.sentryEnvironment.value
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -62,6 +62,7 @@ roomVersion = '2.4.3'
|
|||
amplitudeVersion = '2.36.1'
|
||||
okhttpVersion = '4.2.2'
|
||||
coilComposeVersion = '2.2.2'
|
||||
sentryVersion = '5.0.1'
|
||||
|
||||
[libraries]
|
||||
middleware = { module = "io.anytype:android-mw", version.ref = "middlewareVersion" }
|
||||
|
@ -156,6 +157,7 @@ annotations = { module = "androidx.room:room-compiler", version.ref = "roomVersi
|
|||
roomTesting = { module = "androidx.room:room-testing", version.ref = "roomVersion" }
|
||||
amplitude = { module = "com.amplitude:android-sdk", version.ref = "amplitudeVersion" }
|
||||
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttpVersion" }
|
||||
sentry = { module = "io.sentry:sentry-android", version.ref = "sentryVersion" }
|
||||
|
||||
[bundles]
|
||||
|
||||
|
|
|
@ -4,11 +4,13 @@ TOKEN=$1
|
|||
USER=$2
|
||||
AMPLITUDE_RELEASE_KEY=$3
|
||||
AMPLITUDE_DEBUG_KEY=$4
|
||||
SENTRY_DSN=$5
|
||||
|
||||
GITHUB_USER_PROPERTY="gpr.usr"
|
||||
GITHUB_KEY_PROPERTY="gpr.key"
|
||||
AMPLITUDE_DEBUG_PROPERTY="amplitude.debug"
|
||||
AMPLITUDE_RELEASE_PROPERTY="amplitude.release"
|
||||
SENTRY_DSN_PROPERTY="sentry_dsn"
|
||||
|
||||
if [ "$TOKEN" = "" ]; then
|
||||
echo "ERROR: token is empty"
|
||||
|
@ -30,6 +32,11 @@ if [ "$AMPLITUDE_DEBUG_KEY" = "" ]; then
|
|||
exit 1
|
||||
fi;
|
||||
|
||||
if [ "$SENTRY_DSN" = ""]; then
|
||||
echo "ERROR: sentry_dsn is empty"
|
||||
exit 1
|
||||
fi;
|
||||
|
||||
rm -rf github.properties
|
||||
touch github.properties
|
||||
|
||||
|
@ -40,4 +47,5 @@ rm -rf apikeys.properties
|
|||
touch apikeys.properties
|
||||
|
||||
echo "$AMPLITUDE_DEBUG_PROPERTY=\"$AMPLITUDE_DEBUG_KEY\"" >> apikeys.properties
|
||||
echo "$AMPLITUDE_RELEASE_PROPERTY=\"$AMPLITUDE_RELEASE_KEY\"" >> apikeys.properties
|
||||
echo "$AMPLITUDE_RELEASE_PROPERTY=\"$AMPLITUDE_RELEASE_KEY\"" >> apikeys.properties
|
||||
echo "$SENTRY_DSN_PROPERTY=\"$SENTRY_DSN\"" >> apikeys.properties
|
|
@ -55,4 +55,5 @@ include ':app',
|
|||
':test:core-models-stub',
|
||||
':libs'
|
||||
|
||||
include ':ui-settings'
|
||||
include ':ui-settings'
|
||||
include ':crash-reporting'
|
Loading…
Reference in New Issue