ext.mainApp = true  //设置为true，表示此module为主app module，一直以application方式编译
apply from: rootProject.file("cc-settings.gradle")
apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'com.didi.dokit'

android {

    compileSdkVersion rootProject.ext.android["compileSdkVersion"]
    buildToolsVersion rootProject.ext.android["buildToolsVersion"]

    compileOptions {
        targetCompatibility JavaVersion.VERSION_1_8
        sourceCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        minSdkVersion rootProject.ext.android["minSdkVersion"]
        targetSdkVersion rootProject.ext.android["targetSdkVersion"]
        applicationId 'com.gingersoft.gsa.cloud'
        versionCode rootProject.ext.android["versionCode"]
        versionName rootProject.ext.android["versionName"]
        multiDexEnabled true
//        ndk{
//            abiFilters "armeabi-v7a"
//        }
    }

    resourcePrefix "app"

    buildTypes {
        debug {
            buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
            buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
            minifyEnabled false
            proguardFiles 'proguard.cfg'
        }
        release {
            buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
            buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
            minifyEnabled false
            zipAlignEnabled false
            proguardFiles 'proguard.cfg'
        }
    }

    lintOptions {
        abortOnError false
    }
    dataBinding {
        enabled = true
    }
    //修改生成的apk名字
    applicationVariants.all { variant ->
        variant.outputs.all {
            def fileName
            def date = new Date()
            def formattedDate = date.format('yyyy-MM-dd')
            if (variant.buildType.name == 'release') {
                fileName = "${formattedDate}_GSA-Cloud_${variant.mergedFlavor.versionName}_正式版_.apk"
            } else if (variant.buildType.name == 'Test') {
                fileName = "${formattedDate}_GSA-Cloud_${variant.mergedFlavor.versionName}_測試版_.apk"
            } else if (variant.buildType.name == 'debug') {
                fileName = "${formattedDate}_GSA-Cloud_${variant.mergedFlavor.versionName}_debug_.apk"
            }
            outputFileName = fileName
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

}
