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

android {
    signingConfigs {
        debug {
            keyAlias 'androiddebugkey'
            keyPassword 'android'
            storePassword 'android'
            storeFile file("${System.properties['user.home']}${File.separator}.android${File.separator}debug.keystore")
        }
    }

    compileSdkVersion rootProject.ext.compileSdkVersion

    defaultConfig {
        applicationId "com.anggrayudi.materialpreference.sample"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode rootProject.ext.appVersionCode
        versionName "$MATERIAL_PREFERENCE_VERSION"
        multiDexEnabled true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            zipAlignEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.debug
        }
        debug {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    packagingOptions {
        exclude 'META-INF/atomicfu.kotlin_module'
    }
    lintOptions {
        abortOnError false
    }

    flavorDimensions "libSource"
    productFlavors {
        local {
            dimension "libSource"
            getIsDefault().set(true)
        }
        maven {
            dimension "libSource"
            configurations.all {
                // Check for updates every build
                resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
            }
        }
    }
}

configurations {
    kapt
}

dependencies {
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test:runner:1.5.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'

    implementation 'androidx.recyclerview:recyclerview:1.2.1'
    implementation 'io.insert-koin:koin-android:3.3.0'
    implementation 'androidx.multidex:multidex:2.0.1'

    implementation project(':materialpreference')
    compileOnly project(':annotation')
    kapt project(':processor')

//    kapt 'com.anggrayudi:materialpreference-compiler:1.8'

//    localImplementation project(":materialpreference")
//    localCompileOnly project(':annotation')

//    mavenImplementation("com.anggrayudi:materialpreference:$MATERIAL_PREFERENCE_VERSION") { changing = true }
//    mavenImplementation 'com.anggrayudi:materialpreference-api:1.8'
}

tasks.withType(JavaCompile) {
    options.incremental = true
    options.annotationProcessorPath = configurations.kapt
}