/*
 * Copyright (C) 2018 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.LibraryType

plugins {
    id("AndroidXPlugin")
    id("com.android.library")
    id("kotlin-android")
    id("androidx.benchmark")
}

dependencies {
    androidTestImplementation("androidx.appcompat:appcompat:1.1.0")
    androidTestImplementation(project(":benchmark:benchmark-junit4"))
    androidTestImplementation(project(":metrics:metrics-performance"))
    androidTestImplementation(libs.junit)
    androidTestImplementation(libs.testExtJunit)
    androidTestImplementation(libs.testCore)
    androidTestImplementation(libs.testRunner)
    androidTestImplementation(libs.testRules)
}

android {
    compileSdk = 35
    namespace = "androidx.metrics.performance.benchmark"
    defaultConfig {
        // Enable measuring on an emulator, devices with low battery, and eng builds
        // We are only concerned with allocations in this benchmark, so runtime performance
        // problems with these configurations are not relevant
        testInstrumentationRunnerArguments["androidx.benchmark.suppressErrors"] =
                "UNLOCKED,EMULATOR,LOW-BATTERY,ENG-BUILD"
    }
}

androidx {
    type = LibraryType.BENCHMARK
}
