/
build.gradle
71 lines (63 loc) · 2.27 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
plugins {
id 'com.android.test'
id 'kotlin-android'
}
// [START macrobenchmark_setup_android]
android {
// [START_EXCLUDE]
compileSdk rootProject.compileSdkVersion
namespace 'com.example.macrobenchmark'
defaultConfig {
minSdk 23 // Macrobenchmark doesn't work with SDK lower than 23
targetSdk rootProject.targetSdkVersion
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
// [END_EXCLUDE]
// Note that your module name may have different name
targetProjectPath = ":app"
// Enable the benchmark to run separately from the app process
experimentalProperties["android.experimental.self-instrumenting"] = true
buildTypes {
// declare a build type to match the target app's build type
benchmark {
debuggable = true
signingConfig = debug.signingConfig
// [START_EXCLUDE silent]
// Selects release buildType if the benchmark buildType not available in other modules.
matchingFallbacks = ['release']
// [END_EXCLUDE]
}
}
}
// [END macrobenchmark_setup_android]
// [START macrobenchmark_setup_variant]
androidComponents {
beforeVariants(selector().all()) {
// enable only the benchmark buildType, since we only want to measure close to release performance
enabled = buildType == 'benchmark'
}
}
// [END macrobenchmark_setup_variant]
// [START macrobenchmark_setup_dependencies]
dependencies {
// [START_EXCLUDE]
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
implementation "androidx.test.ext:junit:$testExtVersion"
implementation "androidx.test.espresso:espresso-core:$espressoCoreVersion"
implementation "androidx.test.uiautomator:uiautomator:$uiAutomatorVersion"
// [END_EXCLUDE]
implementation "androidx.benchmark:benchmark-macro-junit4:$benchmarkVersion"
}
// [END macrobenchmark_setup_dependencies]
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
}
}