/*
 * Copyright (c) 2017 Nam Nguyen, nam@ene.im
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

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

android {
  signingConfigs {
    release {
      keyAlias "debug"
      keyPassword "android"
      storeFile file("debug.jks")
      storePassword "android"
    }

    debug {
      keyAlias "debug"
      keyPassword "android"
      storeFile file("debug.jks")
      storePassword "android"
    }
  }

  compileSdkVersion rootProject.ext.androidVersion

  defaultConfig {
    applicationId "im.ene.toro.sample"
    minSdkVersion rootProject.ext.minSupportSDKVersion
    targetSdkVersion rootProject.ext.androidVersion
    versionCode releaseVersionCode
    versionName releaseVersion
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

    vectorDrawables.useSupportLibrary = true
  }

  buildTypes {
    release {
      signingConfig signingConfigs.release
      minifyEnabled true
      proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }

    debug {
      applicationIdSuffix ".debug"
      signingConfig signingConfigs.debug
      multiDexEnabled true
      minifyEnabled false
    }
  }

  packagingOptions {
    exclude 'META-INF/services/javax.annotation.processing.Processor'
  }

  lintOptions {
    disable 'InvalidPackage'
    abortOnError false
  }

  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }
}

dependencies {
  implementation fileTree(include: ['*.jar'], dir: 'libs')
  implementation project(':toro-core')
  implementation project(':toro-exoplayer')
  implementation("com.google.android.exoplayer:exoplayer:${rootProject.ext.exoPlayer2Version}") {
    exclude group: 'com.android.support'
  }

  //  implementation "im.ene.toro3:toro:3.6.2.2804"
  //  implementation "im.ene.toro3:toro-ext-exoplayer:3.6.2.2804"
  //  implementation ("com.google.android.exoplayer:exoplayer:2.8.4") {
  //    exclude group: 'com.android.support'
  //  }

  implementation 'com.google.android.material:material:1.0.0'
  implementation 'androidx.appcompat:appcompat:1.1.0'
  implementation 'androidx.cardview:cardview:1.0.0'
  implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
  implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

  // additional dependencies.
  //noinspection GradleDependency

  implementation 'com.jakewharton:butterknife:10.1.0'
  kapt 'com.jakewharton:butterknife-compiler:10.1.0'

  // rxJava 2
  implementation("io.reactivex.rxjava2:rxandroid:2.1.0", {
    exclude group: 'io.reactivex.rxjava2', module: 'rxjava'
  })

  implementation 'io.reactivex.rxjava2:rxjava:2.2.13'

  implementation "org.jsoup:jsoup:1.12.1"

  debugImplementation "com.squareup.leakcanary:leakcanary-android:${rootProject.ext.leackCanary}"
  releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:${rootProject.ext.leackCanary}"
  testImplementation "com.squareup.leakcanary:leakcanary-android-no-op:${rootProject.ext.leackCanary}"

  implementation "com.github.bumptech.glide:glide:${rootProject.ext.glide}"
  kapt "com.github.bumptech.glide:compiler:${rootProject.ext.glide}"

  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

  implementation 'androidx.multidex:multidex:2.0.1'

  // Custom LayoutManager
  // compile 'com.google.android:flexbox:0.3.0'

  testImplementation 'junit:junit:4.12'
  androidTestImplementation 'androidx.test.ext:junit:1.1.1'
  androidTestImplementation 'androidx.test:rules:1.2.0'
  androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
  androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.2.0'
}