plugins {
    id "io.gitlab.arturbosch.detekt" version "1.0.0.M13.2"
}

apply from: '../versions.gradle'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'io.fabric'

detekt {
    version = "1.0.0.M13.2"

    profile("main") {
        input = "$projectDir/src/main/java"
        config = "$rootDir/team-props/static-analysis/detekt-config.yml"
        filters = ".*test.*,.*/resources/.*,.*/tmp/.*"
        output = "$projectDir/build/reports/detekt.xml"
    }
}


project.afterEvaluate {
    check.dependsOn tasks['detektCheck']
}

android {

    compileSdkVersion androidCompileSdkVersion
    buildToolsVersion androidBuildToolsVersion

    applicationVariants.all { variant ->
        variant.outputs.all { output ->
            output.outputFileName = new File(
                    "./../../../../../build/",
                    output.outputFileName.replace(".apk", "-${variant.versionName}.apk"))
        }
    }


    defaultConfig {
        applicationId 'com.alexstyl.specialdates'
        minSdkVersion 16
        targetSdkVersion 27
        versionCode androidVersionCode
        versionName androidVersionName
        resValue "string", "admob_unit_id", "\"$adMobUnitId\""


        buildConfigField "String", "FILE_PROVIDER", "\"com.alexstyl.specialdates.fileprovider\""
        manifestPlaceholders = [crashlyticsApiKey: crashlyticsKey,
                                fileProvider     : "com.alexstyl.specialdates.fileprovider"]

        multiDexEnabled true
    }

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


    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }

    lintOptions {
        abortOnError false
    }

    testOptions {
        unitTests.returnDefaultValues = true
    }

}

dependencies {
    implementation fileTree(dir: 'libs', exclude: 'android-support-v4.jar', include: ['*.jar'])
    implementation project(':android_common')

    implementation "com.android.support:design:$android_support_version"
    implementation "com.android.support:cardview-v7:$android_support_version"
    implementation "com.android.support:appcompat-v7:$android_support_version"
    implementation "com.android.support:recyclerview-v7:$android_support_version"
    implementation "com.android.support:transition:$android_support_version"
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:multidex:1.0.3'

    implementation 'com.google.dagger:dagger:2.9'
    kapt 'com.google.dagger:dagger-compiler:2.9'
    compileOnly 'javax.annotation:jsr250-api:1.0'

    implementation 'com.novoda:notils:2.2.15'
    implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
    implementation 'com.novoda:simple-chrome-custom-tabs:0.1.6'
    implementation('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
        transitive = true
    }
    implementation "com.google.android.gms:play-services-wearable:$play_services_version"
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.3.1'
    implementation "com.google.firebase:firebase-core:$play_services_version"
    implementation "com.google.firebase:firebase-ads:$play_services_version"
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
    implementation 'io.reactivex.rxjava2:rxjava:2.1.0'
    implementation 'com.evernote:android-job:1.2.4'

    debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5'
    debugImplementation 'com.facebook.stetho:stetho:1.3.0'
    testImplementation 'junit:junit:4.12'
    testImplementation 'org.easytesting:fest-assert-core:2.0M10'
    testImplementation 'org.mockito:mockito-core:1.10.19'
    testImplementation 'joda-time:joda-time:2.9.4'
    testImplementation 'org.json:json:20140107'
    androidTestImplementation 'junit:junit:4.12'
}


apply from: "$rootDir/android_mobile/google_services.gradle"

apply plugin: 'com.google.gms.google-services'
