import com.vanniktech.maven.publish.AndroidMultiVariantLibrary

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'org.jetbrains.kotlin.plugin.compose'
apply plugin: 'com.vanniktech.maven.publish'

android {
    namespace "com.airbnb.android.showkase.screenshot.testing"
    // Added to avoid this error -
    // Execution failed for task ':showkase-processor-testing:mergeDebugAndroidTestJavaResource'.
    // > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
    // > More than one file was found with OS independent path 'META-INF/gradle/incremental.annotation.processors'
    packagingOptions {
        exclude 'META-INF/gradle/incremental.annotation.processors'
        exclude("META-INF/*.kotlin_module")
    }
    defaultConfig {
        minSdkVersion 21
        compileSdk 36
        targetSdkVersion 33
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        // The following argument makes the Android Test Orchestrator run its
        // "pm clear" command after each test invocation. This command ensures
        // that the app's state is completely cleared between tests.
        testInstrumentationRunnerArguments clearPackageData: 'true'
    }
    buildFeatures {
        compose true
    }
    // Added to avoid this error -
    // Execution failed for task ':app:mergeDebugAndroidTestJavaResource'.
    // > A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
    // > 2 files found with path 'META-INF/AL2.0' from inputs:
    packagingOptions {
        exclude 'META-INF/AL2.0'
        exclude 'META-INF/LGPL2.1'
    }
}

kotlin {
    jvmToolchain(17)
}

dependencies {
    // Showkase
    api project(':showkase')
    api deps.compose.uiTest
    implementation deps.compose.core
    implementation deps.compose.foundation

    // Testing
    testImplementation deps.test.assertJ
    testImplementation deps.test.googleTruth
    api deps.test.junit
    api deps.test.androidXTestCore
    api deps.test.androidXTestRules
    api deps.test.androidxTestRunner
}

mavenPublishing {
    configure(new AndroidMultiVariantLibrary(true, true))
}
