apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply from: "$rootDir/build-systems/muvi-unit-test-config.gradle"

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.2"

    defaultConfig {
        minSdkVersion 19
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"
        applicationId "com.andriiginting.muvi"
        multiDexEnabled true

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        consumerProguardFiles "consumer-rules.pro"
    }

    buildTypes {
        debug {
            buildConfigField("String", "API_KEY", movieApiKey)
            buildConfigField("String", "HOST_BASE_URL", movieApiURL)
            buildConfigField("String", "IMAGE_BASE_URL", movieImageUrl)
            applicationIdSuffix ".debug"
        }

        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions.incremental = false

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
        test.java.srcDirs += 'src/test/kotlin'
        androidTest.java.srcDirs += 'src/androidTest/kotlin'
    }
    android.dynamicFeatures = [':favorite']
}

repositories {
    mavenCentral()
    google()
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation libraries.multidex
    implementation project(":common-di")
    implementation project(":common-database")
    implementation project(":core-network")
    implementation project(":home")
    implementation project(":detail")
    implementation project(":search")
    implementation libraries.dagger
    kapt libraries.daggerCompiler
    implementation libraries.lottie
    implementation libraries.stetho

    implementation libraries.deeplinkDispatch
    kapt libraries.deeplinkDispatchProcessor

    implementation libraries.kotlinCore
    implementation supportDependencies.constraintLayout
    implementation supportDependencies.appCompat
    debugImplementation libraries.leakCanary
}