Improved debugging tools (#620)

* Add WhatTheStack

* Add leakcanary

* Codestyle nit

* Support snapshot builds for debug tooling

Signed-off-by: Harsh Shandilya <msfjarvis@gmail.com>
This commit is contained in:
Harsh Shandilya 2020-01-27 23:24:04 +05:30 committed by Aditya Wasan
parent 27e1952375
commit ab5aebeda3
3 changed files with 16 additions and 1 deletions

View file

@ -50,11 +50,13 @@ android {
release { release {
minifyEnabled = true minifyEnabled = true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
buildConfigField 'boolean', 'ENABLE_DEBUG_FEATURES', isSnapshot() ? 'true' : 'false'
} }
debug { debug {
applicationIdSuffix = '.debug' applicationIdSuffix = '.debug'
versionNameSuffix = '-debug' versionNameSuffix = '-debug'
minifyEnabled = false minifyEnabled = false
buildConfigField 'boolean', 'ENABLE_DEBUG_FEATURES', 'true'
} }
} }
@ -98,6 +100,13 @@ dependencies {
implementation deps.third_party.openpgp_ktx implementation deps.third_party.openpgp_ktx
implementation deps.third_party.ssh_auth implementation deps.third_party.ssh_auth
implementation deps.third_party.timber implementation deps.third_party.timber
implementation deps.third_party.whatthestack
if (isSnapshot()) {
implementation deps.third_party.leakcanary
} else {
debugImplementation deps.third_party.leakcanary
}
// Testing-only dependencies // Testing-only dependencies
androidTestImplementation deps.testing.junit androidTestImplementation deps.testing.junit

View file

@ -4,6 +4,7 @@
*/ */
package com.zeapo.pwdstore package com.zeapo.pwdstore
import com.haroldadmin.whatthestack.WhatTheStack
import timber.log.Timber import timber.log.Timber
@Suppress("Unused") @Suppress("Unused")
@ -12,5 +13,8 @@ class Application : android.app.Application() {
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
Timber.plant(Timber.DebugTree()) Timber.plant(Timber.DebugTree())
if (BuildConfig.ENABLE_DEBUG_FEATURES) {
WhatTheStack(this).init()
}
} }
} }

View file

@ -41,9 +41,11 @@ ext.deps = [
fastscroll: 'me.zhanghai.android.fastscroll:library:1.1.0', fastscroll: 'me.zhanghai.android.fastscroll:library:1.1.0',
jsch: 'com.jcraft:jsch:0.1.55', jsch: 'com.jcraft:jsch:0.1.55',
jgit: 'org.eclipse.jgit:org.eclipse.jgit:3.7.1.201504261725-r', jgit: 'org.eclipse.jgit:org.eclipse.jgit:3.7.1.201504261725-r',
leakcanary: 'com.squareup.leakcanary:leakcanary-android:2.1',
openpgp_ktx: 'com.github.android-password-store:openpgp-ktx:1.2.0', openpgp_ktx: 'com.github.android-password-store:openpgp-ktx:1.2.0',
ssh_auth: 'org.sufficientlysecure:sshauthentication-api:1.0', ssh_auth: 'org.sufficientlysecure:sshauthentication-api:1.0',
timber: "com.jakewharton.timber:timber:4.7.1", timber: 'com.jakewharton.timber:timber:4.7.1',
whatthestack: 'com.github.haroldadmin:WhatTheStack:0.0.1',
], ],
testing: [ testing: [