Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add proguard mapping support for LeakCanary release #2660

Merged
merged 1 commit into from Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions leakcanary-android-release/api/leakcanary-android-release.api
Expand Up @@ -38,21 +38,23 @@ public final class leakcanary/HeapAnalysisClient$Companion {

public final class leakcanary/HeapAnalysisConfig {
public fun <init> ()V
public fun <init> (Ljava/util/List;Ljava/util/List;Lshark/MetadataExtractor;ZLshark/LeakingObjectFinder;Z)V
public synthetic fun <init> (Ljava/util/List;Ljava/util/List;Lshark/MetadataExtractor;ZLshark/LeakingObjectFinder;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (Ljava/util/List;Ljava/util/List;Lshark/MetadataExtractor;ZLshark/LeakingObjectFinder;ZLkotlin/jvm/functions/Function0;)V
public synthetic fun <init> (Ljava/util/List;Ljava/util/List;Lshark/MetadataExtractor;ZLshark/LeakingObjectFinder;ZLkotlin/jvm/functions/Function0;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()Ljava/util/List;
public final fun component2 ()Ljava/util/List;
public final fun component3 ()Lshark/MetadataExtractor;
public final fun component4 ()Z
public final fun component5 ()Lshark/LeakingObjectFinder;
public final fun component6 ()Z
public final fun copy (Ljava/util/List;Ljava/util/List;Lshark/MetadataExtractor;ZLshark/LeakingObjectFinder;Z)Lleakcanary/HeapAnalysisConfig;
public static synthetic fun copy$default (Lleakcanary/HeapAnalysisConfig;Ljava/util/List;Ljava/util/List;Lshark/MetadataExtractor;ZLshark/LeakingObjectFinder;ZILjava/lang/Object;)Lleakcanary/HeapAnalysisConfig;
public final fun component7 ()Lkotlin/jvm/functions/Function0;
public final fun copy (Ljava/util/List;Ljava/util/List;Lshark/MetadataExtractor;ZLshark/LeakingObjectFinder;ZLkotlin/jvm/functions/Function0;)Lleakcanary/HeapAnalysisConfig;
public static synthetic fun copy$default (Lleakcanary/HeapAnalysisConfig;Ljava/util/List;Ljava/util/List;Lshark/MetadataExtractor;ZLshark/LeakingObjectFinder;ZLkotlin/jvm/functions/Function0;ILjava/lang/Object;)Lleakcanary/HeapAnalysisConfig;
public fun equals (Ljava/lang/Object;)Z
public final fun getComputeRetainedHeapSize ()Z
public final fun getLeakingObjectFinder ()Lshark/LeakingObjectFinder;
public final fun getMetadataExtractor ()Lshark/MetadataExtractor;
public final fun getObjectInspectors ()Ljava/util/List;
public final fun getProguardMappingProvider ()Lkotlin/jvm/functions/Function0;
public final fun getReferenceMatchers ()Ljava/util/List;
public final fun getStripHeapDump ()Z
public fun hashCode ()I
Expand Down
Expand Up @@ -4,12 +4,13 @@ import shark.AndroidMetadataExtractor
import shark.AndroidObjectInspectors
import shark.AndroidReferenceMatchers
import shark.FilteringLeakingObjectFinder
import shark.IgnoredReferenceMatcher
import shark.LeakingObjectFinder
import shark.LibraryLeakReferenceMatcher
import shark.MetadataExtractor
import shark.ObjectInspector
import shark.IgnoredReferenceMatcher
import shark.ProguardMapping
import shark.ReferenceMatcher
import shark.LibraryLeakReferenceMatcher

data class HeapAnalysisConfig(

Expand Down Expand Up @@ -71,5 +72,7 @@ data class HeapAnalysisConfig(
* zeroes. This increases the overall processing time but limits the amount of time the heap
* dump exists on disk with potential PII.
*/
val stripHeapDump: Boolean = false
val stripHeapDump: Boolean = false,

val proguardMappingProvider: () -> ProguardMapping? = { null }
)
Expand Up @@ -280,7 +280,7 @@ internal class RealHeapAnalysisJob(
}
}

return deletingFileSourceProvider.openHeapGraph().use { graph ->
return deletingFileSourceProvider.openHeapGraph(config.proguardMappingProvider()).use { graph ->
val heapAnalysis = analyzeHeap(heapDumpFile, graph)
val lruCacheStats = (graph as HprofHeapGraph).lruCacheStats()
val randomAccessStats =
Expand Down