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

  compile project(':domain')
  compile project(':data')

  apt presentationDependencies.daggerCompiler
  compile presentationDependencies.dagger
  compile presentationDependencies.butterKnife
  compile presentationDependencies.recyclerView
  compile presentationDependencies.rxJava
  compile presentationDependencies.rxAndroid
  provided presentationDependencies.javaxAnnotation

  androidTestCompile presentationTestDependencies.mockito
  androidTestCompile presentationTestDependencies.dexmaker
  androidTestCompile presentationTestDependencies.dexmakerMockito
  androidTestCompile presentationTestDependencies.espresso
  androidTestCompile presentationTestDependencies.testingSupportLib

  //Development
  compile developmentDependencies.leakCanary
}
