-
Notifications
You must be signed in to change notification settings - Fork 611
/
build.gradle.kts
81 lines (68 loc) · 2.93 KB
/
build.gradle.kts
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
72
73
74
75
76
77
78
79
80
81
/*
* Copyright 2024 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import com.android.build.api.dsl.ManagedVirtualDevice
plugins {
alias(libs.plugins.androidTest)
alias(libs.plugins.org.jetbrains.kotlin.android)
alias(libs.plugins.androidx.baselineprofile)
}
android {
namespace = "com.compose.performance.measure"
compileSdk = 34
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}
defaultConfig {
minSdk = 27
targetSdk = 34
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
// While this codelab allows you to run benchmarks on an Android emulator for convenience,
// please be aware that for accurate performance measurements, you should always use
// a physical device. An emulator's simulated environment can significantly differ from
// real-world hardware, potentially skewing your results.
testInstrumentationRunnerArguments["androidx.benchmark.suppressErrors"] = "EMULATOR"
// Enables composition tracing from Macrobenchmarks.
// It's helpful for analysing what takes the longest during composition,
// but it might slightly affect performance in your app, but in a linear way (everything is slowed down the same).
// If you want to measure performance as close as to your production app, consider not using for that case.
// TODO Codelab task: Add androidx.benchmark.fullTracing.enable argument to enable Composition Tracing for benchmarks
}
targetProjectPath = ":app"
testOptions.managedDevices.devices {
create<ManagedVirtualDevice>("pixel6Api33") {
device = "Pixel 6"
apiLevel = 33
systemImageSource = "aosp"
}
}
}
// This is the configuration block for the Baseline Profile plugin.
// You can specify to run the generators on a managed devices or connected devices.
baselineProfile {
managedDevices += "pixel6Api33"
useConnectedDevices = false
}
dependencies {
implementation(libs.androidx.test.ext.junit)
implementation(libs.espresso.core)
implementation(libs.uiautomator)
implementation(libs.benchmark.macro.junit4)
// TODO Codelab task: Add tracing-perfetto(-binary) dependencies to enable Composition Tracing
}