plugins {
    id 'com.android.test'
    id 'org.jetbrains.kotlin.android'
}

android {
    namespace 'com.example.motionlayout.benchmark'
    compileSdk compile_target_sdk_version

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = "1.8"
    }

    defaultConfig {
        minSdk 29
        targetSdk compile_target_sdk_version

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        // This benchmark buildType is used for benchmarking, and should function like your
        // release build (for example, with minification on). It's signed with a debug key
        // for easy local/CI testing.
        benchmark {
            debuggable = true
            signingConfig = debug.signingConfig
            matchingFallbacks = ["release"]
        }
    }

    targetProjectPath = ":macrobenchmark-app"
    experimentalProperties["android.experimental.self-instrumenting"] = true
}

dependencies {
    implementation 'androidx.test.ext:junit:1.1.3'
    implementation 'androidx.test.espresso:espresso-core:3.4.0'
    implementation 'androidx.test.uiautomator:uiautomator:2.2.0'
    implementation 'androidx.benchmark:benchmark-macro-junit4:1.1.0'
}

androidComponents {
    beforeVariants(selector().all()) {
        enabled = buildType == "benchmark"
    }
}