Rahul Ravikumar | 105c68c | 2020-09-14 15:13:44 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2020 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Tiem Song | ee0da74 | 2024-01-03 14:08:46 -0800 | [diff] [blame] | 17 | /** |
| 18 | * This file was created using the `create_project.py` script located in the |
| 19 | * `<AndroidX root>/development/project-creator` directory. |
| 20 | * |
| 21 | * Please use that script when creating a new project, rather than copying an existing project and |
| 22 | * modifying its settings. |
| 23 | */ |
Omar Ismail | 8c545f7 | 2024-08-21 17:45:15 +0100 | [diff] [blame] | 24 | |
| 25 | import androidx.build.KotlinTarget |
Omar Ismail | 86e6606 | 2024-05-03 16:10:50 +0100 | [diff] [blame] | 26 | import androidx.build.LibraryType |
Alan Viverette | 7ef42b6 | 2023-06-26 11:04:08 -0400 | [diff] [blame] | 27 | import androidx.build.AndroidXConfig |
Rahul Ravikumar | 6da9b7f27 | 2021-10-20 13:52:42 -0700 | [diff] [blame] | 28 | import org.jetbrains.kotlin.gradle.tasks.KotlinCompile |
Rahul Ravikumar | 105c68c | 2020-09-14 15:13:44 -0700 | [diff] [blame] | 29 | |
| 30 | plugins { |
| 31 | id("AndroidXPlugin") |
| 32 | id("com.android.library") |
| 33 | id("kotlin-android") |
| 34 | } |
| 35 | |
| 36 | android { |
| 37 | defaultConfig { |
Aurimas Liutikas | 7795282 | 2024-12-04 18:00:17 -0800 | [diff] [blame] | 38 | minSdk = 23 |
Chris Craik | 695d64d | 2024-10-11 11:00:51 -0700 | [diff] [blame] | 39 | |
| 40 | // We don't care about perf from these correctness tests, so suppress |
| 41 | // anything that may otherwise block these tests |
| 42 | testInstrumentationRunnerArguments["androidx.benchmark.suppressErrors"] = |
| 43 | "CODE-COVERAGE,DEBUGGABLE,EMULATOR,LOW-BATTERY,UNLOCKED" |
Chris Craik | fbfc721 | 2021-01-27 11:54:18 -0800 | [diff] [blame] | 44 | } |
| 45 | sourceSets { |
Chris Craik | 266c4e0 | 2021-02-02 17:13:44 +0000 | [diff] [blame] | 46 | main.assets.srcDirs += new File( |
Alan Viverette | 7ef42b6 | 2023-06-26 11:04:08 -0400 | [diff] [blame] | 47 | AndroidXConfig.getPrebuiltsRoot(project), |
Chris Craik | 266c4e0 | 2021-02-02 17:13:44 +0000 | [diff] [blame] | 48 | "androidx/traceprocessor/trace_processor_shell" |
| 49 | ) |
Chris Craik | f7ea263 | 2021-04-08 16:36:43 -0700 | [diff] [blame] | 50 | androidTest.assets.srcDirs += new File( |
Alan Viverette | 7ef42b6 | 2023-06-26 11:04:08 -0400 | [diff] [blame] | 51 | AndroidXConfig.getPrebuiltsRoot(project), |
Chris Craik | f7ea263 | 2021-04-08 16:36:43 -0700 | [diff] [blame] | 52 | "androidx/traceprocessor/testdata" |
| 53 | ) |
Jakub Gielzak | 6fb1f92 | 2022-09-26 19:07:53 +0100 | [diff] [blame] | 54 | // PerfettoHandshake supports both AAR and APK as libtracing_perfetto.so sources: |
| 55 | // - AAR is used when e.g. tooling downloads tracing-perfetto-binary AAR files from Maven |
| 56 | // - APK is when an APK that contains tracing binaries is used |
| 57 | // |
| 58 | // Adding the AAR as a test asset below allows us to test the AAR scenario |
Jakub Gielzak | a51a896 | 2022-06-21 13:36:49 +0100 | [diff] [blame] | 59 | androidTest.assets.srcDirs += new File( |
Alan Viverette | 7ef42b6 | 2023-06-26 11:04:08 -0400 | [diff] [blame] | 60 | AndroidXConfig.getPrebuiltsRoot(project), |
Jakub Gielzak | c2d9563 | 2022-08-15 16:00:14 +0100 | [diff] [blame] | 61 | "androidx/internal/androidx/tracing/tracing-perfetto-binary/" + |
| 62 | "${androidx.LibraryVersions.TRACING_PERFETTO}" |
Jakub Gielzak | a51a896 | 2022-06-21 13:36:49 +0100 | [diff] [blame] | 63 | ) |
Rahul Ravikumar | 105c68c | 2020-09-14 15:13:44 -0700 | [diff] [blame] | 64 | } |
Jakub Gielzak | 2abe558 | 2022-03-02 17:53:14 +0000 | [diff] [blame] | 65 | |
Aurimas Liutikas | 7795282 | 2024-12-04 18:00:17 -0800 | [diff] [blame] | 66 | namespace = "androidx.benchmark.macro" |
Rahul Ravikumar | 105c68c | 2020-09-14 15:13:44 -0700 | [diff] [blame] | 67 | } |
| 68 | |
| 69 | dependencies { |
Julia McClellan | 4e64197 | 2024-11-20 13:47:51 -0500 | [diff] [blame] | 70 | api(libs.jspecify) |
Chris Craik | 00346a8 | 2024-05-21 13:32:20 -0700 | [diff] [blame] | 71 | api(project(":benchmark:benchmark-common")) |
Aurimas Liutikas | 2c1a81e | 2021-05-24 16:43:05 -0700 | [diff] [blame] | 72 | api(libs.junit) |
| 73 | api(libs.kotlinStdlib) |
Aurimas Liutikas | 96f0b30 | 2024-07-25 15:49:23 -0700 | [diff] [blame] | 74 | api("androidx.annotation:annotation:1.8.1") |
Chris Craik | eba03a5 | 2020-11-16 09:43:49 -0800 | [diff] [blame] | 75 | |
Chris Craik | 89b4c45 | 2023-02-08 13:41:13 -0800 | [diff] [blame] | 76 | implementation("androidx.core:core:1.9.0") |
Prajakta Patil | 375e768 | 2024-09-24 15:56:11 +0000 | [diff] [blame] | 77 | implementation("androidx.profileinstaller:profileinstaller:1.4.1") |
Aurimas Liutikas | d02fb06 | 2023-11-10 17:18:40 -0800 | [diff] [blame] | 78 | implementation("androidx.tracing:tracing-ktx:1.1.0") |
Chris Craik | 0da65ce | 2024-02-02 15:16:34 -0800 | [diff] [blame] | 79 | implementation("androidx.tracing:tracing-perfetto:1.0.0") |
| 80 | implementation("androidx.tracing:tracing-perfetto-binary:1.0.0") |
| 81 | implementation("androidx.tracing:tracing-perfetto-handshake:1.0.0") |
Jakub Gielzak | 2b57ade | 2023-07-13 18:53:42 +0100 | [diff] [blame] | 82 | implementation("androidx.test:core:1.5.0") |
Aurimas Liutikas | 2c1a81e | 2021-05-24 16:43:05 -0700 | [diff] [blame] | 83 | implementation(libs.testUiautomator) |
Marcello Albano | eeae753 | 2022-08-23 11:41:07 -0700 | [diff] [blame] | 84 | implementation(libs.wireRuntime) |
Marcello Albano | 0c2ddcd | 2024-08-13 15:44:14 -0700 | [diff] [blame] | 85 | implementation(libs.testExtJunit) |
Chris Craik | fbfc721 | 2021-01-27 11:54:18 -0800 | [diff] [blame] | 86 | |
Chris Craik | 3dbcaa9 | 2022-11-04 12:44:13 -0700 | [diff] [blame] | 87 | androidTestImplementation(project(":benchmark:benchmark-junit4")) |
Chris Craik | fbfc721 | 2021-01-27 11:54:18 -0800 | [diff] [blame] | 88 | androidTestImplementation(project(":internal-testutils-ktx")) |
Ian Lake | 6b595b5 | 2021-08-25 22:09:26 -0700 | [diff] [blame] | 89 | androidTestImplementation("androidx.activity:activity-ktx:1.3.1") |
Jakub Gielzak | ab40c14 | 2022-11-23 15:44:36 +0000 | [diff] [blame] | 90 | androidTestImplementation(project(":tracing:tracing-perfetto")) |
Aurimas Liutikas | 2c1a81e | 2021-05-24 16:43:05 -0700 | [diff] [blame] | 91 | androidTestImplementation(libs.testExtJunit) |
| 92 | androidTestImplementation(libs.testRules) |
| 93 | androidTestImplementation(libs.testRunner) |
| 94 | androidTestImplementation(libs.kotlinTest) |
Jakub Gielzak | 2abe558 | 2022-03-02 17:53:14 +0000 | [diff] [blame] | 95 | androidTestImplementation(libs.truth) |
Rahul Ravikumar | 105c68c | 2020-09-14 15:13:44 -0700 | [diff] [blame] | 96 | } |
| 97 | |
| 98 | androidx { |
Alan Viverette | c9e1fd7 | 2023-05-08 17:36:59 -0400 | [diff] [blame] | 99 | name = "Benchmark - Macrobenchmark" |
Omar Ismail | 86e6606 | 2024-05-03 16:10:50 +0100 | [diff] [blame] | 100 | type = LibraryType.PUBLISHED_LIBRARY |
Rahul Ravikumar | 105c68c | 2020-09-14 15:13:44 -0700 | [diff] [blame] | 101 | inceptionYear = "2020" |
| 102 | description = "Android Benchmark - Macrobenchmark" |
Aurimas Liutikas | 5c5419a | 2024-05-29 15:26:58 -0700 | [diff] [blame] | 103 | legacyDisableKotlinStrictApiMode = true |
Aurimas Liutikas | 962925f | 2024-09-11 11:14:37 -0700 | [diff] [blame] | 104 | deviceTests { |
| 105 | enableAlsoRunningOnPhysicalDevices = true |
| 106 | } |
Rahul Ravikumar | 105c68c | 2020-09-14 15:13:44 -0700 | [diff] [blame] | 107 | } |
Marcello Albano | eeae753 | 2022-08-23 11:41:07 -0700 | [diff] [blame] | 108 | |
Marcello Albano | eeae753 | 2022-08-23 11:41:07 -0700 | [diff] [blame] | 109 | tasks.withType(KotlinCompile).configureEach { |
| 110 | kotlinOptions { |
Chris Craik | 80d9e8a | 2023-02-20 10:06:57 -0800 | [diff] [blame] | 111 | // Enable using experimental APIs from within same version group |
| 112 | freeCompilerArgs += [ |
Jakub Gielzak | d072809 | 2024-09-23 15:47:25 +0100 | [diff] [blame] | 113 | "-opt-in=androidx.benchmark.ExperimentalBenchmarkConfigApi", |
Chris Craik | a1afb0d | 2023-03-09 16:43:42 -0800 | [diff] [blame] | 114 | "-opt-in=androidx.benchmark.macro.ExperimentalMetricApi", |
Jakub Gielzak | d072809 | 2024-09-23 15:47:25 +0100 | [diff] [blame] | 115 | "-opt-in=androidx.benchmark.perfetto.ExperimentalPerfettoCaptureApi", |
Chris Craik | a13168a | 2024-12-12 09:48:11 -0800 | [diff] [blame] | 116 | "-opt-in=androidx.benchmark.traceprocessor.ExperimentalTraceProcessorApi", |
Chris Craik | 80d9e8a | 2023-02-20 10:06:57 -0800 | [diff] [blame] | 117 | ] |
Marcello Albano | eeae753 | 2022-08-23 11:41:07 -0700 | [diff] [blame] | 118 | } |
| 119 | } |
| 120 | |
Marcello Albano | 6a8f686 | 2022-10-27 12:59:16 -0700 | [diff] [blame] | 121 | // Define a task dependency so the app is installed before we run macro benchmarks. |
| 122 | afterEvaluate { |
| 123 | // `:benchmark:integration-tests:macrobenchmark-target:installRelease` is not in the compose |
| 124 | // build, so it may fail the compose build job. |
| 125 | def installTask = tasks.findByPath( |
| 126 | ":benchmark:integration-tests:macrobenchmark-target:installRelease") |
| 127 | if (installTask != null) { |
Aurimas Liutikas | 289bb90 | 2024-08-15 15:34:13 -0700 | [diff] [blame] | 128 | tasks.getByPath(":benchmark:benchmark-macro:connectedReleaseAndroidTest") |
Marcello Albano | 6a8f686 | 2022-10-27 12:59:16 -0700 | [diff] [blame] | 129 | .dependsOn(installTask) |
| 130 | } |
| 131 | } |
Yigit Boyar | 129f6da | 2023-05-05 10:09:07 -0700 | [diff] [blame] | 132 | |
| 133 | androidx { |
| 134 | deviceTests { |
| 135 | targetAppProject = project(":benchmark:integration-tests:macrobenchmark-target") |
| 136 | targetAppVariant = "release" |
| 137 | } |
Omar Ismail | 8c545f7 | 2024-08-21 17:45:15 +0100 | [diff] [blame] | 138 | kotlinTarget = KotlinTarget.KOTLIN_1_9 |
Jakub Gielzak | 5b090bf | 2023-06-14 20:08:33 +0100 | [diff] [blame] | 139 | } |