Skip to content

Commit

Permalink
add dev buildType
Browse files Browse the repository at this point in the history
Closes signalapp#3411
// FREEBIE
  • Loading branch information
mcginty authored and moxie0 committed Jun 25, 2015
1 parent 2016fa3 commit b4634f3
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
18 changes: 13 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
}
Expand Down Expand Up @@ -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'

Expand All @@ -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'
}
}
Expand Down Expand Up @@ -135,7 +138,7 @@ dependencyVerification {
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
testBuildType "debugTest"
testBuildType "automation"

dexOptions {
javaMaxHeapSize "4g"
Expand All @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
File renamed without changes.
19 changes: 17 additions & 2 deletions src/org/thoughtcrime/securesms/ApplicationContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@

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;
Expand All @@ -34,8 +39,6 @@
import org.whispersystems.libaxolotl.logging.AxolotlLoggerProvider;
import org.whispersystems.libaxolotl.util.AndroidAxolotlLogger;

import java.security.Security;

import dagger.ObjectGraph;

/**
Expand All @@ -57,6 +60,8 @@ public static ApplicationContext getInstance(Context context) {

@Override
public void onCreate() {
super.onCreate();
initializeDeveloperBuild();
initializeRandomNumberFix();
initializeLogging();
initializeDependencyInjection();
Expand All @@ -75,6 +80,16 @@ public JobManager getJobManager() {
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();
}
Expand Down

0 comments on commit b4634f3

Please sign in to comment.