| /* |
| * 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 |
| * |
| * 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.AndroidXConfig |
| import androidx.build.KotlinTarget |
| import androidx.build.LibraryType |
| import androidx.build.PlatformIdentifier |
| import androidx.build.ProjectLayoutType |
| import org.jetbrains.kotlin.gradle.tasks.KotlinCompile |
| |
| /** |
| * 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. |
| */ |
| plugins { |
| id("AndroidXPlugin") |
| id("com.squareup.wire") |
| } |
| |
| androidXMultiplatform { |
| jvm() |
| androidLibrary { |
| namespace = "androidx.benchmark.traceprocessor" |
| withAndroidTestOnDeviceBuilder { |
| it.compilationName = "instrumentedTest" |
| it.defaultSourceSetName = "androidInstrumentedTest" |
| it.sourceSetTreeName = "test" |
| } |
| } |
| |
| defaultPlatform(PlatformIdentifier.JVM) |
| |
| sourceSets { |
| commonMain { |
| dependencies { |
| api(libs.kotlinStdlib) |
| api("androidx.annotation:annotation:1.8.1") |
| implementation(libs.wireRuntime) |
| } |
| } |
| androidMain { |
| dependsOn(commonMain) |
| } |
| } |
| } |
| |
| tasks.withType(KotlinCompile).configureEach { |
| kotlinOptions { |
| // Enable using experimental APIs from within same version group |
| freeCompilerArgs += [ |
| "-opt-in=androidx.benchmark.traceprocessor.ExperimentalTraceProcessorApi", |
| ] |
| } |
| } |
| |
| // Workarounds for Wire's plugin not setting code generation directory as task output correctly |
| // See https://github.com/square/wire/issues/3199 |
| tasks.named("multiplatformSourceJar").configure { |
| dependsOn(tasks.named("generateCommonMainProtos")) |
| } |
| afterEvaluate { |
| if (!ProjectLayoutType.isPlayground(project)) { |
| tasks.named("generateJavaKzip").configure { |
| dependsOn(tasks.named("generateCommonMainProtos")) |
| } |
| } |
| } |
| |
| wire { |
| kotlin {} |
| sourcePath { |
| srcDir AndroidXConfig.getPrebuiltsRoot(project).absolutePath + '/androidx/traceprocessor' |
| |
| // currently, all protos are at same tree depth |
| // can add further includes if this stops working |
| include 'protos/perfetto/*/*.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.AndroidPackageList' |
| prune 'perfetto.protos.AndroidPowerRails' |
| prune 'perfetto.protos.AndroidProcessMetadata' |
| prune 'perfetto.protos.AndroidRtRuntimeMetric' |
| prune 'perfetto.protos.AndroidSimpleperfMetric' |
| prune 'perfetto.protos.AndroidSurfaceflingerMetric' |
| prune 'perfetto.protos.AndroidTaskNames' |
| prune 'perfetto.protos.AndroidTraceQualityMetric' |
| 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' |
| } |
| |
| androidx { |
| name = "Benchmark TraceProcessor" |
| type = LibraryType.PUBLISHED_LIBRARY |
| inceptionYear = "2024" |
| description = "AndroidX Benchmark TraceProcessor" |
| metalavaK2UastEnabled = false |
| kotlinTarget = KotlinTarget.KOTLIN_1_9 |
| } |