apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: "kotlin-kapt"

// App Version is composed by Major * 10000 + Minor * 100 + Patch
// each version starts from 0
def versionMajor = 1
def versionMinor = 9
def versionPatch = 2

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    defaultConfig {
        applicationId "top.easelink.lcg"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode versionMajor * 10000 + versionMinor * 100 + versionPatch
        versionName "${versionMajor}.${versionMinor}.${versionPatch}"
        // apply build configs
        buildConfigField("String", "DB_NAME", "\"articles.db\"")
        buildConfigField("String", "BUGLY_APP_ID", rootProject.ext.BUGLY_APP_ID)
        buildConfigField("String", "UMENG_APP_KEY", rootProject.ext.UMENG_APP_KEY)
        buildConfigField("String", "CHANNEL", rootProject.ext.UMENG_CHANNEL)

        ndk {
            abiFilters 'armeabi-v7a', 'x86', 'arm64-v8a'//,'armeabi',
        }
        resConfigs "zh"
    }
    signingConfigs {
        releaseConfig {
            keyAlias rootProject.ext.RELEASE_KEY_ALIAS
            keyPassword rootProject.ext.RELEASE_KEY_PWD
            storeFile file('../keystore.jks')
            storePassword rootProject.ext.RELEASE_KEY_STORE_PWD
        }
    }
    buildTypes {

        debug {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        release {
            debuggable false
            minifyEnabled true
            zipAlignEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.releaseConfig
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
        incremental true
    }


    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/*android*'
        exclude 'META-INF/*kotlin*'
        exclude 'okhttp3/**'
        exclude 'kotlin/**'
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/README.md'
        exclude 'META-INF/services/**'
        exclude 'META-INF/CHANGES'
    }
    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_1_8
    }
    // Generate Version Info
    android.applicationVariants.all { variant ->
        variant.outputs.all {
            outputFileName = "lcg-${variant.versionName}-${releaseTime}.apk"
        }
    }

    buildFeatures {
        dataBinding = true
    }
    buildToolsVersion = buildToolsVersion
}

dependencies {
    // database
    kapt "androidx.room:room-compiler:$roomVersion"
    implementation project(':framework')
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    debugImplementation "com.amitshekhar.android:debug-db:1.0.4"
    // test related
    testImplementation "junit:junit:$rootProject.junitVersion"
}

apply from: "../andres.gradle"
