import io.getstream.sketchbook.Configuration
import io.getstream.sketchbook.Dependencies

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

android {
    compileSdkVersion Configuration.compileSdk

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

    kotlinOptions {
        jvmTarget = "11"
    }

    defaultConfig {
        minSdkVersion 23
        targetSdkVersion Configuration.targetSdk
        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 = ":benchmark-app"
    experimentalProperties["android.experimental.self-instrumenting"] = true
}

dependencies {
    implementation Dependencies.ANDROIDX_TEST_RUNNER
    implementation Dependencies.MACRO_BENCHMARK
    implementation Dependencies.BASE_PROFILE
    implementation Dependencies.ANDROIDX_UI_AUTOMATOR
}

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

apply from: "$rootDir/spotless.gradle"