| /* |
| * 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. |
| */ |
| |
| import androidx.build.Publish |
| import androidx.build.SupportConfigKt |
| 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( |
| SupportConfigKt.getPrebuiltsRoot(project), |
| "androidx/traceprocessor/trace_processor_shell" |
| ) |
| androidTest.assets.srcDirs += new File( |
| SupportConfigKt.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( |
| SupportConfigKt.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.profileinstaller:profileinstaller:1.0.3") |
| implementation("androidx.tracing:tracing-ktx:1.1.0-rc01") |
| implementation(libs.testCore) |
| 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")) |
| androidTestImplementation(project(":tracing:tracing-perfetto-common")) |
| androidTestImplementation(project(":tracing:tracing-perfetto-binary")) |
| androidTestImplementation(libs.testExtJunit) |
| androidTestImplementation(libs.testRules) |
| androidTestImplementation(libs.testRunner) |
| androidTestImplementation(libs.kotlinTest) |
| androidTestImplementation(libs.truth) |
| } |
| |
| androidx { |
| name = "Android Benchmark - Macrobenchmark" |
| publish = Publish.SNAPSHOT_AND_RELEASE |
| inceptionYear = "2020" |
| description = "Android Benchmark - Macrobenchmark" |
| } |
| |
| // Allow usage of Kotlin's @OptIn. |
| tasks.withType(KotlinCompile).configureEach { |
| kotlinOptions { |
| freeCompilerArgs += ['-opt-in=kotlin.RequiresOptIn'] |
| } |
| } |
| |
| 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' |
| } |
| |
| // https://github.com/square/wire/issues/1947 |
| // Remove when we upgrade to fixed wire library |
| afterEvaluate { |
| tasks.named("compileReleaseKotlin").configure { |
| it.dependsOn("generateDebugProtos") |
| } |
| tasks.named("compileDebugKotlin").configure { |
| it.dependsOn("generateReleaseProtos") |
| } |
| } |
| |
| // 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) |
| } |
| } |