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

android {
    compileSdkVersion rootProject.compile_sdk_version

    defaultConfig {
        applicationId rootProject.application_id
        minSdkVersion rootProject.min_sdk_version
        targetSdkVersion rootProject.target_sdk_version
        versionCode rootProject.application_version_code
        versionName rootProject.application_version_name
        manifestPlaceholders = [
                JPUSH_PKGNAME: 'com.quansu.heifengwuliu',
                JPUSH_APPKEY : "fe6707d0979ba5e2059b8fb9",//值来自开发者平台取得的AppKey
                JPUSH_CHANNEL: "default_developer",
        ]
        ndk {
            //选择要添加的对应 cpu 类型的 .so 库。
            abiFilters 'armeabi-v7a'
            // 还可以添加 'x86', 'x86_64', 'mips', 'mips64'
        }
    }

    signingConfigs {

        release {
            keyAlias "heifengwuliu"
            keyPassword "HiFengwuliu@###121"
            storeFile file("../heifengwuliu.jks")
            storePassword "HiFengwuliu@###121"
            v2SigningEnabled true
        }
    }

    buildTypes {
        debug {
            signingConfig signingConfigs.release
            versionNameSuffix "-" + name


        }
        release {
            debuggable false
            minifyEnabled true
            zipAlignEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }


    }

    //指定release APK名称
    applicationVariants.all { variant ->
        variant.outputs.all {
            // 输出apk名称为 1.0_vivo.apk
            def fileName = "${variant.productFlavors[0].name}_${defaultConfig.versionName}.apk"
            outputFileName = fileName
        }
    }

    flavorDimensions "version"
    //指定渠道
    productFlavors {
        dev {}
        vivo {}
        oppo {}
        huawei {}
        xiaomi {}
        coolapk {}
        yingyongbao {}
    }

    // 批量渠道包值替换

    //通过脚本获取所有渠道
    //在Terminal控制台输入gradlew assembleRelease开始打包
    //包生成在build-->outputs-->apk文件夹
    productFlavors.all {
            //        遍历替换所有渠道
        flavor -> flavor.manifestPlaceholders = [UMENG_CHANNEL: name]
    }
//
    //Terminal窗口输入
    //打包wandoujia渠道的release版本，执行如下命令
    //    gradlew assembleWandoujiaRelease
    //打包wandoujia渠道的debug版本，执行如下命令
    //    gradlew assembleWandoujiaDebug
    // 只打wandoujia渠道版会生成wandoujia渠道的Release和Debug版本
    //    gradlew assembleWandoujia
    //打全部Release版本
    //    gradlew assembleRelease


    compileOptions {
        targetCompatibility 1.8
        sourceCompatibility 1.8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }


    android.buildFeatures {
        dataBinding = true
        viewBinding = false
    }

}

dependencies {

    implementation project(':base')
    addComponent 'update'
    addComponent 'umeng'
    addComponent 'jpush'
    addComponent 'gaode'

    //微信sdk
    implementation 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:+'
    implementation 'com.github.hackware1993:MagicIndicator:1.5.0'
}
