apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-parcelize'

android {

    namespace "com.doctoror.fuckoffmusicplayer"

    def globalConfiguration = rootProject.extensions.getByName("ext")

    compileSdkVersion globalConfiguration["androidCompileSdkVersion"]

    defaultConfig {
        applicationId "com.doctoror.fuckoffmusicplayer"

        minSdkVersion globalConfiguration["androidMinSdkVersion"]
        targetSdkVersion globalConfiguration["androidTargetSdkVersion"]

        versionCode 1
        versionName "1.0.0"

        resConfigs "en"
        multiDexEnabled true

        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ['dart.henson.package': 'com.doctoror.fuckoffmusicplayer.presentation']
            }
        }
    }

    buildFeatures {
        buildConfig = true
        dataBinding = true
    }

    lintOptions {
        checkAllWarnings true
        disable 'IconMissingDensityFolder'
    }

    kotlinOptions {
        jvmTarget = "11"
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }

    signingConfigs {

        release {
            storeFile file("../keystore/doctoror.keystore")
        }
    }

    testOptions {
        unitTests {
            includeAndroidResources = true
        }
    }

    buildTypes {
        debug {
            applicationIdSuffix ".debug"
        }

        release {
            debuggable false
            signingConfig signingConfigs.release

            if (project.hasProperty('keyAlias')) {
                android.signingConfigs.release.keyAlias = keyAlias
            }

            if (project.hasProperty('storePassword')) {
                android.signingConfigs.release.storePassword = storePassword
            }

            if (project.hasProperty('keyPassword')) {
                android.signingConfigs.release.keyPassword = keyPassword
            }

            minifyEnabled true
            shrinkResources true

            proguardFile getDefaultProguardFile('proguard-android.txt')
            proguardFile 'proguard-dagger.pro'
            proguardFile 'proguard-dart.pro'
            proguardFile 'proguard-parceler.pro'
            proguardFile 'proguard-rules.pro'
            proguardFile 'proguard-rx-java.pro'
            proguardFile 'proguard-support-design.pro'
        }
    }

    splits {
        density {
            enable true
        }
    }
}

dependencies {
    def d = rootProject.ext.presentationDependencies
    def td = rootProject.ext.presentationTestDependencies

    testImplementation td.junit
    testImplementation td.kotlinReflect
    testImplementation td.mockito
    testImplementation td.mockitoKotlin
    testImplementation td.robolectric

    implementation project(':commons')
    implementation project(':domain')
    implementation project(':data')
    implementation project(':siriwaveview')

    implementation d.aspectRatioLayout

    implementation d.dagger
    implementation d.daggerAndroid
    implementation d.daggerAndroidSupport
    kapt d.daggerCompiler
    kapt d.daggerAndroidProcessor

    implementation d.dart
    kapt d.dartProcessor

    implementation d.fastScroll

    implementation d.glide

    implementation d.henson
    kapt d.hensonProcessor

    implementation d.kotlin

    implementation d.media

    implementation d.parceler
    kapt d.parcelerProcessor

    implementation d.rxAndroid
    implementation d.rxBinding
    implementation d.rxJava
    implementation d.rxPermissions

    implementation d.supportAppCompat
    implementation d.supportCardView
    implementation d.supportDesign
    implementation d.supportMediaCompat
    implementation d.supportRecyclerView
    implementation d.constraintLayout
}
