| /* |
| * Copyright (C) 2020 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 |
| * |
| * http://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. |
| */ |
| |
| /** |
| * This file was created using the `create_project.py` script located in the |
| * `<AndroidX root>/development/project-creator` directory. |
| * |
| * Please use that script when creating a new project, rather than copying an existing project and |
| * modifying its settings. |
| */ |
| |
| import androidx.build.KotlinTarget |
| import androidx.build.LibraryType |
| import androidx.build.AndroidXConfig |
| import org.jetbrains.kotlin.gradle.tasks.KotlinCompile |
| |
| plugins { |
| id("AndroidXPlugin") |
| id("com.android.library") |
| id("kotlin-android") |
| } |
| |
| android { |
| defaultConfig { |
| minSdk = 23 |
| |
| // We don't care about perf from these correctness tests, so suppress |
| // anything that may otherwise block these tests |
| testInstrumentationRunnerArguments["androidx.benchmark.suppressErrors"] = |
| "CODE-COVERAGE,DEBUGGABLE,EMULATOR,LOW-BATTERY,UNLOCKED" |
| } |
| sourceSets { |
| main.assets.srcDirs += new File( |
| AndroidXConfig.getPrebuiltsRoot(project), |
| "androidx/traceprocessor/trace_processor_shell" |
| ) |
| androidTest.assets.srcDirs += new File( |
| AndroidXConfig.getPrebuiltsRoot(project), |
| "androidx/traceprocessor/testdata" |
| ) |
| // PerfettoHandshake supports both AAR and APK as libtracing_perfetto.so sources: |
| // - AAR is used when e.g. tooling downloads tracing-perfetto-binary AAR files from Maven |
| // - APK is when an APK that contains tracing binaries is used |
| // |
| // Adding the AAR as a test asset below allows us to test the AAR scenario |
| androidTest.assets.srcDirs += new File( |
| AndroidXConfig.getPrebuiltsRoot(project), |
| "androidx/internal/androidx/tracing/tracing-perfetto-binary/" + |
| "${androidx.LibraryVersions.TRACING_PERFETTO}" |
| ) |
| } |
| |
| namespace = "androidx.benchmark.macro" |
| } |
| |
| dependencies { |
| api(libs.jspecify) |
| api(project(":benchmark:benchmark-common")) |
| api(libs.junit) |
| api(libs.kotlinStdlib) |
| api("androidx.annotation:annotation:1.8.1") |
| |
| implementation("androidx.core:core:1.9.0") |
| implementation("androidx.profileinstaller:profileinstaller:1.4.1") |
| implementation("androidx.tracing:tracing-ktx:1.1.0") |
| implementation("androidx.tracing:tracing-perfetto:1.0.0") |
| implementation("androidx.tracing:tracing-perfetto-binary:1.0.0") |
| implementation("androidx.tracing:tracing-perfetto-handshake:1.0.0") |
| implementation("androidx.test:core:1.5.0") |
| implementation(libs.testUiautomator) |
| implementation(libs.wireRuntime) |
| implementation(libs.testExtJunit) |
| |
| androidTestImplementation(project(":benchmark:benchmark-junit4")) |
| androidTestImplementation(project(":internal-testutils-ktx")) |
| androidTestImplementation("androidx.activity:activity-ktx:1.3.1") |
| androidTestImplementation(project(":tracing:tracing-perfetto")) |
| androidTestImplementation(libs.testExtJunit) |
| androidTestImplementation(libs.testRules) |
| androidTestImplementation(libs.testRunner) |
| androidTestImplementation(libs.kotlinTest) |
| androidTestImplementation(libs.truth) |
| } |
| |
| androidx { |
| name = "Benchmark - Macrobenchmark" |
| type = LibraryType.PUBLISHED_LIBRARY |
| inceptionYear = "2020" |
| description = "Android Benchmark - Macrobenchmark" |
| legacyDisableKotlinStrictApiMode = true |
| deviceTests { |
| enableAlsoRunningOnPhysicalDevices = true |
| } |
| } |
| |
| tasks.withType(KotlinCompile).configureEach { |
| kotlinOptions { |
| // Enable using experimental APIs from within same version group |
| freeCompilerArgs += [ |
| "-opt-in=androidx.benchmark.ExperimentalBenchmarkConfigApi", |
| "-opt-in=androidx.benchmark.macro.ExperimentalMetricApi", |
| "-opt-in=androidx.benchmark.perfetto.ExperimentalPerfettoCaptureApi", |
| "-opt-in=androidx.benchmark.traceprocessor.ExperimentalTraceProcessorApi", |
| ] |
| } |
| } |
| |
| // Define a task dependency so the app is installed before we run macro benchmarks. |
| afterEvaluate { |
| // `:benchmark:integration-tests:macrobenchmark-target:installRelease` is not in the compose |
| // build, so it may fail the compose build job. |
| def installTask = tasks.findByPath( |
| ":benchmark:integration-tests:macrobenchmark-target:installRelease") |
| if (installTask != null) { |
| tasks.getByPath(":benchmark:benchmark-macro:connectedReleaseAndroidTest") |
| .dependsOn(installTask) |
| } |
| } |
| |
| androidx { |
| deviceTests { |
| targetAppProject = project(":benchmark:integration-tests:macrobenchmark-target") |
| targetAppVariant = "release" |
| } |
| kotlinTarget = KotlinTarget.KOTLIN_1_9 |
| } |