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 {
    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
//        ndk{
//            abiFilters "armeabi-v7a"
//        }
    }

    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
        }
    }
}

//dokit 扩展
dokitExt {
    //通用设置
    comm {
        //地图经纬度开关
        gpsSwitch true
        //网络开关
        networkSwitch true
        //大图开关
        bigImgSwitch true
        //webView js 抓包
        webViewSwitch true
    }

    slowMethod {
        //调用栈模式配置
        stackMethod {
            //默认值为 5ms 小于该值的函数在调用栈中不显示
            thresholdTime 5
            //调用栈函数入口
            enterMethods = ["com.didichuxing.doraemondemo.MainDebugActivity.test1"]
            //黑名单 粒度最小到类 暂不支持到方法
            methodBlacklist = ["com.facebook.drawee.backends.pipeline.Fresco"]
        }
        //普通模式配置
        normalMethod {
            //默认值为 500ms 小于该值的函数在运行时不会在控制台中被打印
            thresholdTime 100
            //需要针对函数插装的包名
            packageNames = ["com.didichuxing.doraemondemo"]
            //不需要针对函数插装的包名和类名
            methodBlacklist = ["com.didichuxing.doraemondemo.dokit"]
        }
    }
}

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

    addComponent 'component-main'
    addComponent 'component-download'
    addComponent 'component-table'
    addComponent 'component-print'
    addComponent 'component-delivery-pick'
    addComponent 'component-manager'
    addComponent 'component-coldchain'
//    addComponent 'component-supply-chain'
    addComponent 'component-webview'
    addComponent 'component-scan'
    addComponent 'component-pay'

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