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

android {
  def globalConfiguration = rootProject.extensions.getByName("ext")

  compileSdkVersion globalConfiguration.getAt("androidCompileSdkVersion")
  buildToolsVersion globalConfiguration.getAt("androidBuildToolsVersion")

  defaultConfig {
    minSdkVersion globalConfiguration.getAt("androidMinSdkVersion")
    targetSdkVersion globalConfiguration.getAt("androidTargetSdkVersion")

    applicationId globalConfiguration.getAt("androidApplicationId")
    versionCode globalConfiguration.getAt("androidVersionCode")
    versionName globalConfiguration.getAt("androidVersionName")
    testInstrumentationRunner globalConfiguration.getAt("testInstrumentationRunner")
    testApplicationId globalConfiguration.getAt("testApplicationId")
  }

  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
  }

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

  lintOptions {
    quiet true
    abortOnError false
    ignoreWarnings true
    disable 'InvalidPackage'            //Some libraries have issues with this.
    disable 'OldTargetApi'              //Lint gives this warning but SDK 20 would be Android L Beta.
    disable 'IconDensities'             //For testing purpose. This is safe to remove.
    disable 'IconMissingDensityFolder'  //For testing purpose. This is safe to remove.
  }

  signingConfigs {
    debug {
      storeFile file('../buildsystem/debug.keystore')
      storePassword 'android'
      keyAlias 'androiddebugkey'
      keyPassword 'android'
    }
  }

  buildTypes {
    debug {
      signingConfig signingConfigs.debug
    }
  }
}

dependencies {
  def presentationDependencies = rootProject.ext.presentationDependencies
  def presentationTestDependencies = rootProject.ext.presentationTestDependencies
  def developmentDependencies = rootProject.ext.developmentDependencies

  implementation project(':domain')
  implementation project(':data')

  annotationProcessor presentationDependencies.daggerCompiler
  implementation presentationDependencies.dagger
  implementation presentationDependencies.butterKnife
  annotationProcessor presentationDependencies.butterKnife
  implementation presentationDependencies.recyclerView
  implementation presentationDependencies.rxJava
  implementation presentationDependencies.rxAndroid
  compileOnly presentationDependencies.javaxAnnotation

  androidTestImplementation presentationTestDependencies.mockito
  androidTestImplementation presentationTestDependencies.dexmaker
  androidTestImplementation presentationTestDependencies.dexmakerMockito
  androidTestImplementation presentationTestDependencies.espresso
  androidTestImplementation presentationTestDependencies.testingSupportLib

  //Development
  implementation developmentDependencies.leakCanary
}

repositories {
  google()
}