blob: b7e428e3acc138f962cb3a08dd61bf6a19e25ae6 [file] [log] [blame]
/*
* 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.Publish
import androidx.build.AndroidXConfig
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("AndroidXPlugin")
id("com.android.library")
id("kotlin-android")
id("com.squareup.wire")
}
android {
defaultConfig {
minSdkVersion 23
}
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.junit)
api(libs.kotlinStdlib)
api("androidx.annotation:annotation:1.1.0")
implementation(project(":benchmark:benchmark-common"))
implementation("androidx.core:core:1.9.0")
implementation("androidx.profileinstaller:profileinstaller:1.3.0")
implementation("androidx.tracing:tracing-ktx:1.1.0")
implementation("androidx.test:core:1.5.0")
implementation(libs.testUiautomator)
implementation(libs.wireRuntime)
androidTestImplementation(project(":benchmark:benchmark-junit4"))
androidTestImplementation(project(":internal-testutils-ktx"))
androidTestImplementation("androidx.activity:activity-ktx:1.3.1")
androidTestImplementation(project(":tracing:tracing-perfetto"))
implementation(project(":tracing:tracing-perfetto"))
implementation(project(":tracing:tracing-perfetto-binary"))
implementation(project(":tracing:tracing-perfetto-handshake"))
androidTestImplementation(libs.testExtJunit)
androidTestImplementation(libs.testRules)
androidTestImplementation(libs.testRunner)
androidTestImplementation(libs.kotlinTest)
androidTestImplementation(libs.truth)
}
androidx {
name = "Benchmark - Macrobenchmark"
publish = Publish.SNAPSHOT_AND_RELEASE
inceptionYear = "2020"
description = "Android Benchmark - Macrobenchmark"
metalavaK2UastEnabled = true
}
tasks.withType(KotlinCompile).configureEach {
kotlinOptions {
// Enable using experimental APIs from within same version group
freeCompilerArgs += [
"-opt-in=androidx.benchmark.macro.ExperimentalMetricApi",
"-opt-in=androidx.benchmark.perfetto.ExperimentalPerfettoTraceProcessorApi",
"-opt-in=androidx.benchmark.perfetto.ExperimentalPerfettoCaptureApi"
]
}
}
wire {
kotlin {}
sourcePath {
srcDir 'src/main/proto'
include '*.proto'
}
prune 'perfetto.protos.AndroidBatteryMetric'
prune 'perfetto.protos.AndroidBinderMetric'
prune 'perfetto.protos.AndroidCameraMetric'
prune 'perfetto.protos.AndroidCameraUnaggregatedMetric'
prune 'perfetto.protos.AndroidCpuMetric'
prune 'perfetto.protos.AndroidDisplayMetrics'
prune 'perfetto.protos.AndroidDmaHeapMetric'
prune 'perfetto.protos.AndroidDvfsMetric'
prune 'perfetto.protos.AndroidFastrpcMetric'
prune 'perfetto.protos.AndroidFrameTimelineMetric'
prune 'perfetto.protos.AndroidGpuMetric'
prune 'perfetto.protos.AndroidHwcomposerMetrics'
prune 'perfetto.protos.AndroidHwuiMetric'
prune 'perfetto.protos.AndroidIonMetric'
prune 'perfetto.protos.AndroidIrqRuntimeMetric'
prune 'perfetto.protos.AndroidJankCujMetric'
prune 'perfetto.protos.AndroidLmkMetric'
prune 'perfetto.protos.AndroidLmkReasonMetric'
prune 'perfetto.protos.AndroidMemoryMetric'
prune 'perfetto.protos.AndroidMemoryUnaggregatedMetric'
prune 'perfetto.protos.AndroidMultiuserMetric'
prune 'perfetto.protos.AndroidNetworkMetric'
prune 'perfetto.protos.AndroidOtherTracesMetric'
prune 'perfetto.protos.AndroidPackageList'
prune 'perfetto.protos.AndroidPowerRails'
prune 'perfetto.protos.AndroidProcessMetadata'
prune 'perfetto.protos.AndroidRtRuntimeMetric'
prune 'perfetto.protos.AndroidSimpleperfMetric'
prune 'perfetto.protos.AndroidSurfaceflingerMetric'
prune 'perfetto.protos.AndroidSysUiCujMetrics'
prune 'perfetto.protos.AndroidTaskNames'
prune 'perfetto.protos.AndroidTraceQualityMetric'
prune 'perfetto.protos.AndroidTrustyWorkqueues'
prune 'perfetto.protos.G2dMetrics'
prune 'perfetto.protos.JavaHeapHistogram'
prune 'perfetto.protos.JavaHeapStats'
prune 'perfetto.protos.ProcessRenderInfo'
prune 'perfetto.protos.ProfilerSmaps'
prune 'perfetto.protos.TraceAnalysisStats'
prune 'perfetto.protos.TraceMetadata'
prune 'perfetto.protos.UnsymbolizedFrames'
}
// 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:connectedDebugAndroidTest")
.dependsOn(installTask)
}
}
androidx {
deviceTests {
targetAppProject = project(":benchmark:integration-tests:macrobenchmark-target")
targetAppVariant = "release"
}
}