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

View File

@ -18,6 +18,11 @@ package org.thoughtcrime.securesms;
import android.app.Application;
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.dependencies.AxolotlStorageModule;
@ -34,8 +39,6 @@ import org.whispersystems.jobqueue.requirements.NetworkRequirementProvider;
import org.whispersystems.libaxolotl.logging.AxolotlLoggerProvider;
import org.whispersystems.libaxolotl.util.AndroidAxolotlLogger;
import java.security.Security;
import dagger.ObjectGraph;
/**
@ -57,6 +60,8 @@ public class ApplicationContext extends Application implements DependencyInjecto
@Override
public void onCreate() {
super.onCreate();
initializeDeveloperBuild();
initializeRandomNumberFix();
initializeLogging();
initializeDependencyInjection();
@ -75,6 +80,16 @@ public class ApplicationContext extends Application implements DependencyInjecto
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() {
PRNGFixes.apply();
}