/*
 * Copyright (C) 2025 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.SoftwareType

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

dependencies {
    androidTestImplementation(project(":benchmark:benchmark-junit4"))
    androidTestImplementation(project(":tracing:tracing-driver-wire"))
    androidTestImplementation(project(":tracing:tracing-ktx"))
    androidTestImplementation(project(":tracing:tracing-perfetto"))
    androidTestImplementation(project(":tracing:tracing-perfetto-binary"))
    androidTestImplementation(libs.testRunner)
    androidTestImplementation(libs.testRules)
    androidTestImplementation(libs.testExtJunit)
    androidTestImplementation(libs.junit)
    androidTestImplementation(libs.kotlinStdlib)
    androidTestImplementation(libs.kotlinTest)
    androidTestImplementation(libs.kotlinCoroutinesTest)
}

android {
    namespace = "androidx.tracing.benchmark"
    buildTypes.release {
        androidTest {
            enableMinification = false
            testProguardFiles "proguard-rules.pro"
        }
    }
}

kotlin {
    compilerOptions {
        optIn.add("androidx.tracing.driver.DelicateTracingApi")
    }
}

androidx {
    type = SoftwareType.BENCHMARK
}
