ext.mainApp = true  //设置为true，表示此module为主app module，一直以application方式编译
apply from: rootProject.file("cc-settings.gradle")
apply plugin: 'com.jakewharton.butterknife'
android {
    signingConfigs {
        GSAndroidNew {
            keyAlias 'keycypos'
            keyPassword 'qingkeke'
            storeFile file('cyposandroid.keyset')
            storePassword 'qingkeke'
        }
    }

    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
    }

    resourcePrefix "user_login"

    buildTypes {
        debug {
            buildConfigField "boolean", "LOG_DEBUG", "true"
            buildConfigField "boolean", "USE_CANARY", "true"
            minifyEnabled false
            proguardFiles 'proguard.cfg'
            signingConfig signingConfigs.GSAndroidNew
        }
        release {
            buildConfigField "boolean", "LOG_DEBUG", "false"
            buildConfigField "boolean", "USE_CANARY", "false"
            minifyEnabled false
            zipAlignEnabled false
            proguardFiles 'proguard.cfg'
            signingConfig signingConfigs.GSAndroidNew
        }
    }

    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'])

//    addComponent 'public-base'
    addComponent 'main-module'
    addComponent 'download-module'
    addComponent 'table-module'
    addComponent 'print-module'
    addComponent 'other_order_mode'
    addComponent 'manager-module'

    implementation 'androidx.viewpager2:viewpager2:1.0.0-alpha03'
    annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
    implementation rootProject.ext.dependencies["autosize"]

}
