add dev buildType

Closes #3411
// FREEBIE
This commit is contained in:
Jake McGinty 2015-05-21 12:30:18 -07:00 committed by Moxie Marlinspike
parent 2016fa315b
commit b4634f30e6
3 changed files with 30 additions and 7 deletions

View File

@ -5,7 +5,7 @@ buildscript {
} }
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:1.0.1' classpath 'com.android.tools.build:gradle:1.2.3'
classpath files('libs/gradle-witness.jar') classpath files('libs/gradle-witness.jar')
} }
} }
@ -69,6 +69,8 @@ dependencies {
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1' compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'org.whispersystems:textsecure-android:1.5.0' compile 'org.whispersystems:textsecure-android:1.5.0'
compile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
androidTestCompile 'com.google.dexmaker:dexmaker:1.2' androidTestCompile 'com.google.dexmaker:dexmaker:1.2'
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2' androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2'
@ -83,6 +85,7 @@ dependencies {
exclude group: 'com.android.support', module: 'support-annotations' exclude group: 'com.android.support', module: 'support-annotations'
} }
androidTestCompile ('com.android.support.test.espresso:espresso-core:2.1') { androidTestCompile ('com.android.support.test.espresso:espresso-core:2.1') {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'javax.inject' exclude group: 'javax.inject'
} }
} }
@ -135,7 +138,7 @@ dependencyVerification {
android { android {
compileSdkVersion 22 compileSdkVersion 22
buildToolsVersion '22.0.1' buildToolsVersion '22.0.1'
testBuildType "debugTest" testBuildType "automation"
dexOptions { dexOptions {
javaMaxHeapSize "4g" javaMaxHeapSize "4g"
@ -148,6 +151,7 @@ android {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
buildConfigField "long", "BUILD_TIMESTAMP", System.currentTimeMillis() + "L" buildConfigField "long", "BUILD_TIMESTAMP", System.currentTimeMillis() + "L"
buildConfigField "String", "PUSH_URL", "\"https://textsecure-service.whispersystems.org\"" buildConfigField "String", "PUSH_URL", "\"https://textsecure-service.whispersystems.org\""
buildConfigField "boolean", "DEV_BUILD", "false"
} }
compileOptions { compileOptions {
@ -190,11 +194,15 @@ android {
proguardFiles = buildTypes.debug.proguardFiles proguardFiles = buildTypes.debug.proguardFiles
signingConfig signingConfigs.release signingConfig signingConfigs.release
} }
debugTest.initWith(buildTypes.debug) automation.initWith(buildTypes.debug)
debugTest { automation {
proguardFile 'proguard-testing.pro' proguardFile 'proguard-automation.pro'
buildConfigField "String", "PUSH_URL", "\"https://textsecure-service-staging.whispersystems.org\"" buildConfigField "String", "PUSH_URL", "\"https://textsecure-service-staging.whispersystems.org\""
} }
dev.initWith(buildTypes.debug)
dev {
buildConfigField "boolean", "DEV_BUILD", "true"
}
} }
sourceSets { sourceSets {

View File

@ -18,6 +18,11 @@ package org.thoughtcrime.securesms;
import android.app.Application; import android.app.Application;
import android.content.Context; import android.content.Context;
import android.os.StrictMode;
import android.os.StrictMode.ThreadPolicy;
import android.os.StrictMode.VmPolicy;
import com.squareup.leakcanary.LeakCanary;
import org.thoughtcrime.securesms.crypto.PRNGFixes; import org.thoughtcrime.securesms.crypto.PRNGFixes;
import org.thoughtcrime.securesms.dependencies.AxolotlStorageModule; import org.thoughtcrime.securesms.dependencies.AxolotlStorageModule;
@ -34,8 +39,6 @@ import org.whispersystems.jobqueue.requirements.NetworkRequirementProvider;
import org.whispersystems.libaxolotl.logging.AxolotlLoggerProvider; import org.whispersystems.libaxolotl.logging.AxolotlLoggerProvider;
import org.whispersystems.libaxolotl.util.AndroidAxolotlLogger; import org.whispersystems.libaxolotl.util.AndroidAxolotlLogger;
import java.security.Security;
import dagger.ObjectGraph; import dagger.ObjectGraph;
/** /**
@ -57,6 +60,8 @@ public class ApplicationContext extends Application implements DependencyInjecto
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate();
initializeDeveloperBuild();
initializeRandomNumberFix(); initializeRandomNumberFix();
initializeLogging(); initializeLogging();
initializeDependencyInjection(); initializeDependencyInjection();
@ -75,6 +80,16 @@ public class ApplicationContext extends Application implements DependencyInjecto
return jobManager; return jobManager;
} }
private void initializeDeveloperBuild() {
if (BuildConfig.DEV_BUILD) {
LeakCanary.install(this);
StrictMode.setThreadPolicy(new ThreadPolicy.Builder().detectAll()
.penaltyLog()
.build());
StrictMode.setVmPolicy(new VmPolicy.Builder().detectAll().penaltyLog().build());
}
}
private void initializeRandomNumberFix() { private void initializeRandomNumberFix() {
PRNGFixes.apply(); PRNGFixes.apply();
} }