apply plugin: 'com.android.application'
apply plugin: 'android-apt'

ext {
    PUBLISH_VERSION = '2.0.0'
    SUPPORT_LIBRARY_VERSION = '24.2.1'
    BUILD_TOOLS = "23.0.3"
    TARGET_SDK = 23
}

android {
    compileSdkVersion TARGET_SDK
    buildToolsVersion BUILD_TOOLS
    enforceUniquePackageName = false

    defaultConfig {
        applicationId "com.davidecirillo.multichoicerecyclerview"
        minSdkVersion 15
        targetSdkVersion TARGET_SDK
        versionCode 4
        versionName PUBLISH_VERSION

        multiDexEnabled true

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    lintOptions {
        abortOnError true
        disable 'Overdraw','UnusedResources','IconLocation','ContentDescription','AppLinksAutoVerifyError','AppLinksAutoVerifyWarning'
    }

    buildTypes {
        debug {
            debuggable true;
        }
        release {
            debuggable false;
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    signingConfigs {
        release {
            def Properties localProps = new Properties()
            def File localPropsFile = file('../local.properties')

            if (localPropsFile.exists()) {
                localProps.load(new FileInputStream(localPropsFile))
            }
            def Properties keyProps = new Properties()
            if (localProps['keystore.props.file'] != null) {
                keyProps.load(new FileInputStream(file(localProps['keystore.props.file'])))
            } else {
                println 'Keystore props file is missing'
            }

            storeFile keyProps["store"] != null ? file(keyProps["store"]) : null
            keyAlias keyProps["alias"] ?: ""
            storePassword keyProps["storePass"] ?: ""
            keyPassword keyProps["pass"] ?: ""
        }
    }
}

configurations.all {
    resolutionStrategy {
        force "com.android.support:support-annotations:${SUPPORT_LIBRARY_VERSION}"
    }
}

dependencies {

    compile project(':library:multichoicerecyclerview')

    compile "com.android.support:cardview-v7:${SUPPORT_LIBRARY_VERSION}"
    compile "com.android.support:support-v4:${SUPPORT_LIBRARY_VERSION}"
    compile "com.android.support:appcompat-v7:${SUPPORT_LIBRARY_VERSION}"
    compile "com.android.support:recyclerview-v7:${SUPPORT_LIBRARY_VERSION}"
    compile "com.android.support:design:${SUPPORT_LIBRARY_VERSION}"
    compile 'com.jakewharton:butterknife:8.1.0'
    apt 'com.jakewharton:butterknife-compiler:8.1.0'
    // RxAndroid - asynchronous operations
    compile 'io.reactivex:rxandroid:1.0.1'
    compile 'io.reactivex:rxjava:1.0.14'
    compile 'com.squareup.picasso:picasso:2.5.2'
    // Testing-only dependencies
    testCompile 'junit:junit:4.10'
    testCompile 'org.assertj:assertj-core:1.7.0'
    testCompile 'org.robolectric:robolectric:3.0'
    testCompile 'com.jakewharton:butterknife:8.1.0'
    androidTestCompile 'com.android.support.test:runner:0.5'
    androidTestCompile "com.android.support:support-annotations:${SUPPORT_LIBRARY_VERSION}"
    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
    androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2') {
        exclude group: 'com.android.support', module: 'appcompat'
        exclude group: 'com.android.support', module: 'support-v4'
        exclude module: 'recyclerview-v7'
    }
}
