/*
 * Copyright 2021 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 org.jetbrains.kotlin.gradle.tasks.KotlinCompile

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

dependencies {
    api("androidx.activity:activity:1.2.0")
    api(project(":compose:test-utils"))
    api(projectOrArtifact(":benchmark:benchmark-junit4"))

    implementation(libs.kotlinStdlibCommon)
    implementation(project(":compose:runtime:runtime"))
    implementation(project(":compose:ui:ui"))
    implementation(project(":tracing:tracing-ktx"))
    implementation(libs.testRules)

    // This has stub APIs for access to legacy Android APIs, so we don't want
    // any dependency on this module.
    compileOnly(project(":compose:ui:ui-android-stubs"))
}

tasks.withType(KotlinCompile).configureEach {
    it.kotlinOptions {
        freeCompilerArgs += [
                // Enable experimental benchmark APIs internally
                "-opt-in=androidx.benchmark.ExperimentalBenchmarkConfigApi",
        ]
    }
}

android {
    compileSdk = 35
    namespace = "androidx.compose.benchmarkutils"

    // workarounds for b/328649293
    buildTypes.configureEach {
        consumerProguardFiles "proguard-rules.pro"
    }
}
