apply plugin: 'walle'


android {
    defaultConfig {
        buildConfigField 'Boolean', 'IS_COLLECT_MODE', 'false'
        buildConfigField 'Boolean', 'IS_DIVERSION_MODE', 'false'
        buildConfigField 'Boolean', 'IS_KSP', 'false'
        //同盾采集SDK
        buildConfigField 'String', 'TONGDUN_PARENT_CODE', '\"\"'
        buildConfigField 'String', 'TONGDUN_PARENT_KEY', '\"\"'
        buildConfigField 'String', 'TONGDUN_APP_NAME', '\"\"'
        resValue('string', 'octopus_open_whatsapp', " Open Whatsapp")

        //同盾指纹SDK
        buildConfigField 'String', 'TONGDUN_DEVICE_PARENT_CODE', '\"\"'
    }

    buildTypes {
        release {
            proguardFiles getDefaultProguardFile('proguard-android.txt'), '../lib_base/proguard-rules.pro'
        }
    }

    lintOptions {
        disable 'GoogleAppIndexingWarning'
    }
    productFlavors {
        website {
            ndk {
                abiFilters 'armeabi-v7a'//,'arm64-v8a'//,'armeabi'//,  'arm64-v8a', 'x86'
            }
            buildConfigField('String', 'BUGLY_APPID', "\"f35508ee93\"")
            dimension "channel"
        }

        googleplay {
            ndk {
                if ("${tongdun_parent_key}".size() > 5) {
                    abiFilters 'armeabi-v7a'
                }else{
                    abiFilters 'armeabi-v7a', 'arm64-v8a'//,'armeabi'//,  'arm64-v8a', 'x86'
                }
            }
            buildConfigField('String', 'BUGLY_APPID', "\"\"")
            dimension "channel"
        }
    }
}

dependencies {
    exec {
        workingDir = "../lib_base/script"
        if ("${tongdun_parent_key}".size() > 5) {
            implementation(name: 'android_spirit-20190220-2.0.0.1', ext: 'aar')
            implementation 'com.alibaba:fastjson:1.1.58.android'
            executable 'sh' args "-c", "./sdk_manager.py open TD"
        } else {
            executable 'sh' args "-c", "./sdk_manager.py close TD"
        }
    }

//    def startParams = getGradle().getStartParameter().getTaskRequests()[0]
//    if(startParams!=null && startParams.getArgs().toString().contains("Website")){
//    }

    websiteImplementation 'com.tencent.bugly:crashreport:3.0.0'


    implementation project(':cash_plugin_toolbox')
}

walle {
    // 指定渠道包的输出路径
    apkOutputFolder = new File("${project.buildDir}/outputs/channels")
    // 定制渠道包的APK的文件名称
    apkFileNameFormat = '${packageName}_${channel}.apk'
    // 渠道配置文件
    channelFile = new File("${project.getProjectDir()}/channel")
}

