import static de.fayard.refreshVersions.core.Versions.versionFor
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

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

tasks.withType(KotlinCompile).all {
    kotlinOptions {
        freeCompilerArgs += [
                '-opt-in=kotlin.RequiresOptIn',
                '-opt-in=com.airbnb.mvrx.InternalMavericksApi',
        ]
    }
}

android {
    resourcePrefix "mvrx_"

    defaultConfig {
        minSdkVersion 21
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    packagingOptions {
        resources {
            excludes += ['META-INF/LGPL2.1', 'META-INF/AL2.0']
        }
    }


    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
        allWarningsAsErrors = true
    }

    buildFeatures {
        compose true
    }

    composeOptions {
        kotlinCompilerExtensionVersion versionFor("version.androidx.compose.compiler")
    }

    testOptions {
        unitTests {
            includeAndroidResources = true
        }
    }
    namespace 'com.airbnb.mvrx.compose'
}

dependencies {
    api project(":mvrx")
    implementation libs.lifecycleCommon
    implementation libs.fragment
    implementation libs.appcompat
    implementation libs.composeFoundation
    implementation libs.composeUi
    implementation libs.viewModelCompose
    implementation libs.runtimeCompose
    debugImplementation libs.composeUiTestManifest

    testImplementation project(':mvrx-testing')
    testImplementation libs.junit
    testImplementation libs.activityCompose
    testImplementation libs.composeTest
    testImplementation libs.composeMaterial
    testImplementation libs.roboeletric
}
