buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
        maven { url 'https://maven.google.com' }
        jcenter()
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.24.4'
        //classpath 'com.google.firebase:firebase-plugins:1.1.1'
    }

}

import org.ajoberstar.grgit.Grgit

ext {
    git = Grgit.open(currentDir: projectDir)
    gitVersionName = "-community-public" //git.describe()
    gitVersionCode = "0.0.1" //git.tag.list().size()
    gitVersionCodeTime = "community-time" //git.head().time
}

task printVersion() << {
    println("Version Name: $gitVersionName")
    println("Version Code: $gitVersionCode")
    println("Version Code Time: $gitVersionCodeTime")
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
//apply plugin: 'com.google.firebase.firebase-perf'

repositories {
    maven { url 'https://maven.fabric.io/public' }
    maven { url "https://jitpack.io" }
}


import java.text.SimpleDateFormat

def buildTime() {
    def df = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss")
    df.setTimeZone(TimeZone.getTimeZone("GMT+08:00"))
    return df.format(new Date())
}

def buildTimestamp() {
    def df = new SimpleDateFormat("yyyyMMddHHmmss")
    df.setTimeZone(TimeZone.getTimeZone("GMT+08:00"))
    return df.format(new Date())
}

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.1"
    defaultConfig {
        applicationId "com.axzae.homeassistant"
        minSdkVersion 17
        targetSdkVersion 27
        versionCode 1
        versionName "0.0.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true

        multiDexEnabled true
        renderscriptTargetApi 22
        renderscriptSupportModeEnabled true

        buildConfigField('String', 'signatureHash', '"97:55:C7:8F:FB:36:FF:45:2A:21:87:01:47:B0:DD:AB:16:4F:C4:0D"')
        buildConfigField('String', 'buildTime', "\"${buildTime()}\"")
    }

    flavorDimensions "default"

    productFlavors {
        dev {
            dimension "default"
            versionName gitVersionName
        }
    }

    buildTypes {
        debug {
            buildConfigField('String', 'signatureHash', '"97:55:C7:8F:FB:36:FF:45:2A:21:87:01:47:B0:DD:AB:16:4F:C4:0D"')
        }
    }

    lintOptions {
        checkReleaseBuilds false
    }

}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile('com.afollestad.material-dialogs:core:0.9.1.0') {
        exclude group: 'com.android.support'
    }

    compile('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
        transitive = true;
    }

    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:support-v4:27.0.1'
    compile 'com.android.support:appcompat-v7:27.0.1'
    compile 'com.android.support:cardview-v7:27.0.1'
    compile 'com.android.support:customtabs:27.0.1'
    compile 'com.android.support:design:27.0.1'
    compile 'com.android.support:gridlayout-v7:27.0.1'
    compile 'com.android.support:support-vector-drawable:27.0.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'

    compile 'com.google.android.gms:play-services-location:11.6.0'
    compile 'com.google.android.gms:play-services-maps:11.6.0'
    //compile 'com.google.firebase:firebase-core:11.6.0'
    compile 'com.google.firebase:firebase-config:11.6.0'
    compile 'com.google.firebase:firebase-ads:11.6.0'
    compile 'com.google.firebase:firebase-messaging:11.6.0'
    //compile 'com.google.firebase:firebase-perf:11.4.2'

    compile 'com.google.code.gson:gson:2.8.1'

    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.retrofit2:converter-scalars:2.3.0'
    compile 'com.squareup.retrofit2:converter-gson:2.3.0'
    compile 'com.squareup.okhttp3:okhttp:3.9.0'
    compile 'com.squareup.okhttp3:logging-interceptor:3.9.0'

    compile('com.takisoft.fix:preference-v7:27.0.1.0') {
        exclude group: 'com.android.support', module: 'support-annotations'
    }

    compile 'com.yqritc:recyclerview-flexibledivider:1.2.9'
    compile 'com.koushikdutta.async:androidasync:2.1.9'
    compile 'com.rengwuxian.materialedittext:library:2.1.4'
    compile 'me.zhanghai.android.materialprogressbar:library:1.3.0'

    compile 'com.getkeepsafe.taptargetview:taptargetview:1.9.1'
    compile 'org.adw.library:discrete-seekbar:1.0.1'

    compile 'com.jaeger.statusbarutil:library:1.4.0'

    compile 'nl.dionsegijn:konfetti:1.1.0'
    compile 'com.github.QuadFlask:colorpicker:0.0.13'
    compile 'fr.tvbarthel.blurdialogfragment:lib:2.2.0'
    compile 'com.wdullaer:materialdatetimepicker:3.4.0'

    compile 'com.miguelcatalan:materialsearchview:1.4.0'
    compile 'com.github.lecho:hellocharts-library:1.5.8@aar'
    compile 'com.github.tiagohm.MarkdownView:library:0.17.0'
    compile 'de.hdodenhof:circleimageview:2.1.0'

    compile 'com.jaeger.statusbarutil:library:1.4.0'
    compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
    compile 'io.reactivex.rxjava2:rxjava:2.1.5'

    compile 'com.koushikdutta.async:androidasync:2.1.9'

    compile 'com.github.bumptech.glide:glide:4.4.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'
    compile ('com.github.bumptech.glide:okhttp3-integration:4.4.0'){
        exclude group: 'glide-parent'
    }

    testCompile 'junit:junit:4.12'
    androidTestCompile 'com.squareup.retrofit2:retrofit-mock:2.1.0'
    androidTestCompile 'com.squareup.okhttp3:mockwebserver:3.8.1'
    debugCompile 'com.amitshekhar.android:debug-db:1.0.1'

}

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