apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.jakewharton.hugo'
apply plugin: 'com.github.triplet.play'
apply from: '../config/quality/quality.gradle'

buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'me.tatarka:gradle-retrolambda:3.5.0'
        classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
        classpath 'io.realm:realm-gradle-plugin:2.3.1'
        classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
        classpath 'com.google.gms:google-services:3.0.0'
        classpath 'com.github.triplet.gradle:play-publisher:1.1.5'
    }

    // Exclude the version that the android plugin depends on.
    configurations.classpath.exclude group: 'com.android.tools.external.lombok'
}

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.3'
    defaultConfig {
        applicationId "chat.rocket.android"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 24
        versionName "1.0.14"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true
    }
    signingConfigs {
        release {
            storeFile project.rootProject.file('Rocket.jks').getCanonicalFile()
            storePassword System.getenv("KEYSTORE_PASSWORD")
            keyAlias System.getenv("KEY_ALIAS")
            keyPassword System.getenv("KEY_PASSWORD")
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/rxjava.properties'
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    lintOptions {
        //avoiding okio error: https://github.com/square/okhttp/issues/896
        lintConfig file("lint.xml")
    }
}
play {
    jsonFile = file('rocket-chat.json')
    track = "${track}"
}

ext {
    supportVersion = '25.3.1'
    playLibVersion = '10.2.6'
    stethoVersion = '1.4.2'
    rxbindingVersion = '2.0.0'
    rxlifecycleVersion = '2.1.0'
    icepickVersion = '3.2.0'
    permissionsdispatcherVersion = '2.4.0'
}

dependencies {
    compile project(':log-wrapper')
    compile project(':android-ddp')
    compile project(':rocket-chat-core')
    compile project(':rocket-chat-android-widgets')
    compile project(':persistence-realm')

    compile "com.android.support:appcompat-v7:$supportVersion"
    compile "com.android.support:design:$supportVersion"

    compile 'com.android.support:multidex:1.0.1'

    compile "com.google.firebase:firebase-core:$playLibVersion"
    compile "com.google.firebase:firebase-crash:$playLibVersion"

    compile "com.google.android.gms:play-services-gcm:$playLibVersion"

    compile 'com.squareup.okhttp3:okhttp:3.8.0'

    compile "com.facebook.stetho:stetho:$stethoVersion"
    compile "com.facebook.stetho:stetho-okhttp3:$stethoVersion"
    compile 'com.uphyca:stetho_realm:2.0.1'

    compile "com.jakewharton.rxbinding2:rxbinding:$rxbindingVersion"
    compile "com.jakewharton.rxbinding2:rxbinding-support-v4:$rxbindingVersion"
    compile "com.jakewharton.rxbinding2:rxbinding-appcompat-v7:$rxbindingVersion"

    compile "com.trello.rxlifecycle2:rxlifecycle:$rxlifecycleVersion"
    compile "com.trello.rxlifecycle2:rxlifecycle-android:$rxlifecycleVersion"
    compile "com.trello.rxlifecycle2:rxlifecycle-components:$rxlifecycleVersion"

    compile 'nl.littlerobots.rxlint:rxlint:1.2'

    compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'

    compile "frankiesardo:icepick:$icepickVersion"
    provided "frankiesardo:icepick-processor:$icepickVersion"

    compile "com.github.hotchemi:permissionsdispatcher:$permissionsdispatcherVersion"
    annotationProcessor "com.github.hotchemi:permissionsdispatcher-processor:$permissionsdispatcherVersion"

    compile "com.android.support:support-annotations:$supportVersion"
}

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