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

  dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
  }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

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

/*
 * Copyright 2016 eneim@Eneim Labs, 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.
 */

import java.text.DateFormat
import java.text.SimpleDateFormat

def dateTimeInt() {
  DateFormat df = new SimpleDateFormat("yyyyMMdd");
  return Integer.parseInt(df.format(new Date()));
}

def dateTimeString() {
  DateFormat df = new SimpleDateFormat("yyyy.MM.dd");
  return df.format(new Date());
}

android {
  compileSdkVersion 23
  buildToolsVersion "23.0.3"

  signingConfigs {
    release {
      keyAlias io_prodKeyAlias
      keyPassword io_prodKeyPassword
      storeFile file(io_prodStoreFile)
      storePassword io_prodStorePassword
    }

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

  defaultConfig {
    applicationId "im.ene.lab.io_timer"
    minSdkVersion 16
    targetSdkVersion 23
    versionCode dateTimeInt()
    versionName dateTimeString()
    archivesBaseName = "io_timer-${versionName}"
    manifestPlaceholders = [fabric_api_key: "${fabric_api_key}"]

    vectorDrawables.useSupportLibrary = true
  }

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

    debug {
      signingConfig signingConfigs.debug
      applicationIdSuffix ".debug"
      minifyEnabled false
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }

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

  lintOptions {
    disable 'InvalidPackage'
  }
}

ext {
  support_lib_version = '23.2.1'
}

dependencies {
  compile fileTree(dir: 'libs', include: ['*.jar'])
  testCompile 'junit:junit:4.12'
  compile 'com.android.support:appcompat-v7:23.2.1'

  compile 'io.reactivex:rxandroid:1.1.0'
  // Because RxAndroid releases are few and far between, it is recommended you also
  // explicitly depend on RxJava's latest version for bug fixes and new features.
  compile 'io.reactivex:rxjava:1.1.1'

  compile 'com.jakewharton.threetenabp:threetenabp:1.0.3'
  compile 'com.jakewharton:butterknife:7.0.1'
  compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
    transitive = true;
  }
}
