allprojects { project ->
    buildscript {
        ext.booster_version = '4.9.0'
        ext.plugin_version = "0.3.0"

        repositories {
            maven { url 'https://maven.aliyun.com/repository/public' }
            mavenLocal()
            google()
            mavenCentral()
            jcenter()
            maven { url 'https://oss.sonatype.org/content/repositories/public' }
            maven { url "https://artifact.bytedance.com/repository/byteX/" }
        }

        dependencies {
            // booster
            classpath "com.didiglobal.booster:booster-gradle-plugin:$booster_version"
            classpath "com.didiglobal.booster:booster-transform-shared-preferences:$booster_version"
            classpath "com.didiglobal.booster:booster-transform-r-inline:$booster_version"
            classpath "com.didiglobal.booster:booster-transform-finalizer-watchdog-daemon:$booster_version"
            classpath "com.didiglobal.booster:booster-transform-res-check:$booster_version"
            classpath "com.didiglobal.booster:booster-transform-activity-thread:$booster_version"

            // byteX
            classpath "com.bytedance.android.byteX:base-plugin:${plugin_version}"
            classpath "com.bytedance.android.byteX:const-inline-plugin:${plugin_version}"
            classpath "com.bytedance.android.byteX:method-call-opt-plugin:${plugin_version}"
            classpath "com.bytedance.android.byteX:access-inline-plugin:${plugin_version}"
            classpath "com.bytedance.android.byteX:field-assign-opt-plugin:${plugin_version}"
        }
    }
    repositories {
        maven { url 'https://maven.aliyun.com/repository/public' }
        mavenLocal()
        google()
        mavenCentral()
        jcenter()
        maven { url 'https://oss.sonatype.org/content/repositories/public' }
        maven { url "https://artifact.bytedance.com/repository/byteX/" }
    }

    project.afterEvaluate {
        // apply plugin only with this init script
        if (project.name == "app") {
            project.apply plugin: 'com.didiglobal.booster'

            project.apply plugin: "com.gh.gamecenter.plugin"

            project.apply plugin: 'bytex'
            project.apply plugin: 'bytex.const_inline' // inline 常量 https://github.com/bytedance/ByteX/blob/master/const-inline-plugin/README-zh.md
            project.apply plugin: 'bytex.method_call_opt' // 移除 log https://github.com/bytedance/ByteX/blob/master/method-call-opt-plugin/README-zh.md
            project.apply plugin: 'bytex.access_inline'
            // inline access https://github.com/bytedance/ByteX/blob/master/access-inline-plugin/README-zh.md
            project.apply plugin: 'bytex.field_assign_opt'
            //去除重复的赋值 https://github.com/bytedance/ByteX/blob/master/field-assign-opt-plugin/README-zh.md

            project.const_inline {
                enable true
                enableInDebug false
                logLevel "INFO"
                autoFilterReflectionField = true  //使用插件内置的反射检查过滤掉可能的反射常量，建议为true
                //supposesReflectionWithString = false //使用插件内置字符串匹配可能反射常量，建议为false
                skipWithRuntimeAnnotation true //过滤掉带有运行时注解的常量，推荐true
                skipWithAnnotations = [
                        //过滤掉被注解注释过的常量，包含class
                        "android/support/annotation/Keep",
                ]
                whiteList = []
            }

            project.method_call_opt {
                enable true
                enableInDebug false
                logLevel "DEBUG"
                //是否在log中显示删除方法调用指令后的方法指令，一般调试时使用
                showAfterOptInsLog false
                //需要删除的方法配置
                methodList = [
                        //下面的每一项配置必须严格按照数据配置，一个地方不对这一项不生效。
                        //class#method#desc
                        "android/util/Log#v#(Ljava/lang/String;Ljava/lang/String;)I",
                        "android/util/Log#v#(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I",
                        "android/util/Log#d#(Ljava/lang/String;Ljava/lang/String;)I",
                        "android/util/Log#d#(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I",
                        "android/util/Log#i#(Ljava/lang/String;Ljava/lang/String;)I",
                        "android/util/Log#i#(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I",
                        "android/util/Log#w#(Ljava/lang/String;Ljava/lang/String;)I",
                        "android/util/Log#w#(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I",
                        "android/util/Log#e#(Ljava/lang/String;Ljava/lang/String;)I",
                        "android/util/Log#e#(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I",
                        "android/util/Log#println#(ILjava/lang/String;Ljava/lang/String;)I",

                        "java/lang/Throwable#printStackTrace#()V",
                        "com/google/devtools/build/android/desugar/runtime/ThrowableExtension#printStackTrace#(Ljava/lang/Throwable;)V",

                        //项目中的方法
                        "com/lightgame/utils/Utils#log#(Ljava/lang/String;)V",
                        "com/lightgame/utils/Utils#log#(Ljava/lang/int;Ljava/lang/String;Ljava/lang/String;)V",
                        "com/lightgame/utils/Utils#log#(Ljava/lang/String;Ljava/lang/String;)V",
                        "com/lightgame/utils/Utils#log#(Ljava/lang/String;Ljava/lang/Object;)V",
                        "com/lightgame/utils/Utils#log#(Ljava/lang/Object;)V",
                        "com/gh/gamecenter/common/util/MtaHelper#onEvent#(Ljava/lang/Object;Ljava/lang/String;)V",
                        "com/gh/gamecenter/common/util/MtaHelper#onEventWithTime#(Ljava/lang/String;I[Ljava/lang/String;)V",
                        "com/gh/gamecenter/common/util/MtaHelper#onEventWithBasicDeviceInfo#(Ljava/lang/String;[Ljava/lang/String;)V"
                ]
                onlyCheckList = []
                whiteList = []
            }

            project.access_inline {
                enable true
                enableInDebug false
                logLevel "DEBUG"
            }

            project.field_assign_opt {
                enable false
                enableInDebug false
                logLevel "INFO"
                removeLineNumber true // 同时移除赋值对应的行号信息(如果有的话),默认true。
                whiteList = [
                        //白名单，ClassName.FieldName 。不支持模式匹配
                        //"android.support.constraint.solver.ArrayRow.isSimpleDefinition"
                ]
            }
        }

    }
}