Index: third_party/leakcanary/BUILD.gn |
diff --git a/third_party/leakcanary/BUILD.gn b/third_party/leakcanary/BUILD.gn |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e88a64faec9afc95582439b46d039eccdc781c54 |
--- /dev/null |
+++ b/third_party/leakcanary/BUILD.gn |
@@ -0,0 +1,126 @@ |
+# Copyright 2016 The Chromium Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+import("//build/config/android/rules.gni") |
+import("config.gni") |
+ |
+java_group("leakcanary_java") { |
+ if (enable_leakcanary) { |
+ deps = [ |
+ ":leakcanary_impl_java", |
+ ] |
+ } else { |
+ deps = [ |
+ ":leakcanary_noop_java", |
+ ] |
+ } |
+} |
+ |
+android_library("leakcanary_noop_java") { |
+ java_files = [ |
+ "src/leakcanary-android-no-op/src/main/java/com/squareup/leakcanary/LeakCanary.java", |
+ "src/leakcanary-android-no-op/src/main/java/com/squareup/leakcanary/RefWatcher.java", |
+ ] |
+} |
+ |
+_wanted_resource_files = [ |
+ "src/leakcanary-android/src/main/res/drawable-xxxhdpi-v11/leak_canary_notification.png", |
+ "src/leakcanary-android/src/main/res/drawable-xxhdpi-v11/leak_canary_notification.png", |
+ "src/leakcanary-android/src/main/res/drawable-xhdpi/leak_canary_notification.png", |
+ "src/leakcanary-android/src/main/res/drawable-xhdpi/leak_canary_icon.png", |
+ "src/leakcanary-android/src/main/res/drawable-mdpi-v11/leak_canary_notification.png", |
+ "src/leakcanary-android/src/main/res/drawable-xxxhdpi/leak_canary_notification.png", |
+ "src/leakcanary-android/src/main/res/drawable-xxxhdpi/leak_canary_icon.png", |
+ "src/leakcanary-android/src/main/res/drawable-hdpi/leak_canary_notification.png", |
+ "src/leakcanary-android/src/main/res/drawable-hdpi/leak_canary_icon.png", |
+ "src/leakcanary-android/src/main/res/drawable-hdpi-v11/leak_canary_notification.png", |
+ "src/leakcanary-android/src/main/res/values/leak_canary_themes.xml", |
+ "src/leakcanary-android/src/main/res/values/leak_canary_int.xml", |
+ "src/leakcanary-android/src/main/res/values/leak_canary_strings.xml", |
+ "src/leakcanary-android/src/main/res/drawable/leak_canary_toast_background.xml", |
+ "src/leakcanary-android/src/main/res/drawable-xxhdpi/leak_canary_notification.png", |
+ "src/leakcanary-android/src/main/res/drawable-xxhdpi/leak_canary_icon.png", |
+ "src/leakcanary-android/src/main/res/drawable-xhdpi-v11/leak_canary_notification.png", |
+ "src/leakcanary-android/src/main/res/drawable-mdpi/leak_canary_notification.png", |
+ "src/leakcanary-android/src/main/res/drawable-mdpi/leak_canary_icon.png", |
+ "src/leakcanary-android/src/main/res/values-v21/leak_canary_themes.xml", |
+ "src/leakcanary-android/src/main/res/layout/leak_canary_leak_row.xml", |
+ "src/leakcanary-android/src/main/res/layout/leak_canary_heap_dump_toast.xml", |
+ "src/leakcanary-android/src/main/res/layout/leak_canary_display_leak.xml", |
+ "src/leakcanary-android/src/main/res/layout/leak_canary_ref_top_row.xml", |
+ "src/leakcanary-android/src/main/res/layout/leak_canary_ref_row.xml", |
+ "src/leakcanary-android/src/main/res/values-v14/leak_canary_themes.xml", |
+] |
+ |
+# This is required to remove: |
+# "src/leakcanary-android/src/main/res/values/leak_canary_public.xml", |
+# which is meant for .aar, and breaks aapt normally. |
+copy("leakcanary_resources_copy") { |
+ sources = _wanted_resource_files |
+ outputs = [ |
+ "$target_gen_dir/copied-resources/{{source}}", |
+ ] |
+} |
+ |
+android_resources("leakcanary_resources") { |
+ custom_package = "com.squareup.leakcanary" |
+ resource_dirs = [] |
+ generated_resource_dirs = [ "$target_gen_dir/copied-resources/third_party/leakcanary/src/leakcanary-android/src/main/res" ] |
+ generated_resource_files = |
+ process_file_template(_wanted_resource_files, |
+ [ "$target_gen_dir/copied-resources/{{source}}" ]) |
+ deps = [ |
+ ":leakcanary_resources_copy", |
+ ] |
+} |
+ |
+android_library("leakcanary_impl_java") { |
+ chromium_code = false |
+ java_files = [ |
+ "leakcanary-android-build-config/com/squareup/leakcanary/BuildConfig.java", |
+ "src/leakcanary-analyzer/src/main/java/com/squareup/haha/perflib/HahaSpy.java", |
+ "src/leakcanary-analyzer/src/main/java/com/squareup/leakcanary/AnalysisResult.java", |
+ "src/leakcanary-analyzer/src/main/java/com/squareup/leakcanary/HahaHelper.java", |
+ "src/leakcanary-analyzer/src/main/java/com/squareup/leakcanary/HeapAnalyzer.java", |
+ "src/leakcanary-analyzer/src/main/java/com/squareup/leakcanary/LeakNode.java", |
+ "src/leakcanary-analyzer/src/main/java/com/squareup/leakcanary/LeakTraceElement.java", |
+ "src/leakcanary-analyzer/src/main/java/com/squareup/leakcanary/LeakTrace.java", |
+ "src/leakcanary-analyzer/src/main/java/com/squareup/leakcanary/ShortestPathFinder.java", |
+ "src/leakcanary-android/src/main/java/com/squareup/leakcanary/AbstractAnalysisResultService.java", |
+ "src/leakcanary-android/src/main/java/com/squareup/leakcanary/ActivityRefWatcher.java", |
+ "src/leakcanary-android/src/main/java/com/squareup/leakcanary/AndroidDebuggerControl.java", |
+ "src/leakcanary-android/src/main/java/com/squareup/leakcanary/AndroidExcludedRefs.java", |
+ "src/leakcanary-android/src/main/java/com/squareup/leakcanary/AndroidHeapDumper.java", |
+ "src/leakcanary-android/src/main/java/com/squareup/leakcanary/AndroidWatchExecutor.java", |
+ "src/leakcanary-android/src/main/java/com/squareup/leakcanary/CanaryLog.java", |
+ "src/leakcanary-android/src/main/java/com/squareup/leakcanary/DefaultLeakDirectoryProvider.java", |
+ "src/leakcanary-android/src/main/java/com/squareup/leakcanary/DisplayLeakService.java", |
+ "src/leakcanary-android/src/main/java/com/squareup/leakcanary/internal/DisplayLeakActivity.java", |
+ "src/leakcanary-android/src/main/java/com/squareup/leakcanary/internal/DisplayLeakAdapter.java", |
+ "src/leakcanary-android/src/main/java/com/squareup/leakcanary/internal/DisplayLeakConnectorView.java", |
+ "src/leakcanary-android/src/main/java/com/squareup/leakcanary/internal/FutureResult.java", |
+ "src/leakcanary-android/src/main/java/com/squareup/leakcanary/internal/HeapAnalyzerService.java", |
+ "src/leakcanary-android/src/main/java/com/squareup/leakcanary/internal/LeakCanaryInternals.java", |
+ "src/leakcanary-android/src/main/java/com/squareup/leakcanary/internal/LeakCanarySingleThreadFactory.java", |
+ "src/leakcanary-android/src/main/java/com/squareup/leakcanary/internal/LeakCanaryUi.java", |
+ "src/leakcanary-android/src/main/java/com/squareup/leakcanary/internal/MoreDetailsView.java", |
+ "src/leakcanary-android/src/main/java/com/squareup/leakcanary/internal/RequestStoragePermissionActivity.java", |
+ "src/leakcanary-android/src/main/java/com/squareup/leakcanary/LeakCanary.java", |
+ "src/leakcanary-android/src/main/java/com/squareup/leakcanary/LeakDirectoryProvider.java", |
+ "src/leakcanary-android/src/main/java/com/squareup/leakcanary/ServiceHeapDumpListener.java", |
+ "src/leakcanary-watcher/src/main/java/com/squareup/leakcanary/DebuggerControl.java", |
+ "src/leakcanary-watcher/src/main/java/com/squareup/leakcanary/ExcludedRefs.java", |
+ "src/leakcanary-watcher/src/main/java/com/squareup/leakcanary/Exclusion.java", |
+ "src/leakcanary-watcher/src/main/java/com/squareup/leakcanary/GcTrigger.java", |
+ "src/leakcanary-watcher/src/main/java/com/squareup/leakcanary/HeapDumper.java", |
+ "src/leakcanary-watcher/src/main/java/com/squareup/leakcanary/HeapDump.java", |
+ "src/leakcanary-watcher/src/main/java/com/squareup/leakcanary/KeyedWeakReference.java", |
+ "src/leakcanary-watcher/src/main/java/com/squareup/leakcanary/Preconditions.java", |
+ "src/leakcanary-watcher/src/main/java/com/squareup/leakcanary/RefWatcher.java", |
+ ] |
+ deps = [ |
+ ":leakcanary_resources", |
+ "//third_party/haha", |
+ ] |
+} |