apply plugin: 'com.android.application'

android {

    signingConfigs {
//        debug {
//            keyAlias 'lifeplus_debug'
//            keyPassword 'lifeplus_debug'
//            storeFile rootProject.file("keystore/lifeplus_debug")
//            storePassword 'lifeplus_debug'
//        }
        release {
            keyAlias 'yeongyun_zumo'
            keyPassword 'yy0906'
            storeFile rootProject.file("keystore/yeongyun.jks")
            storePassword 'yy0906'
        }
    }

    compileSdkVersion 27
    defaultConfig {
        applicationId "kr.co.zumo.app"
        minSdkVersion 19    // 4.4
        targetSdkVersion 27
        versionCode 149
        versionName "4.0.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }

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

    flavorDimensions "build"
    productFlavors {
        dev {
            versionNameSuffix "-dev"
            manifestPlaceholders = [appLabel: "@string/app_name"]
        }
        product {
            versionNameSuffix ""
            manifestPlaceholders = [appLabel: "@string/app_name"]
        }
    }

    applicationVariants.all { variant ->
        variant.outputs.all { output ->
            def SEP = "_"
            def buildType = variant.variantData.variantConfiguration.buildType.name
            def version = variant.versionName
            def formattedDate = new Date().format('yyMMddHHmm')

            def newApkName = "lifeplus" + SEP + buildType + SEP + version + SEP + formattedDate + ".apk"

            outputFileName = new File(newApkName)
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    testOptions {
        unitTests {
            includeAndroidResources = true
            returnDefaultValues = true
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.google.android.gms:play-services-plus:15.0.1'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
    implementation('com.squareup.retrofit2:converter-gson:2.3.0')
    {
        exclude group: 'com.google.code.gson', module: 'gson'
    }

    implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'
    implementation "android.arch.lifecycle:extensions:1.1.1"
    implementation "android.arch.lifecycle:viewmodel:1.1.1"

    /*********************************
     * UNIT TEST
     *********************************/
    // Required for local unit tests (JUnit 4 framework)
    testImplementation 'junit:junit:4.12'
    // Required for instrumented tests
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test:rules:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.2'
    androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
    // Mockito
//    testImplementation "org.mockito:mockito-core:2.21.0"
    // Robolectric
    testImplementation 'org.robolectric:robolectric:3.8'
    testImplementation "org.robolectric:shadows-support-v4:3.3.2"
    testImplementation "org.robolectric:multidex:3.4.2"
    // PowerMock
    testImplementation 'org.powermock:powermock-core:1.7.4'
    testImplementation "org.powermock:powermock-module-junit4:1.7.4"
    testImplementation "org.powermock:powermock-api-mockito2:1.7.4"
}
