apply plugin: 'com.android.application'

// 加载 keystore.properties 文件
def keystorePropertiesFile = rootProject.file("keystore.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

android {
    compileSdkVersion ANDROID_BUILD_SDK_VERSION as int
    buildToolsVersion ANDROID_BUILD_TOOLS_VERSION
    defaultConfig {
        applicationId "me.bakumon.ugank"
        minSdkVersion ANDROID_BUILD_MIN_SDK_VERSION as int
        targetSdkVersion ANDROID_BUILD_TARGET_SDK_VERSION as int
        versionCode VERSION_CODE as int
        versionName VERSION_NAME
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    signingConfigs {
        release {
            storeFile file("ugank.jks")
            storePassword keystoreProperties['KEYSTORE_PASSWORD']
            keyAlias keystoreProperties['KEY_ALIAS']
            keyPassword keystoreProperties['KEY_PASSWORD']
        }
    }
    buildTypes {
        release {
            //  混淆
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            // Zipalign优化
            zipAlignEnabled true
            // 移除无用的resource文件
            shrinkResources true
            // 签名
            signingConfig signingConfigs.release
        }
        applicationVariants.all { variant ->
            variant.outputs.each { output ->
                def outputFile = output.outputFile
                if (outputFile != null && outputFile.name.endsWith('.apk')) {
                    // 输出apk名称为ugank_release_1.0.1_2.apk
                    def fileName = "ugank_release_${defaultConfig.versionName}_${defaultConfig.versionCode}.apk"
                    output.outputFile = new File(outputFile.parent, fileName)
                }
            }
        }
    }
}
apply plugin: 'com.neenbedankt.android-apt'
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.github.Andy671:Dachshund-Tab-Layout:v0.3.0') {
        exclude group: 'com.android.support'
    }
    compile 'com.android.support:appcompat-v7:25.1.1'
    compile 'com.android.support:support-v4:25.1.1'
    compile 'com.android.support:design:25.1.1'
    compile 'io.reactivex:rxandroid:1.1.0'
    compile 'com.squareup.retrofit2:adapter-rxjava:2.0.0'
    compile 'com.squareup.retrofit2:retrofit:2.0.0'
    compile 'com.squareup.retrofit2:converter-gson:2.0.0'
    compile 'com.jakewharton:butterknife:8.4.0'
    compile 'com.github.florent37:picassopalette:2.0.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.afollestad.material-dialogs:commons:0.9.3.0'
    compile 'cn.bingoogolapple:bga-swipebacklayout:1.0.7@aar'
    compile 'org.litepal.android:core:1.5.0'
    compile 'com.github.GrenderG:Toasty:1.1.3'
    testCompile 'junit:junit:4.12'
    testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
    apt 'com.jakewharton:butterknife-compiler:8.4.0'
    debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
    releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
    compile 'com.luolc:emoji-rain:0.1.1'
    compile 'com.google.android:flexbox:0.3.0-alpha3'
}
