Created
May 22, 2015 17:07
-
-
Save leibovic/38c21068e4ac58e5c751 to your computer and use it in GitHub Desktop.
Leak canary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HG changeset patch | |
# User Nick Alexander <[email protected]> | |
# Date 1431118818 25200 | |
# Fri May 08 14:00:18 2015 -0700 | |
# Node ID 5645e1d9cbf3f76429dba78e25d8121327cbbb2a | |
# Parent 0406efcbb88be90a7e2163087f82dc89921b9b48 | |
No bug - Add leakcanary to base Gradle project. | |
diff --git a/mobile/android/base/GeckoApplication.java b/mobile/android/base/GeckoApplication.java | |
--- a/mobile/android/base/GeckoApplication.java | |
+++ b/mobile/android/base/GeckoApplication.java | |
@@ -18,16 +18,18 @@ import org.mozilla.gecko.util.ThreadUtil | |
import android.app.Application; | |
import android.content.Context; | |
import android.content.SharedPreferences; | |
import android.content.res.Configuration; | |
import android.util.Log; | |
import java.io.File; | |
+import com.squareup.leakcanary.LeakCanary; | |
+ | |
public class GeckoApplication extends Application | |
implements ContextGetter { | |
private static final String LOG_TAG = "GeckoApplication"; | |
private static volatile GeckoApplication instance; | |
private boolean mInBackground; | |
private boolean mPausedGecko; | |
@@ -117,16 +119,17 @@ public class GeckoApplication extends Ap | |
GeckoConnectivityReceiver.getInstance().start(applicationContext); | |
GeckoNetworkManager.getInstance().start(applicationContext); | |
mInBackground = false; | |
} | |
@Override | |
public void onCreate() { | |
+ LeakCanary.install(this); | |
final Context context = getApplicationContext(); | |
HardwareUtils.init(context); | |
Clipboard.init(context); | |
FilePicker.init(context); | |
GeckoLoader.loadMozGlue(context); | |
DownloadsIntegration.init(); | |
HomePanelsManager.getInstance().init(context); | |
diff --git a/mobile/android/gradle/base/build.gradle b/mobile/android/gradle/base/build.gradle | |
--- a/mobile/android/gradle/base/build.gradle | |
+++ b/mobile/android/gradle/base/build.gradle | |
@@ -60,16 +60,18 @@ dependencies { | |
compile 'com.google.android.gms:play-services-base:6.5.+' | |
compile 'com.google.android.gms:play-services-cast:6.5.+' | |
} | |
compile project(':branding') | |
compile project(':preprocessed_code') | |
compile project(':preprocessed_resources') | |
compile project(':thirdparty') | |
+ debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3' | |
+ releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3' | |
} | |
android.libraryVariants.all { variant -> | |
variant.checkManifest.dependsOn rootProject.generateCodeAndResources | |
} | |
apply plugin: 'idea' | |
diff --git a/mobile/android/gradle/build.gradle b/mobile/android/gradle/build.gradle | |
--- a/mobile/android/gradle/build.gradle | |
+++ b/mobile/android/gradle/build.gradle | |
@@ -1,36 +1,38 @@ | |
allprojects { | |
// Expose the per-object-directory configuration to all projects. | |
ext { | |
mozconfig = gradle.mozconfig | |
topsrcdir = gradle.mozconfig.topsrcdir | |
topobjdir = gradle.mozconfig.topobjdir | |
} | |
+ | |
+ repositories { | |
+ jcenter() | |
+ mavenCentral() | |
+ } | |
} | |
buildDir "${topobjdir}/mobile/android/gradle/build" | |
buildscript { | |
repositories { | |
jcenter() | |
+ mavenCentral() | |
} | |
dependencies { | |
// IntelliJ 14.0.2 wants 0.14.4; IntelliJ 14.0.3 and Android Studio want | |
// 1.0.0. There are major issues with the combination of 0.14.4, Gradle | |
// 2.2.1, and IntelliJ 14.0.2: see Bug 1120032. | |
classpath 'com.android.tools.build:gradle:1.0.0' | |
} | |
} | |
-repositories { | |
- jcenter() | |
-} | |
- | |
task generateCodeAndResources(type:Exec) { | |
workingDir "${topobjdir}" | |
commandLine mozconfig.substs.GMAKE | |
args '-C' | |
args "${topobjdir}/mobile/android/base" | |
args 'gradle-targets' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment