xref: /aosp_15_r20/external/leakcanary2/leakcanary-android-sample/build.gradle (revision d9e8da70d8c9df9a41d7848ae506fb3115cae6e6)
1*d9e8da70SAndroid Build Coastguard Workerplugins {
2*d9e8da70SAndroid Build Coastguard Worker  id("com.android.application")
3*d9e8da70SAndroid Build Coastguard Worker  id("org.jetbrains.kotlin.android")
4*d9e8da70SAndroid Build Coastguard Worker  // Required to run obfuscated instrumentation tests:
5*d9e8da70SAndroid Build Coastguard Worker  // ./gradlew leakcanary-android-sample:connectedCheck -Pminify
6*d9e8da70SAndroid Build Coastguard Worker  id("com.slack.keeper")
7*d9e8da70SAndroid Build Coastguard Worker}
8*d9e8da70SAndroid Build Coastguard Worker
9*d9e8da70SAndroid Build Coastguard Workerkeeper {
10*d9e8da70SAndroid Build Coastguard Worker  variantFilter {
11*d9e8da70SAndroid Build Coastguard Worker    setIgnore(!project.hasProperty('minify'))
12*d9e8da70SAndroid Build Coastguard Worker  }
13*d9e8da70SAndroid Build Coastguard Worker}
14*d9e8da70SAndroid Build Coastguard Worker
15*d9e8da70SAndroid Build Coastguard Workerdependencies {
16*d9e8da70SAndroid Build Coastguard Worker  debugImplementation projects.leakcanaryAndroid
17*d9e8da70SAndroid Build Coastguard Worker  // debugImplementation projects.leakcanaryAndroidStartup
18*d9e8da70SAndroid Build Coastguard Worker
19*d9e8da70SAndroid Build Coastguard Worker  // Uncomment to use the :leakcanary process
20*d9e8da70SAndroid Build Coastguard Worker  // debugImplementation projects.leakcanaryAndroidProcess
21*d9e8da70SAndroid Build Coastguard Worker  releaseImplementation projects.leakcanaryAndroidRelease
22*d9e8da70SAndroid Build Coastguard Worker  // Optional
23*d9e8da70SAndroid Build Coastguard Worker  releaseImplementation projects.leakcanaryObjectWatcherAndroid
24*d9e8da70SAndroid Build Coastguard Worker
25*d9e8da70SAndroid Build Coastguard Worker  implementation libs.kotlin.stdlib
26*d9e8da70SAndroid Build Coastguard Worker  // Uncomment to use WorkManager
27*d9e8da70SAndroid Build Coastguard Worker  // implementation libs.androidX.work.runtime
28*d9e8da70SAndroid Build Coastguard Worker
29*d9e8da70SAndroid Build Coastguard Worker  testImplementation libs.junit
30*d9e8da70SAndroid Build Coastguard Worker  testImplementation libs.robolectric
31*d9e8da70SAndroid Build Coastguard Worker
32*d9e8da70SAndroid Build Coastguard Worker  androidTestImplementation projects.leakcanaryAndroidInstrumentation
33*d9e8da70SAndroid Build Coastguard Worker  androidTestImplementation libs.androidX.test.espresso
34*d9e8da70SAndroid Build Coastguard Worker  androidTestImplementation libs.androidX.test.rules
35*d9e8da70SAndroid Build Coastguard Worker  androidTestImplementation libs.androidX.test.runner
36*d9e8da70SAndroid Build Coastguard Worker  androidTestImplementation libs.androidX.test.junit
37*d9e8da70SAndroid Build Coastguard Worker  androidTestImplementation libs.androidX.test.junitKtx
38*d9e8da70SAndroid Build Coastguard Worker  androidTestUtil libs.androidX.test.orchestrator
39*d9e8da70SAndroid Build Coastguard Worker}
40*d9e8da70SAndroid Build Coastguard Worker
41*d9e8da70SAndroid Build Coastguard Workerandroid {
42*d9e8da70SAndroid Build Coastguard Worker  compileSdk versions.compileSdk
43*d9e8da70SAndroid Build Coastguard Worker
44*d9e8da70SAndroid Build Coastguard Worker  compileOptions {
45*d9e8da70SAndroid Build Coastguard Worker    sourceCompatibility JavaVersion.VERSION_1_8
46*d9e8da70SAndroid Build Coastguard Worker    targetCompatibility JavaVersion.VERSION_1_8
47*d9e8da70SAndroid Build Coastguard Worker  }
48*d9e8da70SAndroid Build Coastguard Worker
49*d9e8da70SAndroid Build Coastguard Worker  defaultConfig {
50*d9e8da70SAndroid Build Coastguard Worker    applicationId "com.example.leakcanary"
51*d9e8da70SAndroid Build Coastguard Worker    minSdk 16
52*d9e8da70SAndroid Build Coastguard Worker    targetSdk versions.compileSdk
53*d9e8da70SAndroid Build Coastguard Worker
54*d9e8da70SAndroid Build Coastguard Worker    versionCode 1
55*d9e8da70SAndroid Build Coastguard Worker    versionName "1.0"
56*d9e8da70SAndroid Build Coastguard Worker
57*d9e8da70SAndroid Build Coastguard Worker    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
58*d9e8da70SAndroid Build Coastguard Worker
59*d9e8da70SAndroid Build Coastguard Worker    // Run ./gradlew leakcanary-android-sample:connectedCheck -Porchestrator
60*d9e8da70SAndroid Build Coastguard Worker    if (project.hasProperty('orchestrator')) {
61*d9e8da70SAndroid Build Coastguard Worker      testInstrumentationRunnerArguments clearPackageData: 'true'
62*d9e8da70SAndroid Build Coastguard Worker      testOptions {
63*d9e8da70SAndroid Build Coastguard Worker        execution 'ANDROIDX_TEST_ORCHESTRATOR'
64*d9e8da70SAndroid Build Coastguard Worker      }
65*d9e8da70SAndroid Build Coastguard Worker    }
66*d9e8da70SAndroid Build Coastguard Worker  }
67*d9e8da70SAndroid Build Coastguard Worker
68*d9e8da70SAndroid Build Coastguard Worker  buildTypes {
69*d9e8da70SAndroid Build Coastguard Worker    // Build with ./gradlew leakcanary-android-sample:installDebug -Pminify
70*d9e8da70SAndroid Build Coastguard Worker    if (project.hasProperty('minify')) {
71*d9e8da70SAndroid Build Coastguard Worker      debug {
72*d9e8da70SAndroid Build Coastguard Worker        minifyEnabled true
73*d9e8da70SAndroid Build Coastguard Worker        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt')
74*d9e8da70SAndroid Build Coastguard Worker      }
75*d9e8da70SAndroid Build Coastguard Worker    } else {
76*d9e8da70SAndroid Build Coastguard Worker      debug
77*d9e8da70SAndroid Build Coastguard Worker    }
78*d9e8da70SAndroid Build Coastguard Worker    release {
79*d9e8da70SAndroid Build Coastguard Worker      signingConfig signingConfigs.debug
80*d9e8da70SAndroid Build Coastguard Worker    }
81*d9e8da70SAndroid Build Coastguard Worker  }
82*d9e8da70SAndroid Build Coastguard Worker
83*d9e8da70SAndroid Build Coastguard Worker  dexOptions {
84*d9e8da70SAndroid Build Coastguard Worker    dexInProcess false
85*d9e8da70SAndroid Build Coastguard Worker  }
86*d9e8da70SAndroid Build Coastguard Worker
87*d9e8da70SAndroid Build Coastguard Worker  lintOptions {
88*d9e8da70SAndroid Build Coastguard Worker    disable 'GoogleAppIndexingWarning'
89*d9e8da70SAndroid Build Coastguard Worker  }
90*d9e8da70SAndroid Build Coastguard Worker
91*d9e8da70SAndroid Build Coastguard Worker  testOptions {
92*d9e8da70SAndroid Build Coastguard Worker    unitTests {
93*d9e8da70SAndroid Build Coastguard Worker      includeAndroidResources = true
94*d9e8da70SAndroid Build Coastguard Worker    }
95*d9e8da70SAndroid Build Coastguard Worker  }
96*d9e8da70SAndroid Build Coastguard Worker}
97