plugins {
    id("com.android.library")
    kotlin("android")
    kotlin("kapt")
}


android {
    compileSdk = Version.compileSdk

    defaultConfig {
        minSdk = Version.minSdk
        targetSdk = Version.targetSdk

        consumerProguardFiles("consumer-rules.pro")
    }

    buildTypes {
        getByName("release") {
            isMinifyEnabled = false
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }

    compileOptions {

        targetCompatibility(JavaVersion.VERSION_17)
        sourceCompatibility(JavaVersion.VERSION_17)
    }

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_17.toString()
        freeCompilerArgs = freeCompilerArgs + listOf("-module-name", "viewbinding-base-ktx")
    }

    buildFeatures {
        dataBinding = true
        viewBinding = true
    }
    namespace = "com.dylanc.viewbinding.base"

    configurations.all {
        resolutionStrategy {
            eachDependency {
                when (requested.group) {
                    "androidx.lifecycle" -> {
                        useVersion("2.6.1")
                    }

                    "androidx.appcompat" -> {
                        if (requested.name == "appcompat") {
                            useVersion("1.4.2")
                        }
                    }
                }
            }
        }
    }
}

dependencies {
    compileOnly(Deps.material)
    compileOnly(Deps.lifecycleJava8)
}